Module: XML Streams Package: XML Streams
RWTParsedTransformObjectInputStreamImp RWXmlObjectInputStreamImp
#include rw/xmlstreams/RWTParsedTransformObjectInputStreamImp.h>
This class uses RWXmlObjectInputStreamImp and RWTParsedTransformInputStreamImp to construct an XML input stream that applies a generic transformation to the XML document before reading it from the source.
// Open an fstream to serve as our source ifstream s("foo.xml"); // Create a transformation object, which must have a // transform(const RWXmlElementImp&,ostream&) interface MyTransform t; // Create an XML data stream that uses the fstream RWObjectInputStream in = RWTParsedTransformObjectInputStreamImp<MyTransform>::make(s,t); // Read an integer from XML data stream. int i; in >> i;
static RWObjectInputStream make(RW_SL_IO_STD(istream)& source, Transform transform, bool escape = true);
Constructs an RWTParsedTransformObjectInputStreamImp instance that uses source as its source of bytes, and returns a handle to it. The XML input stream includes a transformation of the XML document based on the transformation object transform.
The parameter escape sets whether primitive element values will be unescaped. By default, this parameter is set to true.
static RWObjectInputStream make(RW_SL_IO_STD(istream)& source, Transform transform, RW_SL_IO_STD(ios)*& formatter, bool escape = true);
This function is the same as the one above, except that it also takes a pointer reference to an std::ios formatting object. An empty formatting object pointer is created before the XML stream is created and is passed through this make() function to the constructor:
std::ios* formatter; // uninitialized pointer RWObjectOutputStream xostr = RWTParsedTransformObjectInputStreamImp<MyTransform>
::make(infile,script,formatter);
The constructor, in creating the underlying character stream for the XML stream, creates a formatting object for the stream and places the address of that object in the pointer reference. The calling application can then use this formatting object to manipulate data formats in the XML stream.
formatter->precision(15); // manipulate data format
RWTParsedTransformObjectInputStreamImp
(RW_SL_IO_STD(istream)& istr, Transform transform,
bool escape);
Used by the make() function and potentially by derived classes to initialize the source data stream and to insert into the stream a transformation of the XML document based on the transformation object transform.
The parameter istr is a handle to the initialized stream.
The parameter transform is a transformation object that must supply a public interface function transform(istream&,ostream&).
The parameter escape sets whether primitive element values will be unescaped. By default, this parameter is set to true.
RWTParsedTransformObjectInputStreamImp(RW_SL_IO_STD(istream)& istr, Transform transform, RW_SL_IO_STD(ios)*& formatter, bool escape);
This constructor is the same as the one above, except that it also takes a pointer reference to an std::ios formatting object. An empty formatting object pointer is created before the XML stream is created and is passed to this constructor through the make() function. This constructor, in creating the underlying element stream for the XML stream, creates a formatting object for the stream and places the address of that object in the pointer reference. The calling application can then use this formatting object to manipulate data formats in the XML stream. See the corresponding make() function description above for an example.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.