SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Constructs an XML stream that applies a generic transformation to the XML document before writing it out to the sink. More...
#include <rw/xmlstreams/RWTTransformObjectOutputStreamImp.h>
Static Public Member Functions | |
static RWObjectOutputStream | make (std::ostream &sink, Transform transformer, const RWCString &rootElementType=nestedObjectTag, bool escape=true) |
static RWObjectOutputStream | make (std::ostream &sink, Transform transformer, std::ios *&formatter, const RWCString &rootElementType=nestedObjectTag, bool escape=true) |
Protected Member Functions | |
RWTTransformObjectOutputStreamImp (std::ostream &ostr, Transform transformer, const RWCString &rootElementType, bool escape) | |
RWTTransformObjectOutputStreamImp (std::ostream &ostr, Transform transformer, std::ios *&formatter, const RWCString &rootElementType, bool escape) |
This class uses RWXmlObjectOutputStreamImp and RWTTransformOutputStreamImp to construct an XML stream that applies a generic transformation to the XML document before writing it out to the sink.
// Create a strstream to serve as our sink ostrstream s; // Create a transformation object MyTransform t; // Create an XML data stream using the strstream RWObjectOutputStream out = RWTTransformObjectOutputStreamImp<MyTransform>::make(s,t); // Write integer value `1' to XML data stream out << 1;
RWTTransformObjectOutputStreamImp< Transform >::RWTTransformObjectOutputStreamImp | ( | std::ostream & | ostr, | |
Transform | transformer, | |||
const RWCString & | rootElementType, | |||
bool | escape | |||
) | [inline, protected] |
Used by the make() function and potentially by derived classes to initialize an output stream and to insert a transformation of the serialized object data based on the transformation object transformer.
The parameter ostr is a handle to the initialized stream.
The parameter transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).
The parameter rootElementType must be one of the following:
int
The value passed indicates the root element of the generated document.
The parameter escape sets whether to escape XML reserved characters in the data being serialized. By setting this parameter to true
, reserved characters in char
and string
values are escaped, allowing the data to include 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.
RWTTransformObjectOutputStreamImp< Transform >::RWTTransformObjectOutputStreamImp | ( | std::ostream & | ostr, | |
Transform | transformer, | |||
std::ios *& | formatter, | |||
const RWCString & | rootElementType, | |||
bool | escape | |||
) | [inline, protected] |
Used by the make() function and potentially by derived classes to initialize an output stream and to insert a transformation of the serialized object data based on the transformation object transformer.
The parameter ostr is a handle to the initialized stream.
The parameter transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).
The parameter rootElementType must be one of the following:
int
The parameter escape sets whether to escape XML reserved characters in the data being serialized. By setting this parameter to true
, reserved characters in char
and string
values are escaped, allowing the data to include 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. 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 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.
static RWObjectOutputStream RWTTransformObjectOutputStreamImp< Transform >::make | ( | std::ostream & | sink, | |
Transform | transformer, | |||
std::ios *& | formatter, | |||
const RWCString & | rootElementType = nestedObjectTag , |
|||
bool | escape = true | |||
) | [inline, static] |
Constructs an RWTTransformObjectOutputStreamImp instance and returns a handle to it. The constructed instance applies a generic transformation to the serialized object data and then passes the data to the output stream sink.
The parameter transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).
The parameter rootElementType must be one of the following:
int
The parameter escape sets whether to escape XML reserved characters in the data being serialized. By setting this parameter to true
, reserved characters in char
and string
values are escaped, allowing the data to include embedded XML.
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 RWObjectOutputStream xostr = RWTTransformObjectOutputStreamImp<MyTransform>
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 RWObjectOutputStream RWTTransformObjectOutputStreamImp< Transform >::make | ( | std::ostream & | sink, | |
Transform | transformer, | |||
const RWCString & | rootElementType = nestedObjectTag , |
|||
bool | escape = true | |||
) | [inline, static] |
Constructs an RWTTransformObjectOutputStreamImp instance and returns a handle to it. The constructed instance applies a generic transformation to the serialized object data and then passes the data to the output stream sink.
The parameter transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).
The parameter rootElementType must be one of the following:
int
The value passed indicates the root element of the generated document. The default setting is nestedObjectTag.
The parameter escape sets whether to escape XML reserved characters in the data being serialized. By setting this parameter to true
, reserved characters in char
and string
values are escaped, allowing the data to include 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.
© 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.