rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits > Class Template Reference
[XML Streams]

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

#include <rw/xmlstreams/RWTParsedTransformInputStreamImp.h>

List of all members.

Public Types

typedef InputStream RWInputStream_type
typedef InputStream::element_type element_type
typedef RWCString string_type

Public Member Functions

virtual ~RWTParsedTransformInputStreamImp ()
virtual bool isEof () const
virtual bool isBad () const
virtual bool isFail () const
virtual bool isGood () const
virtual element_type read ()
virtual RWSize read (element_type *array, RWSize num)
virtual RWSize readUntil (element_type *array, RWSize maxSize, element_type delim)
virtual RWSize available () const
virtual RWSize skip (RWSize numUnits)

Static Public Member Functions

static InputStream make (const InputStream &sourceStream, Transform transform)
static InputStream make (const InputStream &sourceStream, Transform transform, RWSize bufSize)
static InputStream make (const InputStream &sourceStream, Transform transform, element_type *buffer, RWSize bufSize)

Protected Member Functions

 RWTParsedTransformInputStreamImp (const InputStream &sourceStream, Transform transform)
 RWTParsedTransformInputStreamImp (const InputStream &sourceStream, Transform transform, RWSize bufSize)
 RWTParsedTransformInputStreamImp (const InputStream &sourceStream, Transform transform, element_type *buffer, RWSize bufSize)
element_typeeback () const
element_typegptr () const
element_typeegptr () const
element_typeebuf () const
void setg (element_type *gbeg_arg, element_type *gcur_arg, element_type *gend_arg)
void setBufferEnd (element_type *gend_arg)
void gbump (RWSize n)
void freeBuffer ()
bool underflow ()
void transform ()
element_type readOne ()
void putBack (element_type cur)
RWXmlStreamElement readNextElement (element_type &cur, const RWXmlStreamElement &parent)
element_type readToken (element_type cur, string_type &token)
element_type readToClose (element_type cur, string_type &token)
element_type readWholeName (element_type cur, string_type &token)
element_type readAttribute (element_type cur, string_type &token)
element_type readAttributeValue (element_type cur, string_type &token)
element_type readAttributes (element_type cur, RWXmlStreamElement &element)
element_type readValue (element_type cur, RWXmlStreamElement &element)

Detailed Description

template<class InputStream, class FilteredInputStreamImp, class Transform, class Traits>
class RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >

The class RWTParsedTransformInputStreamImp implements a buffer that can be used with any kind of input 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.

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

The class is defined as

 template <class InputStream, class FilteredInputStreamImp,
           class Transform, class Traits>

 class RWTParsedTransformInputStreamImp :
   public FilteredInputStreamImp { ... };

Member Typedef Documentation

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
typedef InputStream::element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::element_type

A typedef for the type of element to be read from RWInputStream_type.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
typedef InputStream RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::RWInputStream_type

A typedef for the template parameter InputStream which will be used as the source of elements.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
typedef RWCString RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::string_type

A typedef for a string of elements.


Constructor & Destructor Documentation

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::~RWTParsedTransformInputStreamImp (  )  [virtual]

Virtual destructor. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::RWTParsedTransformInputStreamImp ( const InputStream &  sourceStream,
Transform  transform 
) [protected]

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

The parameter sourceStream is the input stream that serves as the source of elements.

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::RWTParsedTransformInputStreamImp ( const InputStream &  sourceStream,
Transform  transform,
RWSize  bufSize 
) [protected]

Initializes the reference to the input stream used as the source of elements, and the internal buffer, whose capacity is set to bufSize.

The parameter sourceStream is the input stream that serves as the source of elements.

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

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::RWTParsedTransformInputStreamImp ( const InputStream &  sourceStream,
Transform  transform,
element_type buffer,
RWSize  bufSize 
) [protected]

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

The parameter sourceStream is the input stream that serves as the source 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 RWTParsedTransformInputStreamImp object.

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


Member Function Documentation

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual RWSize RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::available (  )  const [virtual]

Returns the number of characters that can be read from the stream without blocking. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::eback (  )  const [inline, protected]

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::ebuf (  )  const [inline, protected]

Returns a pointer one position past the end of the input buffer array. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::egptr (  )  const [inline, protected]

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::freeBuffer (  )  [protected]

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::gbump ( RWSize  n  )  [inline, protected]

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type* RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::gptr (  )  const [inline, protected]

Returns a pointer to the current position in the buffered input sequence. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual bool RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::isBad (  )  const [virtual]

Returns true if the input stream is in bad state, otherwise false. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual bool RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::isEof (  )  const [virtual]

