SourcePro® 2021.1 |
SourcePro® API Reference Guide |
Product Documentation: SourcePro Documentation Home |
Implements a buffered char
or byte
input character stream that includes a transformation.
More...
#include <rw/xmlstreams/RWTTransformInputStreamImp.h>
Inherits FilteredInputStreamImp.
Public Types | |
typedef InputStream::element_type | element_type |
Public Member Functions | |
virtual | ~RWTTransformInputStreamImp () |
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) |
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 | |
RWTTransformInputStreamImp (const InputStream &sourceStream, Transform transform) | |
RWTTransformInputStreamImp (const InputStream &sourceStream, Transform transform, RWSize bufSize) | |
RWTTransformInputStreamImp (const InputStream &sourceStream, Transform transform, element_type *buffer, RWSize bufSize) | |
element_type * | eback () const |
element_type * | ebuf () const |
element_type * | egptr () const |
void | freeBuffer () |
void | gbump (RWSize n) |
element_type * | gptr () const |
void | setBufferEnd (element_type *gend_arg) |
void | setg (element_type *gbeg_arg, element_type *gcur_arg, element_type *gend_arg) |
bool | underflow () |
The class RWTTransformInputStreamImp implements a buffered char
or byte
input character stream that includes a transformation. 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.
RWTTransformInputStreamImp is a class template that is derived from one of its own template parameters.
The class is defined as
When the read() or readUntil() is first called on this class, the transform() method of the transformation object passed into the constructor gets called. The transform() method reads from the source, applies the transformation defined by the method, and stores the result in the buffer. Once the buffer contains the entire transformed document, the call to read() or readUntil() is completed by reading from the buffer.
typedef InputStream::element_type RWTTransformInputStreamImp< InputStream, FilteredInputStreamImp, Transform >::element_type |
In keeping with the pattern for all filtered input streams, the type of character contained by the stream is referred to as the "element_type"
. Characters in the stream are called "elements" (not to be confused with XML "elements").
|
virtual |
Virtual destructor. Throws no exceptions.
|
protected |
Initializes the reference to the input stream used as the source of elements, and the internal buffer, whose capacity is set equal to RW_STREAM_BUFFER_SIZE.
The parameter sourceStream represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
|
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 represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
The parameter bufSize represents the buffer capacity in number of elements.
|
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 represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
The parameter buffer represents a pre-allocated buffer of size bufSize to be used internally by the constructed RWTTransformInputStreamImp object.
|
virtual |
Returns the number of elements that can be read from the stream without blocking. Throws no exceptions.
|
inlineprotected |
Returns a pointer to the first element in the input buffer array. Throws no exceptions.
|
inlineprotected |
Returns a pointer one position past the end of the input buffer array. Throws no exceptions.
|
inlineprotected |
Returns a pointer one position past the last element in the input sequence. Throws no exceptions.
|
protected |
Frees the memory allocated to the internal buffer, if necessary. Throws no exceptions.
|
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.
|
inlineprotected |
Returns a pointer to the current position in the buffered input sequence. Throws no exceptions.
|
virtual |
Returns true
if the stream is in a bad state, otherwise false
. Throws no exceptions.
|
virtual |
Returns true
if no character can be obtained from the input sequence, otherwise false
. Throws no exceptions.
|
virtual |
Returns true
if the stream is in fail state, otherwise false
. Throws no exceptions.
|
virtual |
Returns false
if the stream is in fail or bad state, otherwise true
. Throws no exceptions.
|
inlinestatic |
Constructs an RWTTransformInputStreamImp 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. The buffer grows as needed to contain the entire XML document.
The parameter sourceStream represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
|
inlinestatic |
Constructs an RWTTransformInputStreamImp 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 represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
The parameter bufSize represents the initial buffer capacity in number of elements.
|
inlinestatic |
Constructs an RWTTransformInputStreamImp 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's array of size bufSize. The buffer grows as needed to contain the entire XML document.
The parameter sourceStream represents the input stream that serves as the source of elements.
The parameter transform represents the transformation object and must provide a public interface of:
The parameter buffer represents a pre-allocated buffer of size bufSize to be used internally by the constructed RWTTransformInputStreamImp object.
|
virtual |
Reads a single element from the input stream.
|
virtual |
Reads an array of elements from the input stream. Returns the actual number of elements read.
The parameter array represents a pointer to the beginning of the element array used to store the input. The array must have been pre-allocated to contain at least num elements. The parameter num represents the number of elements to be read from the stream.
|
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 represents a pointer to the beginning of the element array holding the elements extracted from the stream.
The parameter maxSize represents the maximum number of elements to be read.
The parameter delim represents the element value used as the delimiter.
|
inlineprotected |
Sets the buffer's end pointer. Assigns the parameter value bufEnd_
. Throws no exceptions.
|
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.
|
protected |
Fills the input buffer. Returns true
if there are elements available, otherwise false
.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |