SourcePro® API Reference Guide

 
List of all members | Static Public Member Functions | Protected Member Functions
RWTTransformObjectOutputStreamImp< Transform > Class Template Reference

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>

Inheritance diagram for RWTTransformObjectOutputStreamImp< Transform >:
RWXmlObjectOutputStreamImp RWObjectOutputStreamImp RWXmlObjectStreamCommon RWFilteredDataOutputStreamImp RWDataOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

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)
 
- Static Public Member Functions inherited from RWXmlObjectOutputStreamImp
static RWObjectOutputStream make (std::ostream &sink, const RWCString &rootElementType=nestedObjectTag, bool escape=true)
 
static RWObjectOutputStream make (std::ostream &sink, std::ios *&formatter, const RWCString &rootElementType=nestedObjectTag, bool escape=true)
 
static RWObjectOutputStream make (RWDataOutputStream &sink, const RWCString &rootElementType=nestedObjectTag, bool escape=true)
 
- Static Public Member Functions inherited from RWXmlObjectStreamCommon
static const char * rwStreamToLocalStringType (RWStreamType stype)
 
static const char * rwStreamToStringType (RWStreamType stype)
 

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)
 
- Protected Member Functions inherited from RWXmlObjectOutputStreamImp
 RWXmlObjectOutputStreamImp (std::ostream &ostr, const RWCString &rootElementType, bool escape)
 
 RWXmlObjectOutputStreamImp (std::ostream &ostr, std::ios *&formatter, const RWCString &rootElementType, bool escape)
 
 RWXmlObjectOutputStreamImp (const RWDataOutputStream &ostr, const RWCString &rootElementType, bool escape)
 
virtual void closeOuterContext (bool writeContext)
 
virtual void openOuterContext (bool writeContext)
 
virtual void putString (const char *string, RWSize count)
 
virtual void putUString (const RWUChar *ustring, RWSize count)
 
virtual void putWString (const wchar_t *wstring, RWSize count)
 
- Protected Member Functions inherited from RWObjectOutputStreamImp
 RWObjectOutputStreamImp (const RWDataOutputStream &sinkStream)
 
int getContextNestingLevel ()
 
- Protected Member Functions inherited from RWFilteredDataOutputStreamImp
 RWFilteredDataOutputStreamImp (const RWDataOutputStream &sinkStream)
 
RWDataOutputStreamgetSinkStream ()
 
const RWDataOutputStreamgetSinkStream () const
 
- Protected Member Functions inherited from RWDataOutputStreamImp
 RWDataOutputStreamImp ()
 
- Protected Member Functions inherited from RWOutputStreamImp
 RWOutputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Additional Inherited Members

- Public Member Functions inherited from RWXmlObjectOutputStreamImp
virtual void endAssoc ()
 
virtual void endBlock ()
 
virtual void endElement ()
 
virtual void endMap ()
 
virtual void endMember (const RWSymbol &memberName)
 
virtual void endSequence ()
 
virtual bool needToWrite (const void *obj)
 
virtual void newObjectMarker ()
 
virtual void putBool (bool value)
 
virtual void putChar (char value)
 
virtual void putCharacter (char value)
 
virtual void putDouble (double value)
 
virtual void putFloat (float value)
 
virtual void putInt (int value)
 
virtual void putLong (long value)
 
virtual void putLongDouble (long double value)
 
virtual void putLongLong (long long value)
 
virtual void putShort (short value)
 
virtual void putSignedChar (signed char value)
 
virtual void putSizeT (size_t value)
 
virtual void putString (const RWCString &value)
 
virtual void putUCharacter (RWUChar value)
 
virtual void putUnsignedChar (unsigned char value)
 
virtual void putUnsignedInt (unsigned int value)
 
virtual void putUnsignedLong (unsigned long value)
 
virtual void putUnsignedLongLong (unsigned long long value)
 
virtual void putUnsignedShort (unsigned short value)
 
virtual void putUString (const RWBasicUString &value)
 
virtual void putWchar_t (wchar_t value)
 
virtual void putWCharacter (wchar_t value)
 
virtual void putWString (const RWWString &value)
 
virtual void rememberObject (const void *obj)
 
virtual void setNameForNextObject (const RWCString &str)
 
virtual void startAssocKey ()
 
virtual void startAssocValue ()
 
virtual void startBlock (const RWSymbol &)
 
virtual void startElement (int position)
 
virtual void startMap (int count, RWStreamType keyType, RWStreamType valueType, const RWSymbol &)
 
virtual void startSequence (int count, RWStreamType elementType, const RWSymbol &)
 
virtual void writeMemberInfo (const RWSymbol &memberName, RWStreamType memberType)
 
virtual void writeNullPtr ()
 
virtual void writeObjectName ()
 
virtual void writeTypeInfo (const RWSymbol &typeInfo)
 
- Public Member Functions inherited from RWObjectOutputStreamImp
virtual void closeContext (bool writeContext=true)
 
