diff options
Diffstat (limited to 'src/function')
-rw-r--r-- | src/function/base.h | 26 | ||||
-rw-r--r-- | src/function/read_directory.cc | 4 | ||||
-rw-r--r-- | src/function/read_directory.h | 2 | ||||
-rw-r--r-- | src/function/read_file.cc | 4 | ||||
-rw-r--r-- | src/function/read_file.h | 2 | ||||
-rw-r--r-- | src/function/read_xml_file.cc | 4 | ||||
-rw-r--r-- | src/function/read_xml_file.h | 2 | ||||
-rw-r--r-- | src/function/transform.cc | 27 | ||||
-rw-r--r-- | src/function/transform.h | 2 |
9 files changed, 35 insertions, 38 deletions
diff --git a/src/function/base.h b/src/function/base.h index 8145924..cc207c3 100644 --- a/src/function/base.h +++ b/src/function/base.h @@ -22,7 +22,7 @@ template < > class FunctionBase : public xalan::Function { public: - typedef std::tuple<Types...> argument_tuple; + typedef std::tuple<Types...> parameter_tuple; FunctionBase(): document_cache_(std::make_shared<DomDocumentCache>()) { } @@ -30,11 +30,11 @@ class FunctionBase : public xalan::Function { virtual xalan::XObjectPtr execute( xalan::XPathExecutionContext& executionContext, xalan::XalanNode* context, - const XObjectArgVectorType& arguments, + const XObjectArgVectorType& parameters, const xalan::Locator* locator ) const { - this->validateArguments( - arguments, + this->validateParameters( + parameters, executionContext, context, locator @@ -46,7 +46,7 @@ class FunctionBase : public xalan::Function { const_cast<FunctionBase*>(this) )->constructDocument( FilesystemContext(locator), - Mapper::template construct<argument_tuple>(arguments) + Mapper::template construct<parameter_tuple>(parameters) ) ) ); @@ -79,29 +79,29 @@ class FunctionBase : public xalan::Function { const xalan::XalanDOMString& getError( xalan::XalanDOMString& result) const { result.assign(std::string( - "The function expects " + - std::to_string(std::tuple_size<argument_tuple>::value) + - " argument(s)" + "The function expects " + + std::to_string(std::tuple_size<parameter_tuple>::value) + + " parameter(s)" ).data()); return result; } - inline void validateArguments( - const XObjectArgVectorType& arguments, + inline void validateParameters( + const XObjectArgVectorType& parameters, xalan::XPathExecutionContext& executionContext, xalan::XalanNode* context, const xalan::Locator* locator ) const { const bool anyNull = std::any_of( - arguments.begin(), - arguments.end(), + parameters.begin(), + parameters.end(), [](const xalan::XObjectPtr& ptr) -> bool { return ptr.null(); } ); - if ( arguments.size() != std::tuple_size<argument_tuple>::value || anyNull ) { + if ( parameters.size() != std::tuple_size<parameter_tuple>::value || anyNull ) { xalan::XPathExecutionContext::GetAndReleaseCachedString guard( executionContext ); diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc index 4060523..215a59e 100644 --- a/src/function/read_directory.cc +++ b/src/function/read_directory.cc @@ -11,10 +11,10 @@ namespace InputXSLT { xercesc::DOMDocument* FunctionReadDirectory::constructDocument( const InputXSLT::FilesystemContext& fsContext, - const FunctionBase::argument_tuple& arguments + const FunctionBase::parameter_tuple& parameters ) { const boost::filesystem::path directoryPath( - fsContext.resolve(std::get<0>(arguments)) + fsContext.resolve(std::get<0>(parameters)) ); xercesc::DOMDocument* const domDocument( diff --git a/src/function/read_directory.h b/src/function/read_directory.h index 562e191..88fcf15 100644 --- a/src/function/read_directory.h +++ b/src/function/read_directory.h @@ -17,7 +17,7 @@ class FunctionReadDirectory : public FunctionBase< xercesc::DOMDocument* constructDocument( const FilesystemContext&, - const FunctionBase::argument_tuple& + const FunctionBase::parameter_tuple& ); }; diff --git a/src/function/read_file.cc b/src/function/read_file.cc index 8e14f41..5ded1ac 100644 --- a/src/function/read_file.cc +++ b/src/function/read_file.cc @@ -26,10 +26,10 @@ namespace InputXSLT { xercesc::DOMDocument* FunctionReadFile::constructDocument( const FilesystemContext& fsContext, - const FunctionBase::argument_tuple& arguments + const FunctionBase::parameter_tuple& parameters ) { const boost::filesystem::path filePath( - fsContext.resolve(std::get<0>(arguments)) + fsContext.resolve(std::get<0>(parameters)) ); xercesc::DOMDocument* const domDocument( diff --git a/src/function/read_file.h b/src/function/read_file.h index 7b17583..cc1b662 100644 --- a/src/function/read_file.h +++ b/src/function/read_file.h @@ -17,7 +17,7 @@ class FunctionReadFile : public FunctionBase< xercesc::DOMDocument* constructDocument( const FilesystemContext&, - const FunctionBase::argument_tuple& + const FunctionBase::parameter_tuple& ); }; diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc index 6e89701..5f1d47d 100644 --- a/src/function/read_xml_file.cc +++ b/src/function/read_xml_file.cc @@ -36,10 +36,10 @@ namespace InputXSLT { xercesc::DOMDocument* FunctionReadXmlFile::constructDocument( const FilesystemContext& fsContext, - const FunctionBase::argument_tuple& arguments + const FunctionBase::parameter_tuple& parameters ) { const boost::filesystem::path filePath( - fsContext.resolve(std::get<0>(arguments)) + fsContext.resolve(std::get<0>(parameters)) ); xercesc::DOMDocument* const domDocument( diff --git a/src/function/read_xml_file.h b/src/function/read_xml_file.h index 5355449..6061257 100644 --- a/src/function/read_xml_file.h +++ b/src/function/read_xml_file.h @@ -17,7 +17,7 @@ class FunctionReadXmlFile : public FunctionBase< xercesc::DOMDocument* constructDocument( const FilesystemContext&, - const FunctionBase::argument_tuple& + const FunctionBase::parameter_tuple& ); }; diff --git a/src/function/transform.cc b/src/function/transform.cc index 4f9aecc..6a2b7ad 100644 --- a/src/function/transform.cc +++ b/src/function/transform.cc @@ -11,14 +11,18 @@ namespace InputXSLT { xercesc::DOMDocument* FunctionTransform::constructDocument( const InputXSLT::FilesystemContext& fsContext, - const FunctionBase::argument_tuple& arguments + const FunctionBase::parameter_tuple& parameters ) { - const boost::filesystem::path transformationPath( - fsContext.resolve(std::get<0>(arguments)) + const std::string transformationPath( + fsContext.resolve(std::get<0>(parameters)).string() ); - const boost::filesystem::path targetPath( - fsContext.resolve(std::get<1>(arguments)) + const std::string targetPath( + fsContext.resolve(std::get<1>(parameters)).string() + ); + + const xalan::XObjectPtr& parameterObject( + std::get<2>(parameters) ); xercesc::DOMDocument* const domDocument( @@ -33,23 +37,16 @@ xercesc::DOMDocument* FunctionTransform::constructDocument( domDocument->getDocumentElement() ); - InputXSLT::TransformationFacade transformation( - transformationPath.string() - ); - - const int result = transformation.generate( - targetPath.string(), - std::get<2>(arguments) - ); + InputXSLT::TransformationFacade transformation(transformationPath); - if ( result == 0 ) { + if ( transformation.generate(targetPath, parameterObject) == 0 ) { xercesc::DOMElement* const resultNode( domDocument->createElement(*XercesStringGuard<XMLCh>("result")) ); resultNode->setAttribute( *XercesStringGuard<XMLCh>("name"), - *XercesStringGuard<XMLCh>(targetPath.string()) + *XercesStringGuard<XMLCh>(targetPath) ); rootNode->appendChild(resultNode); diff --git a/src/function/transform.h b/src/function/transform.h index f010596..810738e 100644 --- a/src/function/transform.h +++ b/src/function/transform.h @@ -19,7 +19,7 @@ class FunctionTransform : public FunctionBase< xercesc::DOMDocument* constructDocument( const FilesystemContext&, - const FunctionBase::argument_tuple& + const FunctionBase::parameter_tuple& ); }; |