From 9aad4dffd9c8b0fde534b3abc3c27875547423fa Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Mon, 5 May 2014 20:42:36 +0200 Subject: Encapsulated common parts of external function inplementations * common parts were moved into CRTP template base class _FunctionBase_ * all external functions are derived from that class ** only have to implement _constructDocument_ member method ** currently only supports a single string input parameter which is enough for now * this change condenses external funtion implementations to the essential and should increase readability as well as maintainability --- src/function/read_xml_file.h | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'src/function/read_xml_file.h') diff --git a/src/function/read_xml_file.h b/src/function/read_xml_file.h index d7ef440..5314b4a 100644 --- a/src/function/read_xml_file.h +++ b/src/function/read_xml_file.h @@ -1,39 +1,21 @@ #ifndef INPUTXSLT_SRC_FUNCTION_READ_XML_FILE_H_ #define INPUTXSLT_SRC_FUNCTION_READ_XML_FILE_H_ -#include -#include -#include -#include - -#include -#include - -#include "common.h" -#include "support/dom/document_cache.h" +#include "base.h" namespace InputXSLT { -class FunctionReadXmlFile : public xalan::Function { +class FunctionReadXmlFile : public FunctionBase { public: - FunctionReadXmlFile(); - - virtual xalan::XObjectPtr execute( - xalan::XPathExecutionContext&, - xalan::XalanNode*, - const xalan::XObjectPtr, - const xalan::Locator* - ) const; - - virtual FunctionReadXmlFile* clone(xalan::MemoryManager&) const; - - FunctionReadXmlFile& operator=(const FunctionReadXmlFile&) = delete; - bool operator==(const FunctionReadXmlFile&) const = delete; + using FunctionBase::FunctionBase; - private: - std::shared_ptr document_cache_; + protected: + friend FunctionBase; - const xalan::XalanDOMString& getError(xalan::XalanDOMString& result) const; + xercesc::DOMDocument* constructDocument( + const FilesystemContext&, + const boost::filesystem::path& + ); }; -- cgit v1.2.3