virtual void endParent ()
 
virtual void openContext (bool writeContext=true)
 
virtual void putSymbol (const RWSymbol &sym)
 
virtual void startParent (const RWSymbol &)
 
- Public Member Functions inherited from RWFilteredDataOutputStreamImp
virtual ~RWFilteredDataOutputStreamImp ()
 
virtual void close ()
 
virtual void flush ()
 
virtual bool isBad () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual void putBools (const bool *arrayPt, RWSize count)
 
virtual void putChars (const char *arrayPt, RWSize count)
 
virtual void putDoubles (const double *arrayPt, RWSize count)
 
virtual void putFloats (const float *arrayPt, RWSize count)
 
virtual void putInts (const int *arrayPt, RWSize count)
 
virtual void putLongDoubles (const long double *arrayPt, RWSize count)
 
virtual void putLongLongs (const long long *arrayPt, RWSize count)
 
virtual void putLongs (const long *arrayPt, RWSize count)
 
virtual void putShorts (const short *arrayPt, RWSize count)
 
virtual void putSignedChars (const signed char *arrayPt, RWSize count)
 
virtual void putUnsignedChars (const unsigned char *arrayPt, RWSize count)
 
virtual void putUnsignedInts (const unsigned int *arrayPt, RWSize count)
 
virtual void putUnsignedLongLongs (const unsigned long long *arrayPt, RWSize count)
 
virtual void putUnsignedLongs (const unsigned long *arrayPt, RWSize count)
 
virtual void putUnsignedShorts (const unsigned short *arrayPt, RWSize count)
 
virtual void putWchar_ts (const wchar_t *arrayPt, RWSize count)
 
- Public Member Functions inherited from RWDataOutputStreamImp
virtual ~RWDataOutputStreamImp ()
 
virtual RWDataOutputStream acquire ()
 
virtual void release ()
 
- Public Member Functions inherited from RWOutputStreamImp
virtual ~RWOutputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 
- Static Public Attributes inherited from RWXmlObjectStreamCommon
static const char * associationTag
 
static const char * assocKeyTag
 
static const char * assocValueTag
 
static const char * elementPosAttr
 
static const char * IdAttr
 
static const char * IdRefAttr
 
static const char * mapCountAttr
 
static const char * mapKeyTypeAttr
 
static const char * mapTag
 
static const char * mapValueTypeAttr
 
static const char * memberNameAttr
 
static const char * memberTag
 
static const char * memberTypeAttr
 
static const char * nestedObjectTag
 
static const char * objectNameAttr
 
static const char * objectRefTag
 
static const char * objectRefTagLocal
 
static const char * objectTag
 
static const char * objectTypeAttr
 
static const char * primitiveTag
 
static const char * rwEncodingNamespaceValue
 
static const char * rwNamespace
 
static const char * rwNamespaceAttr
 
static const char * rwNamespaceValue
 
static const char * seqCountAttr
 
static const char * seqTypeAttr
 
static const char * sequenceElementTag
 
static const char * sequenceTag
 
static const char * xsdNamespace
 
static const char * xsdNamespaceAttr
 
static const char * xsdNamespaceValue
 
static const char * xsiNamespace
 
static const char * xsiNamespaceAttr
 
static const char * xsiNamespaceValue
 
- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Attributes inherited from RWObjectOutputStreamImp
RWCString nameForNextObject_
 

Detailed Description

template<class Transform>
class RWTTransformObjectOutputStreamImp< Transform >

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.

Example
// Create a strstream to serve as our sink
ostrstream s;
// Create a transformation object
MyTransform t;
// Create an XML data stream using the strstream
// Write integer value `1' to XML data stream
out << 1;

Constructor & Destructor Documentation

template<class Transform >
RWTTransformObjectOutputStreamImp< Transform >::RWTTransformObjectOutputStreamImp ( std::ostream &  ostr,
Transform  transformer,
const RWCString rootElementType,
bool  escape 
)
inlineprotected

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:

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.

template<class Transform >
RWTTransformObjectOutputStreamImp< Transform >::RWTTransformObjectOutputStreamImp ( std::ostream &  ostr,
Transform  transformer,
std::ios *&  formatter,
const RWCString rootElementType,
bool  escape 
)
inlineprotected

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:

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.

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 RWObjectOutputStream RWTTransformObjectOutputStreamImp< Transform >::make ( std::ostream &  sink,
Transform  transformer,
const RWCString rootElementType = nestedObjectTag,
bool  escape = true 
)
inlinestatic

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:

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.

template<class Transform >
static RWObjectOutputStream RWTTransformObjectOutputStreamImp< Transform >::make ( std::ostream &  sink,
Transform  transformer,
std::ios *&  formatter,
const RWCString rootElementType = nestedObjectTag,
bool  escape = true 
)
inlinestatic

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:

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.

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

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

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.