aboutsummaryrefslogtreecommitdiff
path: root/src/support/dom/document_cache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/dom/document_cache.cc')
-rw-r--r--src/support/dom/document_cache.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/support/dom/document_cache.cc b/src/support/dom/document_cache.cc
new file mode 100644
index 0000000..f814559
--- /dev/null
+++ b/src/support/dom/document_cache.cc
@@ -0,0 +1,26 @@
+#include "document_cache.h"
+
+namespace InputXSLT {
+
+DomDocumentCache::DomDocumentCache():
+ map_() { }
+
+DomDocumentCache::item* DomDocumentCache::get(const std::string& key) {
+ auto itemIter = this->map_.find(key);
+
+ if ( itemIter == this->map_.end() ) {
+ auto result = this->map_.emplace(
+ std::make_pair(key, std::unique_ptr<item>(new item("content")))
+ );
+
+ if ( result.second ) {
+ return (*(result.first)).second.get();
+ } else {
+ return nullptr;
+ }
+ } else {
+ return (*itemIter).second.get();
+ }
+}
+
+}