Module: XML Streams Package: XML Streams
RWTParsedTransformOutputStreamImp FilteredOutputStreamImp
#include <rw/xmlstreams/RWTParsedTransformOutputStreamImp.h>
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> class RWTParsedTransformOutputStreamImp :
public FilteredOutputStreamImp { ...}
typedef OutputStream RWOutputStream_type; typedef typename OutputStream::element_type element_type; typedef RWCString string_type;
static OutputStream make(const OutputStream& sinkStream, Transform transform);
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&).
static OutputStream make(const OutputStream& sinkStream, Transform transform, RWSize bufSize);
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
static OutputStream make(const OutputStream& sinkStream, Transform transform, element_type* buffer, RWSize bufSize);
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
virtual ~RWTParsedTransformOutputStreamImp();
Virtual destructor. Throws no exceptions.
virtual void write(element_type value);
Writes a single element to the stream. The parameter value is the element to be written to the stream.
virtual void write(const element_type* array, RWSize numElements);
Writes a character array of size numElements to the stream. The parameter array is a pointer to the first element in the array.
virtual void close();
Calls flush() and then calls close() on the next processing stream.
virtual void flush();
Flushes the buffer by forwarding its content to the next processing stream.
RWTParsedTransformOutputStreamImp(const OutputStream& sinkStream, Transform transform);
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&).
RWTParsedTransformOutputStreamImp(const OutputStream& sinkStream, Transform transform, RWSize bufSize);
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
RWTParsedTransformOutputStreamImp(const OutputStream& sinkStream, Transform transform, element_type* buffer, RWSize bufSize);
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.
element_type* epptr() const;
Returns a pointer one position past the last element in the output sequence. Throws no exceptions.
void freeBuffer();
Frees the memory allocated to the internal buffer, if necessary. Throws no exceptions.
element_type* pbase() const;
Returns a pointer to the first element in the buffer. Throws no exceptions.
void pbump(RWSize n);
Moves the output buffer array pointer n positions forward. The array position now pointed to is the one returned by pptr(). Throws no exceptions.
element_type* pptr() const;
Returns a pointer to the current position in the buffer. Throws no exceptions.
element_type* readAttribute(element_type* ptr, string_type& token);
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.
element_type* readAttributes(element_type* ptr, string_type& element);
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.
element_type* readAttributeValue(element_type* ptr, string_type& token);
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.
RWXmlStreamElement readNextElement(element_type* ptr, element_type*& next,
const RWXmlStreamElement& parent);
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.
element_type* readToClose(element_type* ptr, string_type& token);
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.
element_type* readToken(element_type* ptr, string_type& token);
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.
element_type* readValue(element_type* ptr,
RWXmlStreamElement& element);
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.
element_type* readWholeName(element_type* ptr, string_type& token);
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.
void setBuffer(RWSize bufsize);
Sets the buffer size to bufsize elements.
void setp(element_type* pbeg_arg, element_type* pend_arg);
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.
© 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.