diff options
author | Adrian Kummerlaender | 2014-09-15 20:27:46 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2014-09-15 20:27:46 +0200 |
commit | 54900ebb18646b7c6e01103ead559e8cbfa5c947 (patch) | |
tree | 72bcea0283d78b75cbb735c0e81525fa2c2503db | |
parent | e8c1b77603f3087611108435c0b33c4254468d22 (diff) | |
download | InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar.gz InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar.bz2 InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar.lz InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar.xz InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.tar.zst InputXSLT-54900ebb18646b7c6e01103ead559e8cbfa5c947.zip |
Added constructor supporting arbitrary streams to StreamInputSource
* i.e. it now supports reading transformations from either a file or stdin
-rw-r--r-- | ixslt.cc | 33 |
1 files changed, 21 insertions, 12 deletions
@@ -42,24 +42,33 @@ class StreamInputSource { const boost::filesystem::path& actualPath, const boost::filesystem::path& contextPath ): - file_(std::make_unique<boost::filesystem::ifstream>( - actualPath - )), - source_(*file_) { - this->source_.setSystemId( - *InputXSLT::XercesStringGuard<XMLCh>( - "file://" + contextPath.string() - ) - ); - } + StreamInputSource( + std::make_unique<boost::filesystem::ifstream>( + actualPath + ), + contextPath + ) { } + + StreamInputSource( + std::unique_ptr<std::istream>&& inputStream, + const boost::filesystem::path& contextPath + ): + stream_(std::move(inputStream)), + source_(stream_.get()) { + this->source_.setSystemId( + *InputXSLT::XercesStringGuard<XMLCh>( + "file://" + contextPath.string() + ) + ); + } xalan::XSLTInputSource& operator*() { return this->source_; } private: - std::unique_ptr<std::istream> file_; - xalan::XSLTInputSource source_; + std::unique_ptr<std::istream> stream_; + xalan::XSLTInputSource source_; }; |