Module: XML Streams Package: XML Streams
RWEnhancedXMLObjectInputStreamImp RWXmlObjectStreamCommon RWObjectInputStreamImp RWFilteredDataInputStreamImp
#include <rw/xmlstreams/RWEnhancedXMLObjectInputStreamImp.h>
The class RWEnhancedXmlObjectInputStreamImp reads objects encoded in XML from the supplied RWDataInputStream.
Implements the body idiom from the handle/body pattern.
// Open an fstream to serve as our source ifstream s("foo.xml"); // Create an XML data stream using the fstream RWObjectInputStream in =
RWEnhancedXmlObjectInputStreamImp::make(s); // Read integer from XML data stream int i; s >> i;
RWEnhancedXmlObjectInputStreamImp(RW_SL_IO_STD(istream)& sourceStream, bool escape)
Used by derived classes to initialize the previous processing stream. Throws no exceptions.
The parameter sourceStream is a handle to the previous processing stream.
RWEnhancedXmlObjectInputStreamImp(RW_SL_IO_STD(istream)& sourceStream, RW_SL_IO_STD(ios)*& formatter, bool escape)
Used by derived classes to initialize the previous processing stream. Throws no exceptions.
The parameter sourceStream is a handle to the previous processing stream
The parameter formatter will be returned with a reference to the formatting object
RWEnhancedXmlObjectInputStreamImp(const RWDataInputStream&
sourceStream, bool escape)
Used by derived classes to initialize the previous processing stream. Throws no exceptions.
The parameter sourceStream is a handle to the previous processing stream.
~RWEnhancedXmlObjectInputStreamImp()
Destructor. Make sure the storeTable is deleted even if an exception is thrown.
static RWObjectInputStream make(RW_SL_IO_STD(istream)& source, bool escape = true);
Used by derived classes to initialize the previous processing stream. Constructs an RWEnhancedXMLObjectInputStreamImp instance that uses the data stream source as its source of bytes, and returns a handle to it. Throws no exceptions.
Use this method when the data input stream is a standard library std::istream.
The parameter source is the istream that is used as source of bytes.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Escape is set to true if the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML. Defaults to true.
The reserved characters are:
< > & " '
You get slightly better performance if the escape parameter is set to false, but before doing so be certain that your data does not contain reserved characters.
static RWObjectInputStream make(RW_SL_IO_STD(istream)& source, RW_SL_IO_STD(ios)*& formatter, bool escape = true);
This function is the same as the first one described 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 RWObjectInputStream xistr = RWEnhancedXMLObjectInputStreamImp::make(infile,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
The parameter source is the istream that is used as source of bytes.
The parameter formatter will be returned with a reference to the formatting object.
static RWObjectInputStream
make(RWDataInputStream& source, bool escape = true);
Constructs an RWEnhancedXmlObjectInputStreamImp instance that uses source as its source of bytes, and returns a handle to it. Throws no exceptions.
The parameter source is the data stream that is used as source of bytes.
virtual void getChar(char& value); virtual void getCharacter(char& value); virtual void getDouble(double& value); virtual void getFloat(float& value); virtual void getInt(int& value); virtual void getLong(long& value); virtual void getLongDouble(long double& value); virtual void getLongLong(rwlonglong& value); virtual void getShort(short& value); virtual void getSizeT(size_t& value); virtual void getString(RWCString& str); virtual void getUCharacter(RWUChar& value); virtual void getUnsignedChar(unsigned char& value); virtual void getUnsignedInt(unsigned int& value); virtual void getUnsignedLong(unsigned long& value); virtual void getUnsignedLongLong(rwulonglong& value); virtual void getUnsignedShort(unsigned short& value); virtual void getUString(RWBasicUString& str); virtual void getWCharacter(wchar_t& value); virtual void getWchar_t(wchar_t& value); virtual void getWString(RWWString& str);
Reads a value from the stream, where the type of the value is defined by the first parameter. These functions are redefined from the parent class RWObjectInputStreamImp.
© 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.