aboutsummaryrefslogtreecommitdiff
path: root/src/support/dom
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/dom')
-rw-r--r--src/support/dom/document_cache.cc15
-rw-r--r--src/support/dom/document_cache.h9
2 files changed, 10 insertions, 14 deletions
diff --git a/src/support/dom/document_cache.cc b/src/support/dom/document_cache.cc
index c000aef..0133234 100644
--- a/src/support/dom/document_cache.cc
+++ b/src/support/dom/document_cache.cc
@@ -11,7 +11,10 @@ namespace InputXSLT {
auto DomDocumentCache::createDocument() -> document_ptr {
return document_ptr(
- xercesc::DOMImplementation::getImplementation()->createDocument()
+ xercesc::DOMImplementation::getImplementation()->createDocument(),
+ [](xercesc::DOMDocument* ptr) {
+ ptr->release();
+ }
);
}
@@ -21,7 +24,10 @@ auto DomDocumentCache::createDocument(const std::string& name) -> document_ptr {
nullptr,
*XercesStringGuard<XMLCh>(name),
nullptr
- )
+ ),
+ [](xercesc::DOMDocument* ptr) {
+ ptr->release();
+ }
);
}
@@ -41,9 +47,4 @@ xalan::XalanDocument* DomDocumentCache::create(document_ptr&& document) {
return this->cache_.top()->getXalanDocument();
}
-void DomDocumentCache::document_deleter::operator()(
- xercesc::DOMDocument* document) {
- document->release();
-}
-
}
diff --git a/src/support/dom/document_cache.h b/src/support/dom/document_cache.h
index f472249..115d194 100644
--- a/src/support/dom/document_cache.h
+++ b/src/support/dom/document_cache.h
@@ -8,22 +8,17 @@
#include <mutex>
#include <stack>
#include <memory>
+#include <functional>
#include "common.h"
namespace InputXSLT {
class DomDocumentCache {
- class document_deleter {
- friend std::unique_ptr<xercesc::DOMDocument, document_deleter>;
-
- void operator()(xercesc::DOMDocument*);
- };
-
public:
typedef std::unique_ptr<
xercesc::DOMDocument,
- document_deleter
+ std::function<void(xercesc::DOMDocument*)>
> document_ptr;
static document_ptr createDocument();