From f6ff54c492df81018cf48da039ee681508f88e46 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 16 Aug 2014 23:30:36 +0200 Subject: Implemented primitive optional parameter support for external functions * renamed FunctionExternalTextFormatter into FunctionExternalCommand ** the goal is to provide a general interface to a variety of external commands *** e.g. not just text formatters but system utilities for file management and so on ** this requires the stdin parameter to be optional as not all external commands require stdin input * implemented "filter_derived" helper template to determine amount of optional parameters ** optional parameters are defined as "boost::optional" specializations *** they in turn can be detected by checking if "boost::optional_detail::optional_tag" is a base class * "callConstructDocument" member method of "FunctionBase" performs additional bounds checking of parameter vector * "boost::optional" specific member overload was added to "XObjectValue" helper class ** we will have to provide full specializations for all optional types as C++ prohibits partial member function template specialization * renamed the external function in "PlattformGuard" * changed README.md and test cases accordingly --- src/function/external_command.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/function/external_command.h (limited to 'src/function/external_command.h') diff --git a/src/function/external_command.h b/src/function/external_command.h new file mode 100644 index 0000000..8af5079 --- /dev/null +++ b/src/function/external_command.h @@ -0,0 +1,31 @@ +#ifndef INPUTXSLT_SRC_FUNCTION_EXTERNAL_COMMAND_H_ +#define INPUTXSLT_SRC_FUNCTION_EXTERNAL_COMMAND_H_ + +#include +#include + +#include "base.h" + +namespace InputXSLT { + +class FunctionExternalCommand : public FunctionBase< + FunctionExternalCommand, + std::string, + boost::optional +> { + public: + using FunctionBase::FunctionBase; + + protected: + friend FunctionBase; + + DomDocumentCache::document_ptr constructDocument( + std::string, + boost::optional + ) const; + +}; + +} + +#endif // INPUTXSLT_SRC_FUNCTION_EXTERNAL_COMMAND_H_ -- cgit v1.2.3