blob: f472249eb4fa3a5f9a4409c7a89ca7b0641c9c5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_
#define INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_
#include <xalanc/XalanDOM/XalanDocument.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <mutex>
#include <stack>
#include <memory>
#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
> document_ptr;
static document_ptr createDocument();
static document_ptr createDocument(const std::string&);
DomDocumentCache();
xalan::XalanDocument* create(document_ptr&&);
private:
class item;
std::mutex write_mutex_;
std::stack<std::unique_ptr<item>> cache_;
};
}
#include "document_cache_item.h"
#endif // INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_
|