SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits > Class Template Reference

Implements a buffer that can be used with any kind of output stream. More...

#include <rw/xmlstreams/RWTParsedTransformOutputStreamImp.h>

Inherits FilteredOutputStreamImp.

Public Types

typedef OutputStream::element_type element_type
 
typedef OutputStream RWOutputStream_type
 
typedef RWCString string_type
 

Public Member Functions

virtual ~RWTParsedTransformOutputStreamImp ()
 
virtual void close ()
 
virtual void flush ()
 
virtual void write (element_type value)
 
virtual void write (const element_type *array, RWSize numElements)
 

Static Public Member Functions

static OutputStream make (const OutputStream &sinkStream, Transform transform)
 
static OutputStream make (const OutputStream &sinkStream, Transform transform, RWSize bufSize)
 
static OutputStream make (const OutputStream &sinkStream, Transform transform, element_type *buffer, RWSize bufSize)
 

Protected Member Functions

 RWTParsedTransformOutputStreamImp (const OutputStream &sinkStream, Transform transform)
 
 RWTParsedTransformOutputStreamImp (const OutputStream &sinkStream, Transform transform, RWSize bufSize)
 
 RWTParsedTransformOutputStreamImp (const OutputStream &sinkStream, Transform transform, element_type *buffer, RWSize bufSize)
 
element_typeepptr () const
 
void freeBuffer ()
 
element_typepbase () const
 
void pbump (RWSize n)
 
element_typepptr () const
 
element_typereadAttribute (element_type *ptr, string_type &token)
 
element_typereadAttributes (element_type *ptr, RWXmlStreamElement &element)
 
element_typereadAttributeValue (element_type *ptr, string_type &token)
 
RWXmlStreamElementreadNextElement (element_type *ptr, element_type *&next, const RWXmlStreamElement &parent)
 
element_typereadToClose (element_type *ptr, string_type &token)
 
element_typereadToken (element_type *ptr, string_type &token)
 
element_typereadValue (element_type *ptr, RWXmlStreamElement &element)
 
element_typereadWholeName (element_type *ptr, string_type &token)
 
void setBuffer (RWSize bufsize)
 
void setp (element_type *pbeg_arg, element_type *pend_arg)
 

Detailed Description

template<class OutputStream, class FilteredOutputStreamImp, class Transform, class Traits>
class RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >

The class RWTParsedTransformOutputStreamImp implements a buffer that can be used with any kind of output stream. The size of the buffer is specified as a parameter to the static make() function that is used to create it. If the buffer as initialized is not large enough to contain the entire XML document, it grows as needed to be able to do so. It is more efficient, though, to allocate a buffer of sufficient size initially.

RWTParsedTransformOutputStreamImp is a class template that is derived from one of its own template parameters.

The class is defined as

template <class OutputStream, class FilteredOutputStreamImp,
class Transform, class Traits>
public FilteredOutputStreamImp { ...}

Member Typedef Documentation

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
typedef OutputStream::element_type RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::element_type

A typedef for the type of element to be written to RWOutputStream_type.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
typedef OutputStream RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::RWOutputStream_type

A typedef for the template parameter OutputStream which will be used as the sink for elements.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
typedef RWCString RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::string_type

A typedef for a string of elements.

Constructor & Destructor Documentation

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
virtual RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::~RWTParsedTransformOutputStreamImp ( )
virtual

Virtual destructor. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::RWTParsedTransformOutputStreamImp ( const OutputStream &  sinkStream,
Transform  transform 
)
protected

Initializes the reference to the output stream used as the sink of elements, as well as the internal buffer, whose capacity is set to RW_STREAM_BUFFER_SIZE, defined as 512 bytes.

The parameter sinkStream is the output stream that serves as the sink of elements.

The parameter transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::RWTParsedTransformOutputStreamImp ( const OutputStream &  sinkStream,
Transform  transform,
RWSize  bufSize 
)
protected

Initializes the reference to the output stream used as the sink of elements, and the internal buffer capacity, which is set to bufSize.

sinkStream is the output stream that serves as the sink of elements.

transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

bufSize the buffer capacity in number of elements

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::RWTParsedTransformOutputStreamImp ( const OutputStream &  sinkStream,
Transform  transform,
element_type buffer,
RWSize  bufSize 
)
protected

Initializes the reference to the output stream used as the sink of elements, and the internal buffer, which is initialized using a pre-allocated element's array of size bufSize.

The parameter sinkStream is the output stream that serves as the sink of elements.

The parameter transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

The parameter buffer a pre-allocated buffer of size bufSize to be used internally by the constructed RWTParsedTransformOutputStreamImp object

The parameter bufSize is the buffer capacity in number of elements.

