diff options
author | Adrian Kummerlaender | 2014-07-01 20:54:02 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2014-07-01 20:54:02 +0200 |
commit | 784ac42a0f05608e3d9c5e15246dbf76ce9e3d51 (patch) | |
tree | d06531455b788c5e04551bd28800d5c3971c2b1d /src | |
parent | 2becbedf4cb779b56578e495293b850ff05b738f (diff) | |
download | InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar.gz InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar.bz2 InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar.lz InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar.xz InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.tar.zst InputXSLT-784ac42a0f05608e3d9c5e15246dbf76ce9e3d51.zip |
Removed unnecessary template member methods from TranformationFacade
* neither the constructor nor the generate member methods need to be templatized
** only supported "output" argument is now a reference to a "std::basic_ostream<char>" instance
** the caller is responsible for e.g. writing the output to disk
* this was done to simplify the basic interface of InputXSLT
* removed "default_params" testcase along with default parameter generation
** this feature is neither used nor required
Diffstat (limited to 'src')
-rw-r--r-- | src/transformation_facade.cc | 45 | ||||
-rw-r--r-- | src/transformation_facade.h | 60 |
2 files changed, 26 insertions, 79 deletions
diff --git a/src/transformation_facade.cc b/src/transformation_facade.cc index 97b17bb..9d248b8 100644 --- a/src/transformation_facade.cc +++ b/src/transformation_facade.cc @@ -3,10 +3,6 @@ #include <xalanc/XSLT/XSLTInputSource.hpp> #include <xalanc/XalanTransformer/XalanCompiledStylesheet.hpp> -#include "boost/filesystem.hpp" - -#include <sstream> - #include "support/xerces_string_guard.h" namespace InputXSLT { @@ -70,39 +66,34 @@ WarningCapacitor::warning_cache_ptr TransformationFacade::getCachedWarnings() { return this->warning_capacitor_.discharge(); } +void TransformationFacade::generate(std::basic_ostream<char>& targetStream) { + StylesheetParameterGuard guard(this->transformer_); + + this->generate(targetStream, guard); +} + void TransformationFacade::generate( - const std::string& targetPath, - StylesheetParameterGuard& parameters + std::basic_ostream<char>& targetStream, + const StylesheetParameterGuard::map& parameters ) { - const boost::filesystem::path targetPathHelper( - boost::filesystem::absolute(targetPath) - ); - - parameters.set( - "target-file", targetPathHelper.filename().string() - ); - parameters.set( - "parent-directory", targetPathHelper.parent_path().filename().string() - ); + StylesheetParameterGuard guard(this->transformer_, parameters); - this->generate( - xalan::XSLTResultTarget(targetPath.data()), - parameters - ); + this->generate(targetStream, guard); } void TransformationFacade::generate( std::basic_ostream<char>& targetStream, - StylesheetParameterGuard& parameters + const xalan::XObjectPtr& parameter ) { - this->generate( - xalan::XSLTResultTarget(targetStream), - parameters - ); + StylesheetParameterGuard guard(this->transformer_); + guard.set("parameters", parameter); + + this->generate(targetStream, guard); } + void TransformationFacade::generate( - xalan::XSLTResultTarget&& outputTarget, + std::basic_ostream<char>& targetStream, StylesheetParameterGuard& ) { ErrorCapacitor errorCapacitor(&this->error_multiplexer_); @@ -110,7 +101,7 @@ void TransformationFacade::generate( this->transformer_.transform( *(this->input_), this->transformation_, - outputTarget + targetStream ); errorCapacitor.discharge(); diff --git a/src/transformation_facade.h b/src/transformation_facade.h index eb134cd..ca57de4 100644 --- a/src/transformation_facade.h +++ b/src/transformation_facade.h @@ -5,6 +5,7 @@ #include <string> #include <memory> +#include <sstream> #include <functional> #include "common.h" @@ -26,9 +27,6 @@ class TransformationFacade { Arguments&&... ); - template<typename... Arguments> - TransformationFacade(Arguments&&..., IncludeEntityResolver*); - TransformationFacade( xalan::XSLTInputSource, IncludeEntityResolver* @@ -40,14 +38,9 @@ class TransformationFacade { IncludeEntityResolver* ); - template <typename Target> - void generate(Target&); - - template <typename Target> - void generate(Target&, const StylesheetParameterGuard::map&); - - template <typename Target> - void generate(Target&, const xalan::XObjectPtr&); + void generate(std::basic_ostream<char>&); + void generate(std::basic_ostream<char>&, const StylesheetParameterGuard::map&); + void generate(std::basic_ostream<char>&, const xalan::XObjectPtr&); WarningCapacitor::warning_cache_ptr getCachedWarnings(); @@ -59,9 +52,10 @@ class TransformationFacade { ErrorMultiplexer error_multiplexer_; WarningCapacitor warning_capacitor_; - void generate(const std::string&, StylesheetParameterGuard&); - void generate(std::basic_ostream<char>&, StylesheetParameterGuard&); - void generate(xalan::XSLTResultTarget&&, StylesheetParameterGuard&); + void generate( + std::basic_ostream<char>&, + StylesheetParameterGuard& + ); }; @@ -84,44 +78,6 @@ auto TransformationFacade::try_create( } } -template <typename... Arguments> -TransformationFacade::TransformationFacade( - Arguments&&... arguments, - IncludeEntityResolver* resolver -): - TransformationFacade( - xalan::XSLTInputSource(std::forward<Arguments>(arguments))..., - resolver - ) { } - -template <typename Target> -void TransformationFacade::generate(Target& target) { - StylesheetParameterGuard guard(this->transformer_); - - this->generate(target, guard); -} - -template <typename Target> -void TransformationFacade::generate( - Target& target, - const StylesheetParameterGuard::map& parameters -) { - StylesheetParameterGuard guard(this->transformer_, parameters); - - this->generate(target, guard); -} - -template <typename Target> -void TransformationFacade::generate( - Target& target, - const xalan::XObjectPtr& parameter -) { - StylesheetParameterGuard guard(this->transformer_); - guard.set("parameters", parameter); - - this->generate(target, guard); -} - } #endif // INPUTXSLT_SRC_TRANSFORMATION_FACADE_H_ |