SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits > Class Template Reference

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

#include <rw/xmlstreams/RWTParsedTransformInputStreamImp.h>

Inherits FilteredInputStreamImp.

Public Types

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

Public Member Functions

virtual ~RWTParsedTransformInputStreamImp ()
 
virtual RWSize available () const
 
virtual bool isBad () const
 
virtual bool isEof () 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 skip (RWSize numUnits)
 

Static Public Member Functions

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

Protected Member Functions

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

Friends

class RWBufferedCharInputStreamImp
 

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 {
// ...
};
Implements a buffer that can be used with any kind of input stream.
Definition RWTParsedTransformInputStreamImp.h:53

Member Typedef Documentation

◆ element_type

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.

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

◆ string_type

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

◆ ~RWTParsedTransformInputStreamImp()

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

Virtual destructor. Throws no exceptions.

◆ RWTParsedTransformInputStreamImp() [1/3]

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&).

◆ RWTParsedTransformInputStreamImp() [2/3]

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.

◆ RWTParsedTransformInputStreamImp() [3/3]

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

◆ available()

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.

◆ eback()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type * RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::eback ( ) const
inlineprotected

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

◆ ebuf()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type * RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::ebuf ( ) const
inlineprotected

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

◆ egptr()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type * RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::egptr ( ) const
inlineprotected

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

◆ freeBuffer()

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.

◆ gbump()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::gbump ( RWSize n)
inlineprotected

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

◆ gptr()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
element_type * RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::gptr ( ) const
inlineprotected

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

◆ isBad()

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.

◆ isEof()

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.

◆ isFail()

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.

◆ isGood()

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.

◆ make() [1/3]

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

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&).

◆ make() [2/3]

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 )
inlinestatic

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.

◆ make() [3/3]

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

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.

◆ putBack()

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.

◆ read() [1/2]

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.

◆ read() [2/2]

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

◆ readAttribute()

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 an empty string if no attribute is available. Returns the last character read.

◆ readAttributes()

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.

◆ readAttributeValue()

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 an empty string if no value is available. Returns the last character read.

◆ readNextElement()

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.

◆ readOne()

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.

◆ readToClose()

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.

◆ readToken()

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.

◆ readUntil()

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.

◆ readValue()

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.

◆ readWholeName()

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.

◆ setBufferEnd()

template<class InputStream , class FilteredInputStreamImp , class Transform , class Traits >
void RWTParsedTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform, Traits >::setBufferEnd ( element_type * gend_arg)
inlineprotected

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

◆ setg()

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 )
inlineprotected

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.

◆ skip()

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.

◆ transform()

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.

◆ underflow()

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.

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