aboutsummaryrefslogtreecommitdiff
path: root/src/function/base.h
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-14 20:55:51 +0200
committerAdrian Kummerländer2014-05-14 20:55:51 +0200
commit5fbca0993146982ab1dbb0d352c1e15e40b3de22 (patch)
tree7f47a339fb61d5c8423162482494eafd95cc654d /src/function/base.h
parent943768ad437011756395b86958399992e6822604 (diff)
downloadInputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar.gz
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar.bz2
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar.lz
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar.xz
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.tar.zst
InputXSLT-5fbca0993146982ab1dbb0d352c1e15e40b3de22.zip
Moved responsibility for argument conversion to FunctionBase descendants
* external functions may expect arguments with a type different from boost::filesystem::path so they are only provided raw string values * moved xalan string conversion logic into separate compilation unit
Diffstat (limited to 'src/function/base.h')
-rw-r--r--src/function/base.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/function/base.h b/src/function/base.h
index 5604186..7fbd818 100644
--- a/src/function/base.h
+++ b/src/function/base.h
@@ -11,6 +11,7 @@
#include <array>
#include "common.h"
+#include "support/xalan_string.h"
#include "support/dom/document_cache.h"
#include "support/filesystem_context.h"
@@ -22,10 +23,7 @@ template <
>
class FunctionBase : public xalan::Function {
public:
- typedef std::array<
- boost::filesystem::path,
- ArgumentCount
- > argument_array;
+ typedef std::array<std::string, ArgumentCount> argument_array;
FunctionBase():
document_cache_(std::make_shared<DomDocumentCache>()) { }
@@ -43,15 +41,14 @@ class FunctionBase : public xalan::Function {
locator
);
- const FilesystemContext fsContext(locator);
argument_array pathArguments;
std::transform(
rawArguments.begin(),
rawArguments.end(),
pathArguments.begin(),
- [&fsContext](const xalan::XObjectPtr& ptr) -> boost::filesystem::path {
- return fsContext.resolve(ptr->str());
+ [](const xalan::XObjectPtr& ptr) -> std::string {
+ return toString(ptr->str());
}
);
@@ -60,7 +57,7 @@ class FunctionBase : public xalan::Function {
static_cast<Implementation*>(
const_cast<FunctionBase*>(this)
)->constructDocument(
- fsContext,
+ FilesystemContext(locator),
pathArguments
)
)
@@ -108,7 +105,7 @@ class FunctionBase : public xalan::Function {
xalan::XalanNode* context,
const xalan::Locator* locator
) const {
- const bool notNull = std::none_of(
+ const bool anyNull = std::any_of(
rawArguments.begin(),
rawArguments.end(),
[](const xalan::XObjectPtr& ptr) -> bool {
@@ -116,7 +113,7 @@ class FunctionBase : public xalan::Function {
}
);
- if ( rawArguments.size() != ArgumentCount && notNull ) {
+ if ( rawArguments.size() != ArgumentCount || anyNull ) {
xalan::XPathExecutionContext::GetAndReleaseCachedString guard(
executionContext
);