Member Function Documentation

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
virtual void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::close ( )
virtual

Calls flush() and then calls close() on the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::epptr ( ) const
inlineprotected

Returns a pointer one position past the last element in the output sequence. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
virtual void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::flush ( )
virtual

Flushes the buffer by forwarding its content to the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::freeBuffer ( )
protected

Frees the memory allocated to the internal buffer, if necessary. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
static OutputStream RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::make ( const OutputStream &  sinkStream,
Transform  transform 
)
inlinestatic

Constructs an RWTParsedTransformOutputStreamImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is initialized to be of size RW_STREAM_BUFFER_SIZE, which is defined as 512 bytes. The buffer grows as needed to contain the entire XML document.

The parameter sinkStream is the output stream that serves as the sink of elements.

The parameter transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
static OutputStream RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::make ( const OutputStream &  sinkStream,
Transform  transform,
RWSize  bufSize 
)
inlinestatic

Constructs an RWTParsedTransformOutputStreamImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is initialized to be of size bufSize. The buffer grows as needed to contain the entire XML document.

The parameter sinkStream is the output stream that serves as the sink of elements.

The parameter transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

The parameter bufSize the buffer capacity in number of elements

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
static OutputStream RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::make ( const OutputStream &  sinkStream,
Transform  transform,
element_type buffer,
RWSize  bufSize 
)
inlinestatic

Constructs an RWTParsedTransformOutputStreamImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is initialized using a pre-allocated element's array of size bufSize. The buffer grows as needed to contain the entire XML document.

The parameter sinkStream is the output stream that serves as the sink of elements.

The parameter transform is the transformation object and must provide a public interface of transform(RWXmlStreamElement&).

The parameter buffer is a pre-allocated buffer of size bufSize to be used internally by the constructed RWTParsedTransformOutputStreamImp object.

The parameter bufSize is the buffer capacity in number of elements

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::pbase ( ) const
inlineprotected

Returns a pointer to the first element in the buffer. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::pbump ( RWSize  n)
inlineprotected

Moves the output buffer array pointer n positions forward. The array position now pointed to is the one returned by pptr(). Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::pptr ( ) const
inlineprotected

Returns a pointer to the current position in the buffer. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readAttribute ( element_type ptr,
string_type token 
)
protected

Reads the entire attribute (name and value). The parameter ptr points to the current read position. The parameter token contains the attribute string, or RWCString() if no attribute is available. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readAttributes ( element_type ptr,
RWXmlStreamElement element 
)
protected

Reads all the attributes in an element. The parameter ptr points to the current read position. The parameter element will have the attributes added to it. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readAttributeValue ( element_type ptr,
string_type token 
)
protected

Reads an attribute value. The parameter ptr points to the current read position. The parameter token contains the without quotes, or RWCString() if no value is available. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
RWXmlStreamElement* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readNextElement ( element_type ptr,
element_type *&  next,
const RWXmlStreamElement parent 
)
protected

Reads the next XML element. The parameter ptr points to the current read position. The parameter next contains the subsequent read position. The parameter parent holds the current element (the parent of the one to read). Returns the parsed element.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readToClose ( element_type ptr,
string_type token 
)
protected

Reads past the closing tag of the current element. The parameter ptr points to the current read position. The parameter token contains any data read before the closing tag. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readToken ( element_type ptr,
string_type token 
)
protected

Reads a token. The parameter ptr points to the current read position. The parameter token is returned with the token. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readValue ( element_type ptr,
RWXmlStreamElement element 
)
protected

Reads all values in an element. The parameter ptr points to the current read position. The parameter element will have the value added to it, including the nested elements. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::readWholeName ( element_type ptr,
string_type token 
)
protected

Reads everything to the next > character. The parameter ptr points to the current read position. The parameter token contains any data read before the > character. Returns the subsequent read position.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::setBuffer ( RWSize  bufsize)
protected

Sets the buffer size to bufsize elements.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::setp ( element_type pbeg_arg,
element_type pend_arg 
)
inlineprotected

Sets the buffer's pointers. Assigns the first parameter value to pbeg_ and pnext_, and the second parameter value to pend_. These data members represent the beginning of the buffer array, the current position in the array, and the end of the array.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
virtual void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::write ( element_type  value)
virtual

Writes a single element to the stream. The parameter value is the element to be written to the stream.

template<class OutputStream , class FilteredOutputStreamImp , class Transform , class Traits >
virtual void RWTParsedTransformOutputStreamImp< OutputStream, FilteredOutputStreamImp, Transform, Traits >::write ( const element_type array,
RWSize  numElements 
)
virtual

Writes a character array of size numElements to the stream. The parameter array is a pointer to the first element in the array.

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