aboutsummaryrefslogtreecommitdiff
path: root/src/function/transform.cc
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-14 16:41:58 +0200
committerAdrian Kummerländer2014-05-14 16:41:58 +0200
commit943768ad437011756395b86958399992e6822604 (patch)
treefca4a7f9672b9a7bc8b6691d841c24322a76083b /src/function/transform.cc
parentb3bf487144a1a2978cc17d40b6d6ba1c0467fc37 (diff)
downloadInputXSLT-943768ad437011756395b86958399992e6822604.tar
InputXSLT-943768ad437011756395b86958399992e6822604.tar.gz
InputXSLT-943768ad437011756395b86958399992e6822604.tar.bz2
InputXSLT-943768ad437011756395b86958399992e6822604.tar.lz
InputXSLT-943768ad437011756395b86958399992e6822604.tar.xz
InputXSLT-943768ad437011756395b86958399992e6822604.tar.zst
InputXSLT-943768ad437011756395b86958399992e6822604.zip
Added ArgumentCount parameter to FunctionBase template
* constructDocument member method is provided with a FunctionBase::argument_array instance * improved argument validation in FunctionBase * this parameter was added to support FunctionBase as a base class for FunctionTransform
Diffstat (limited to 'src/function/transform.cc')
-rw-r--r--src/function/transform.cc64
1 files changed, 6 insertions, 58 deletions
diff --git a/src/function/transform.cc b/src/function/transform.cc
index 9b600d9..360b61d 100644
--- a/src/function/transform.cc
+++ b/src/function/transform.cc
@@ -7,15 +7,15 @@
#include "transformation_facade.h"
#include "support/xerces_string_guard.h"
-namespace {
-
-using InputXSLT::XercesStringGuard;
+namespace InputXSLT {
-xercesc::DOMDocument* constructDocument(
+xercesc::DOMDocument* FunctionTransform::constructDocument(
const InputXSLT::FilesystemContext&,
- const boost::filesystem::path& transformationPath,
- const boost::filesystem::path& targetPath
+ const FunctionBase::argument_array& arguments
) {
+ const boost::filesystem::path& transformationPath = arguments[0];
+ const boost::filesystem::path& targetPath = arguments[1];
+
xercesc::DOMDocument* const domDocument(
xercesc::DOMImplementation::getImplementation()->createDocument(
nullptr,
@@ -59,55 +59,3 @@ xercesc::DOMDocument* constructDocument(
}
}
-
-namespace InputXSLT {
-
-FunctionTransform::FunctionTransform():
- document_cache_(std::make_shared<DomDocumentCache>()) { }
-
-xalan::XObjectPtr FunctionTransform::execute(
- xalan::XPathExecutionContext& executionContext,
- xalan::XalanNode*,
- const xalan::XObjectPtr argument1,
- const xalan::XObjectPtr argument2,
- const xalan::Locator* locator
-) const {
- const FilesystemContext fsContext(locator);
-
- xalan::XalanDocument* const domDocument(
- this->document_cache_->create(
- constructDocument(
- fsContext,
- fsContext.resolve(argument1->str()),
- fsContext.resolve(argument2->str())
- )
- )
- );
-
- xalan::XPathExecutionContext::BorrowReturnMutableNodeRefList nodeList(
- executionContext
- );
-
- nodeList->addNodes(
- *domDocument->getDocumentElement()->getChildNodes()
- );
-
- return executionContext.getXObjectFactory().createNodeSet(nodeList);
-}
-
-FunctionTransform* FunctionTransform::clone(
- xalan::MemoryManager& manager) const {
- return xalan::XalanCopyConstruct(
- manager,
- *this
- );
-}
-
-const xalan::XalanDOMString& FunctionTransform::getError(
- xalan::XalanDOMString& result) const {
- result.assign("The function expects two arguments of type string.");
-
- return result;
-}
-
-}