SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Reads and restores objects encoded in XML from the supplied RWDataInputStream. More...
#include <rw/xmlstreams/RWXmlObjectInputStreamImp.h>
Public Member Functions | |
void | getSymbol (RWSymbol &value) |
virtual RWSymbol | startBlock () |
virtual void | endBlock () |
virtual void * | getNewObject (const std::type_info *base) |
virtual RWSymbol | readTypeInfo () |
virtual void | rememberObject (const void *obj) |
virtual bool | startMember (RWSymbol &memberName, RWStreamType &memberType) |
virtual void | endMember () |
virtual RWSymbol | startSequence (int &count, RWStreamType &elementType) |
virtual void | startElement (int &position) |
virtual void | endElement () |
virtual void | endSequence () |
virtual RWSymbol | startMap (int &count, RWStreamType &keyType, RWStreamType &valueType) |
virtual void | startAssocKey () |
virtual void | startAssocValue () |
virtual void | endAssoc () |
virtual void | endMap () |
virtual void | getString (RWCString &str) |
virtual void | getWString (RWWString &str) |
virtual void | getUString (RWBasicUString &str) |
virtual void | getBool (bool &value) |
virtual void | getChar (char &value) |
virtual void | getUnsignedChar (unsigned char &value) |
virtual void | getSignedChar (signed char &value) |
virtual void | getShort (short &value) |
virtual void | getUnsignedShort (unsigned short &value) |
virtual void | getInt (int &value) |
virtual void | getUnsignedInt (unsigned int &value) |
virtual void | getLong (long &value) |
virtual void | getUnsignedLong (unsigned long &value) |
virtual void | getFloat (float &value) |
virtual void | getDouble (double &value) |
virtual void | getWchar_t (wchar_t &value) |
virtual void | getLongLong (long long &value) |
virtual void | getUnsignedLongLong (unsigned long long &value) |
virtual void | getLongDouble (long double &value) |
virtual void | getCharacter (char &value) |
virtual void | getWCharacter (wchar_t &value) |
virtual void | getUCharacter (RWUChar &value) |
virtual void | getSizeT (size_t &value) |
Static Public Member Functions | |
static RWObjectInputStream | make (std::istream &source, bool escape=true) |
static RWObjectInputStream | make (std::istream &source, std::ios *&formatter, bool escape=true) |
static RWObjectInputStream | make (RWDataInputStream &source, bool escape=true) |
Protected Member Functions | |
virtual void | openOuterContext (bool readContext) |
virtual void | closeOuterContext (bool readContext) |
RWXmlObjectInputStreamImp (std::istream &sourceStream, bool escape) | |
RWXmlObjectInputStreamImp (std::istream &sourceStream, std::ios *&formatter, bool escape) | |
RWXmlObjectInputStreamImp (const RWDataInputStream &sourceStream, bool escape) | |
virtual RWSize | getString (char *string, RWSize count) |
virtual RWSize | getWString (wchar_t *wstring, RWSize count) |
virtual RWSize | getUString (RWUChar *ustring, RWSize count) |
The class RWXmlObjectInputStreamImp reads and restores objects encoded in XML from the supplied RWDataInputStream. Typically, the XML stream was originally created by the class RWXmlObjectOutputStreamImp, thereby ensuring symmetry of the output and subsequent input.
The XML Streams Module integrates with the general Rogue Wave streams architecture defined by the streams and serialization packages of the Advanced Tools Module of SourcePro Core. This architecture allows an XML stream to be written out and read in using a wide variety of streaming configurations. For more information specific to the XML Streams Module, see the XML Streams Module User's Guide. For information on the general architecture, see the Advanced Tools Module User's Guide.
RWXmlObjectInputStreamImp is the body class of a handle-body pattern. The corresponding handle class is RWObjectInputStream.
The syntax of the XML formatting parsed by this class is defined by the XML schema xmlstreams.xsd
. This schema is located in buildspace\rw\xmlstreams
.
// Open an fstream to serve as our source. ifstream s("foo.xml"); // Create an XML data stream using the fstream. RWObjectInputStream in = RWXmlObjectInputStreamImp::make(s); // Read an integer from the XML data stream. int i; s >> i;
RWXmlObjectInputStreamImp::RWXmlObjectInputStreamImp | ( | std::istream & | sourceStream, | |
bool | escape | |||
) | [inline, protected] |
Used by the make() function and potentially by derived classes to initialize the source data stream if the required input stream is a standard library istream.
The parameter sourceStream is a handle to the initialized stream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML.
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.
RWXmlObjectInputStreamImp::RWXmlObjectInputStreamImp | ( | std::istream & | sourceStream, | |
std::ios *& | formatter, | |||
bool | escape | |||
) | [inline, protected] |
Used by the make() function and potentially by derived classes to initialize the source data stream if the required input stream is a standard library istream.
The parameter sourceStream is a handle to the initialized stream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML.
The reserved characters are:
< > & " '
false
, but before doing so be certain that your data does not contain reserved characters.
This constructor also takes a pointer reference to an std::ios
formatting object.
Before the XML stream is created, pass an empty formatting object pointer to this constructor through the make() function. This constructor, in defining 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. See the corresponding make() function description for an example.
RWXmlObjectInputStreamImp::RWXmlObjectInputStreamImp | ( | const RWDataInputStream & | sourceStream, | |
bool | escape | |||
) | [inline, protected] |
Used by the make() function and potentially by derived classes to initialize the source data stream if the required input stream is a RWDataInputStream istream.
The parameter sourceStream is a handle to the initialized stream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML.
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.
virtual void RWXmlObjectInputStreamImp::closeOuterContext | ( | bool | readContext | ) | [protected, virtual] |
Really closes an open context, called when closeContext() calls match the number of openContext() calls.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endAssoc | ( | ) | [virtual] |
Called by the input operators for association types after each value.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endBlock | ( | ) | [virtual] |
Causes tokens to be input that identify the end of an object.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endElement | ( | ) | [virtual] |
Called by the input operators for collection types after each element in a sequence.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endMap | ( | ) | [virtual] |
Called by the input operators for association types after all the pairs.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endMember | ( | ) | [virtual] |
Called by streamContents() after each data member is read.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::endSequence | ( | ) | [virtual] |
Called by the input operators for collection types at the end of a sequence.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getBool | ( | bool & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getChar | ( | char & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getCharacter | ( | char & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getDouble | ( | double & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getFloat | ( | float & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getInt | ( | int & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getLong | ( | long & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getLongDouble | ( | long double & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getLongLong | ( | long long & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void* RWXmlObjectInputStreamImp::getNewObject | ( | const std::type_info * | base | ) | [virtual] |
Reads the dynamic type information (derived class) from the input stream, and factories an instance of this type.
base | Represents the static type (base class) of the field being read. |
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getShort | ( | short & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getSignedChar | ( | signed char & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getSizeT | ( | size_t & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual RWSize RWXmlObjectInputStreamImp::getString | ( | char * | string, | |
RWSize | count | |||
) | [inline, protected, virtual] |
Forward the reading of a string of narrow characters from the attached source stream. The function returns the number of narrow characters read.
string | A pointer to the first element of the string. The string must have been pre-allocated to contain at least count narrow characters. | |
count | The number of narrow character(s) to be read from the stream. |
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getString | ( | RWCString & | str | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Implements RWObjectInputStreamImp.
void RWXmlObjectInputStreamImp::getSymbol | ( | RWSymbol & | value | ) | [virtual] |
Reads an RWSymbol value from the stream.
value | The RWSymbol value to be read from the stream |
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUCharacter | ( | RWUChar & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUnsignedChar | ( | unsigned char & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUnsignedInt | ( | unsigned int & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUnsignedLong | ( | unsigned long & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUnsignedLongLong | ( | unsigned long long & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUnsignedShort | ( | unsigned short & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual RWSize RWXmlObjectInputStreamImp::getUString | ( | RWUChar * | ustring, | |
RWSize | count | |||
) | [inline, protected, virtual] |
Forward the reading of a string of UTF-16 characters from the attached source stream. The function returns the number of UTF-16 characters read.
ustring | A pointer to the first element of the string. The string must have been pre-allocated to contain at least count unicode characters. | |
count | The number of unicode character(s) to be read from the stream. |
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getUString | ( | RWBasicUString & | str | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getWchar_t | ( | wchar_t & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getWCharacter | ( | wchar_t & | value | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Reimplemented from RWFilteredDataInputStreamImp.
virtual RWSize RWXmlObjectInputStreamImp::getWString | ( | wchar_t * | wstring, | |
RWSize | count | |||
) | [inline, protected, virtual] |
Forward the reading of a string of wide characters from the attached source stream. The function returns the number of wide characters read.
wstring | A pointer to the first element of the string. The string must have been pre-allocated to contain at least count wide characters. | |
count | The number of wide character(s) to be read from the stream. |
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::getWString | ( | RWWString & | str | ) | [virtual] |
Reads a value from the stream, where the type of the value is defined by the first parameter.
Implements RWObjectInputStreamImp.
static RWObjectInputStream RWXmlObjectInputStreamImp::make | ( | RWDataInputStream & | source, | |
bool | escape = true | |||
) | [static] |
Constructs an RWXmlObjectInputStreamImp instance that uses the data stream source as its source of bytes, and returns a handle to it. Use this method when the data input stream is a RWDataInputStream istream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML. By default, this parameter is set 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 RWXmlObjectInputStreamImp::make | ( | std::istream & | source, | |
std::ios *& | formatter, | |||
bool | escape = true | |||
) | [static] |
Constructs an RWXmlObjectInputStreamImp instance that uses the data stream source as its source of bytes, and returns a handle to it. Use this method when the data input stream is a standard library istream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML. By default, this parameter is set to true
.
The reserved characters are:
< > & " '
false
, but before doing so be certain that your data does not contain reserved characters.
This function 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 = RWXmlObjectInputStreamImp::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
static RWObjectInputStream RWXmlObjectInputStreamImp::make | ( | std::istream & | source, | |
bool | escape = true | |||
) | [static] |
Constructs an RWXmlObjectInputStreamImp instance that uses the data stream source as its source of bytes, and returns a handle to it. Use this method when the data input stream is a standard library istream.
The parameter escape sets whether the input stream contains escapes for XML reserved characters that need to be unescaped. Usually this would be because the objects serialized out with RWXmlObjectOutputStreamImp contained embedded XML. By default, this parameter is set 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.
virtual void RWXmlObjectInputStreamImp::openOuterContext | ( | bool | readContext | ) | [protected, virtual] |
Really opens a new context, called by openContext() when a context is not already open.
Implements RWObjectInputStreamImp.
virtual RWSymbol RWXmlObjectInputStreamImp::readTypeInfo | ( | ) | [virtual] |
Reads the type information for an class instance from the stream and returns it as a symbol.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::rememberObject | ( | const void * | obj | ) | [virtual] |
Called by streaming operators to record each instance streamed in, in case it is referenced again in the same context.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::startAssocKey | ( | ) | [virtual] |
Called by the input operators for association types before each key.
Reimplemented from RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::startAssocValue | ( | ) | [virtual] |
Called by the input operators for association types after each key and before each value.
Reimplemented from RWObjectInputStreamImp.
virtual RWSymbol RWXmlObjectInputStreamImp::startBlock | ( | ) | [virtual] |
Causes tokens to be input that identify the start of a new object. Returns an RWSymbol representing the new object. Depending on the implementation class associated with this handle the RWSymbol may be empty.
Implements RWObjectInputStreamImp.
virtual void RWXmlObjectInputStreamImp::startElement | ( | int & | ) | [virtual] |
Called by the input operators for collection types before each element in a sequence.
Reimplemented from RWObjectInputStreamImp.
virtual RWSymbol RWXmlObjectInputStreamImp::startMap | ( | int & | count, | |
RWStreamType & | keyType, | |||
RWStreamType & | valueType | |||
) | [virtual] |
Called by the input operators for association types (hash tables, etc.) at the start. Returns an RWSymbol representing the collection.
count | Contains the number of items in the association. | |
keyType | Contains the type of key in the association. | |
valueType | Contains the type of value in the association. |
Implements RWObjectInputStreamImp.
virtual bool RWXmlObjectInputStreamImp::startMember | ( | RWSymbol & | memberName, | |
RWStreamType & | memberType | |||
) | [virtual] |
Called for before each data member by the streamContents() function, metadata about the field may or may not be read from the stream depending on the implementation. If data is read (returning true
), then parameter memberName will contain the name of the member. Otherwise returns false
.
Implements RWObjectInputStreamImp.
virtual RWSymbol RWXmlObjectInputStreamImp::startSequence | ( | int & | count, | |
RWStreamType & | elementType | |||
) | [virtual] |
Called by the input operators for collection types at the start of a sequence. Returns an RWSymbol representing the collection.
count | Contains the number of items in the collection. | |
elementType | Contains the type of element in the collection. |
Implements 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.