From 54900ebb18646b7c6e01103ead559e8cbfa5c947 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 15 Sep 2014 20:27:46 +0200 Subject: Added constructor supporting arbitrary streams to StreamInputSource * i.e. it now supports reading transformations from either a file or stdin --- ixslt.cc | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/ixslt.cc b/ixslt.cc index 6932dec..a085af2 100644 --- a/ixslt.cc +++ b/ixslt.cc @@ -42,24 +42,33 @@ class StreamInputSource { const boost::filesystem::path& actualPath, const boost::filesystem::path& contextPath ): - file_(std::make_unique( - actualPath - )), - source_(*file_) { - this->source_.setSystemId( - *InputXSLT::XercesStringGuard( - "file://" + contextPath.string() - ) - ); - } + StreamInputSource( + std::make_unique( + actualPath + ), + contextPath + ) { } + + StreamInputSource( + std::unique_ptr&& inputStream, + const boost::filesystem::path& contextPath + ): + stream_(std::move(inputStream)), + source_(stream_.get()) { + this->source_.setSystemId( + *InputXSLT::XercesStringGuard( + "file://" + contextPath.string() + ) + ); + } xalan::XSLTInputSource& operator*() { return this->source_; } private: - std::unique_ptr file_; - xalan::XSLTInputSource source_; + std::unique_ptr stream_; + xalan::XSLTInputSource source_; }; -- cgit v1.2.3