rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTTransformObjectInputStreamImp< Transform > Class Template Reference
[XML Streams]

Constructs an XML input stream that applies a generic transformation to the XML document before reading it from the source. More...

#include <rw/xmlstreams/RWTTransformObjectInputStreamImp.h>

Inheritance diagram for RWTTransformObjectInputStreamImp< Transform >:
RWXmlObjectInputStreamImp RWObjectInputStreamImp RWXmlObjectStreamCommon RWFilteredDataInputStreamImp RWDataInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

List of all members.

Static Public Member Functions

static RWObjectInputStream make (std::istream &source, Transform transformer, bool escape=true)
static RWObjectInputStream make (std::istream &source, Transform transformer, std::ios *&formatter, bool escape=true)

Protected Member Functions

 RWTTransformObjectInputStreamImp (std::istream &istr, Transform transformer, bool escape)
 RWTTransformObjectInputStreamImp (std::istream &istr, Transform transformer, std::ios *&formatter, bool escape)

Detailed Description

template<class Transform>
class RWTTransformObjectInputStreamImp< Transform >

This class uses RWXmlObjectInputStreamImp and RWTTransformInputStreamImp to construct an XML input stream that applies a generic transformation to the XML document before reading it from the source.

Examples

 // Open an fstream to serve as our source
 ifstream s("foo.xml");
 
 // Create a transformation object, which must have a
 // transform(istream&,ostream&) interface
 MyTransform t;
 
 // Create an XML data stream using the fstream
 RWObjectInputStream in =
   RWTTransformObjectInputStreamImp<MyTransform>::make(s,t);
 
 // Read an integer from XML data stream.
 int i;
 in >> i;

Constructor & Destructor Documentation

template<class Transform >
RWTTransformObjectInputStreamImp< Transform >::RWTTransformObjectInputStreamImp ( std::istream &  istr,
Transform  transformer,
bool  escape 
) [inline, protected]

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 transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).

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.

template<class Transform >
RWTTransformObjectInputStreamImp< Transform >::RWTTransformObjectInputStreamImp ( std::istream &  istr,
Transform  transformer,
std::ios *&  formatter,
bool  escape 
) [inline, protected]

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 transformer is a transformation object that must supply a public interface function transform(istream&,ostream&).

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.

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.


Member Function Documentation

template<class Transform >
static RWObjectInputStream RWTTransformObjectInputStreamImp< Transform >::make ( std::istream &  source,
Transform  transformer,
std::ios *&  formatter,
bool  escape = true 
) [inline, static]

Constructs an RWTTransformObjectInputStreamImp instance that uses the data stream 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 transformer.

The parameter escape sets whether the primitive element values will be unescaped. By default, this parameter is set to true.

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 =
 RWTTransformObjectInputStreamImp<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 
template<class Transform >
static RWObjectInputStream RWTTransformObjectInputStreamImp< Transform >::make ( std::istream &  source,
Transform  transformer,
bool  escape = true 
) [inline, static]

Constructs an RWTTransformObjectInputStreamImp instance that uses the data stream 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 transformer.

The parameter escape sets whether the primitive element values will be unescaped. By default, this parameter is set to true.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.