diff options
Diffstat (limited to 'src/support/type')
-rw-r--r-- | src/support/type/filter.h | 24 | ||||
-rw-r--r-- | src/support/type/xobject_value.cc | 13 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/support/type/filter.h b/src/support/type/filter.h new file mode 100644 index 0000000..4a0e19f --- /dev/null +++ b/src/support/type/filter.h @@ -0,0 +1,24 @@ +#ifndef INPUTXSLT_SRC_SUPPORT_TYPE_FILTER_H_ +#define INPUTXSLT_SRC_SUPPORT_TYPE_FILTER_H_ + +#include <tuple> +#include <type_traits> + +namespace InputXSLT { + +template < + typename BaseReference, + typename Head, + typename... Tail +> +struct filter_derived { + typedef typename std::conditional< + std::is_base_of<BaseReference, Head>::value, + std::tuple<Head, Tail...>, + std::tuple<Tail...> + >::type type; +}; + +} + +#endif // INPUTXSLT_SRC_SUPPORT_TYPE_FILTER_H_ diff --git a/src/support/type/xobject_value.cc b/src/support/type/xobject_value.cc index 9bb6648..e457a69 100644 --- a/src/support/type/xobject_value.cc +++ b/src/support/type/xobject_value.cc @@ -4,7 +4,8 @@ #include <xalanc/XalanDOM/XalanDocumentFragment.hpp> #include <boost/algorithm/string.hpp> -#include "boost/filesystem.hpp" +#include <boost/filesystem.hpp> +#include <boost/optional.hpp> #include <string> @@ -27,6 +28,16 @@ std::string XObjectValue::get<std::string>( } template <> +boost::optional<std::string> XObjectValue::get<boost::optional<std::string>>( + const xalan::XObjectPtr& ptr) const { + if ( ptr.null() ) { + return boost::optional<std::string>(); + } else { + return this->get<std::string>(ptr); + } +} + +template <> boost::filesystem::path XObjectValue::get<boost::filesystem::path>( const xalan::XObjectPtr& ptr) const { const std::string rawPath( |