Returns true if no character can be obtained from the input sequence, otherwise false. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual bool RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::isFail (  )  const [virtual]

Returns true if the input stream is in fail state, otherwise false. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual bool RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::isGood (  )  const [virtual]

Returns false if the input stream is in fail or bad state, otherwise true. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
static InputStream RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::make ( const InputStream &  sourceStream,
Transform  transform,
element_type buffer,
RWSize  bufSize 
) [inline, static]

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

The parameter sourceStream is the input stream that serves as the source 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 RWTParsedTransformInputStreamImp object.

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
static InputStream RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::make ( const InputStream &  sourceStream,
Transform  transform,
RWSize  bufSize 
) [inline, static]

Constructs an RWTParsedTransformInputStreamImp instance that uses sourceStream as its source 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 sourceStream is the input stream that serves as the source of elements.

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

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
static InputStream RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::make ( const InputStream &  sourceStream,
Transform  transform 
) [inline, static]

Constructs an RWTParsedTransformInputStreamImp instance that uses sourceStream as its source 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 sourceStream is the input stream that serves as the source of elements.

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

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::putBack ( element_type  cur  )  [protected]

Puts back one element, so it will be available for the next read. The parameter cur is the element to be put back.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual RWSize RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::read ( element_type array,
RWSize  num 
) [virtual]

Reads an array of elements from the input stream. Returns the actual number of elements read.

The parameter array is a pointer to the beginning of the array used to store the input. The array must have been pre-allocated to contain at least num elements.

The parameter num is the number of elements to be read from the stream

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::read (  )  [virtual]

Reads a single element from the input stream.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readAttribute ( element_type  cur,
string_type token 
) [protected]

Reads in an entire attribute (name and value). The parameter cur holds the current character. The parameter token will contain the attribute string, or RWCString() if no attribute is available. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readAttributes ( element_type  cur,
RWXmlStreamElement element 
) [protected]

Reads all attributes in an element. The parameter cur holds the current character. The parameter element will have the attributes added to it. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readAttributeValue ( element_type  cur,
string_type token 
) [protected]

Reads in an attribute value. The parameter cur holds the current character. The parameter token will contain the value without quotes, or RWCString() if no value is available. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
RWXmlStreamElement RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readNextElement ( element_type cur,
const RWXmlStreamElement parent 
) [protected]

Reads the next XML element. The parameter cur holds the current character. The parameter parent holds the current element (the parent of the one to read). Returns the parsed element.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readOne (  )  [protected]

Reads one character from the input and returns the next character.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readToClose ( element_type  cur,
string_type token 
) [protected]

Reads past the closing tag of the current element. The parameter cur holds the current character. The parameter token will contain any data read before the closing tag. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readToken ( element_type  cur,
string_type token 
) [protected]

Reads a token. The parameter cur holds the current character. The parameter token will be returned with the token. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual RWSize RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readUntil ( element_type array,
RWSize  maxSize,
element_type  delim 
) [virtual]

Reads elements until the last element read is equivalent to delim, maxSize elements have been read, or the end of the input sequence is reached. The elements read are stored in array. The function returns the actual number of elements read from the stream.

The parameter array is a pointer to the beginning of the element array holding the elements extracted from the stream.

The parameter maxSize is the maximum number of elements to be read.

The parameter delim is the element value used as the delimiter.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readValue ( element_type  cur,
RWXmlStreamElement element 
) [protected]

Reads all values in an element. The parameter cur holds the current character. The parameter element will have the values added to it, including nested elements. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::readWholeName ( element_type  cur,
string_type token 
) [protected]

Reads everything to the next > character. The parameter cur holds the current character. The parameter token will contain any data read before the > character. Returns the last character read.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::setBufferEnd ( element_type gend_arg  )  [inline, protected]

Sets the buffer's end pointer. Assigns the parameter value to gend_. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::setg ( element_type gbeg_arg,
element_type gcur_arg,
element_type gend_arg 
) [inline, protected]

Assigns the parameter values to gbeg_, gnext_, and gend_ respectively. These data members represent the beginning of the buffer array, the current position in the array, and the end of the array. Throws no exceptions.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
virtual RWSize RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::skip ( RWSize  numUnits  )  [virtual]

Skips numUnits elements from the input sequence if possible. The function returns the actual number of elements skipped, which can be any value between 0 and numUnits.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::transform (  )  [protected]

Parses the XML input and applies the transformation.

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
bool RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::underflow (  )  [protected]

Fills the input buffer. Throws no exceptions.

Returns true if there are elements available, otherwise false.

 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.