aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-09-15 20:27:46 +0200
committerAdrian Kummerlaender2014-09-15 20:27:46 +0200
commit54900ebb18646b7c6e01103ead559e8cbfa5c947 (patch)
tree72bcea0283d78b75cbb735c0e81525fa2c2503db
parente8c1b77603f3087611108435c0b33c4254468d22 (diff)
downloadInputXSLT-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.cc33
1 files 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<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_;
};