From 5f6fc45749b99e9013f04c95a525f2d627db01bf Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 7 Jun 2014 17:24:44 +0200 Subject: Improved FunctionBase constructDocument parameter propagation * replaced std::tuple constructing Mapper template methods with direct XObjectArgVectorType unpacking ** XObjectValue::get template method is applied directly using parameter pack unpacking * implemented custom IndexSequence / Sequence type to provide vector indexes * modified all external functions to provide matching constructDocument overloads --- src/support/tuple/mapper.h | 62 -------------------------------------- src/support/tuple/xobject_value.cc | 25 --------------- src/support/tuple/xobject_value.h | 17 ----------- src/support/type/xobject_value.cc | 25 +++++++++++++++ src/support/type/xobject_value.h | 17 +++++++++++ 5 files changed, 42 insertions(+), 104 deletions(-) delete mode 100644 src/support/tuple/mapper.h delete mode 100644 src/support/tuple/xobject_value.cc delete mode 100644 src/support/tuple/xobject_value.h create mode 100644 src/support/type/xobject_value.cc create mode 100644 src/support/type/xobject_value.h (limited to 'src/support') diff --git a/src/support/tuple/mapper.h b/src/support/tuple/mapper.h deleted file mode 100644 index 28c5f3b..0000000 --- a/src/support/tuple/mapper.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef INPUTXSLT_SRC_SUPPORT_TUPLE_MAPPER_H_ -#define INPUTXSLT_SRC_SUPPORT_TUPLE_MAPPER_H_ - -#include - -#include -#include - -#include "common.h" -#include "xobject_value.h" - -namespace InputXSLT { - -template -using enable_if = typename std::enable_if::type; - -namespace Mapper { - template < - typename Target, - std::size_t Index = 0, - typename Current = std::tuple<>, - enable_if::value> = 0 - > - inline Target construct( - const xalan::XPathExecutionContext::XObjectArgVectorType&, - Current&& current - ) { - return current; - } - - template < - typename Target, - std::size_t Index = 0, - typename Current = std::tuple<>, - enable_if::value> = 0 - > - inline Target construct( - const xalan::XPathExecutionContext::XObjectArgVectorType& source, - Current&& current = std::tuple<>() - ) { - return construct< - Target, - Index + 1 - >( - source, - std::tuple_cat( - current, - std::make_tuple( - XObjectValue::get< - typename std::tuple_element::type - >( - source[Index] - ) - ) - ) - ); - } -} - -} - -#endif // INPUTXSLT_SRC_SUPPORT_TUPLE_MAPPER_H_ diff --git a/src/support/tuple/xobject_value.cc b/src/support/tuple/xobject_value.cc deleted file mode 100644 index cdeb9c6..0000000 --- a/src/support/tuple/xobject_value.cc +++ /dev/null @@ -1,25 +0,0 @@ -#include "xobject_value.h" - -#include - -#include - -#include "support/xalan_string.h" - -namespace InputXSLT { - -namespace XObjectValue { - -template <> -std::string get(const xalan::XObjectPtr& ptr) { - return boost::trim_copy(toString(ptr->str())); -} - -template <> -xalan::XObjectPtr get(const xalan::XObjectPtr& ptr) { - return ptr; -} - -} - -} diff --git a/src/support/tuple/xobject_value.h b/src/support/tuple/xobject_value.h deleted file mode 100644 index bb602a4..0000000 --- a/src/support/tuple/xobject_value.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ -#define INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ - -#include - -#include "common.h" - -namespace InputXSLT { - -namespace XObjectValue { - template - Type get(const xalan::XObjectPtr&); -} - -} - -#endif // INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ diff --git a/src/support/type/xobject_value.cc b/src/support/type/xobject_value.cc new file mode 100644 index 0000000..cdeb9c6 --- /dev/null +++ b/src/support/type/xobject_value.cc @@ -0,0 +1,25 @@ +#include "xobject_value.h" + +#include + +#include + +#include "support/xalan_string.h" + +namespace InputXSLT { + +namespace XObjectValue { + +template <> +std::string get(const xalan::XObjectPtr& ptr) { + return boost::trim_copy(toString(ptr->str())); +} + +template <> +xalan::XObjectPtr get(const xalan::XObjectPtr& ptr) { + return ptr; +} + +} + +} diff --git a/src/support/type/xobject_value.h b/src/support/type/xobject_value.h new file mode 100644 index 0000000..bb602a4 --- /dev/null +++ b/src/support/type/xobject_value.h @@ -0,0 +1,17 @@ +#ifndef INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ +#define INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ + +#include + +#include "common.h" + +namespace InputXSLT { + +namespace XObjectValue { + template + Type get(const xalan::XObjectPtr&); +} + +} + +#endif // INPUTXSLT_SRC_SUPPORT_TUPLE_XOBJECT_VALUE_H_ -- cgit v1.2.3