From 35334241ce4b76b1b1a66219ce938f27fdf39031 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Tue, 20 May 2014 21:17:10 +0200 Subject: Replaced FunctionResolveInclude with IncludeEntityResolver * xalan / xerces offers the possibility of implementing custom entity resolvers which are called upon by "" had to be implemented --- src/function/resolve_include.cc | 62 ----------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/function/resolve_include.cc (limited to 'src/function/resolve_include.cc') diff --git a/src/function/resolve_include.cc b/src/function/resolve_include.cc deleted file mode 100644 index ac4adf5..0000000 --- a/src/function/resolve_include.cc +++ /dev/null @@ -1,62 +0,0 @@ -#include "resolve_include.h" - -#include - -#include "support/xalan_string.h" - -namespace InputXSLT { - -FunctionResolveInclude::FunctionResolveInclude( - const std::vector& path): - path_(new std::vector()) { - this->path_->reserve(path.size()); - - std::transform( - path.begin(), - path.end(), - std::back_inserter(*this->path_), - [](const std::string& path) -> FilesystemContext { - return FilesystemContext(path); - } - ); -} - -xalan::XObjectPtr FunctionResolveInclude::execute( - xalan::XPathExecutionContext& executionContext, - xalan::XalanNode*, - const xalan::XObjectPtr parameter, - const xalan::Locator* -) const { - const std::string filePath(toString(parameter->str())); - - for ( auto&& context : *this->path_ ) { - const boost::filesystem::path resolvedPath( - context.resolve(filePath) - ); - - if ( boost::filesystem::exists(resolvedPath) && - boost::filesystem::is_regular_file(resolvedPath) ) { - return executionContext.getXObjectFactory().createString( - toString(resolvedPath.string()) - ); - } - } - - return executionContext.getXObjectFactory().createString( - toString("error") - ); -} - -FunctionResolveInclude* FunctionResolveInclude::clone( - xalan::MemoryManager& manager) const { - return xalan::XalanCopyConstruct(manager, *this); -} - -const xalan::XalanDOMString& FunctionResolveInclude::getError( - xalan::XalanDOMString& result) const { - result.assign("The function expects one parameter of type string."); - - return result; -} - -} -- cgit v1.2.3