From 0b611b7bd28851fe8096b3d2c121c68e231ada11 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 26 Apr 2014 11:21:10 +0200 Subject: Implemented global DOM document cache * the plan to return XML-nodes from each external function requires a better way to manage the lifetime of many xerces DOM document instances and their support class instances ** this is why DomDocumentCache and DomDocumentCache::item were implemented ** based on std::map so we can easily access the result of old function calls * changed external read-directory function to return the children of the document node instead of the document node itself ** removes unnecessary cruft in function calls ** will make returning status codes alongside the function result more pleasing to the eye * updated test transformation to reflect new features --- src/function/read_directory.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/function/read_directory.h') diff --git a/src/function/read_directory.h b/src/function/read_directory.h index 782ebed..3fcf389 100644 --- a/src/function/read_directory.h +++ b/src/function/read_directory.h @@ -6,18 +6,15 @@ #include #include -#include -#include - #include "common.h" #include "support/filesystem_context.h" -#include "support/dom_document_guard.h" +#include "support/dom/document_cache.h" namespace InputXSLT { class FunctionReadDirectory : public xalan::Function { public: - FunctionReadDirectory(const FilesystemContext&); + FunctionReadDirectory(const FilesystemContext&, DomDocumentCache&); virtual xalan::XObjectPtr execute( xalan::XPathExecutionContext&, @@ -33,10 +30,7 @@ class FunctionReadDirectory : public xalan::Function { private: const FilesystemContext& fs_context_; - - std::shared_ptr< - std::stack - > documents_; + DomDocumentCache& document_cache_; const xalan::XalanDOMString& getError(xalan::XalanDOMString&) const; -- cgit v1.2.3