PTLib  Version 2.10.4
PStringStream Class Reference

This class is a standard C++ stream class descendent for reading or writing streamed data to or from a PString class. More...

#include <pstring.h>

Inheritance diagram for PStringStream:
PString PCharArray PBaseArray< T > PAbstractArray PContainer PObject PHTML PServiceHTML

List of all members.

Public Member Functions

 PStringStream ()
 Create a new, empty, string stream.
 PStringStream (PINDEX fixedBufferSize)
 Create a new, empty, string stream of a fixed size.
 PStringStream (const PString &str)
 Create a new string stream and initialise it to the provided value.
 PStringStream (const char *cstr)
 Create a new string stream and initialise it with the provided value.
virtual PStringMakeEmpty ()
 Make the current string empty.
PStringStreamoperator= (const PStringStream &strm)
 Assign the string part of the stream to the current object.
PStringStreamoperator= (const PString &str)
 Assign the string to the current object.
PStringStreamoperator= (const char *cstr)
 Assign the C string to the string stream.
PStringStreamoperator= (char ch)
 Assign the character to the current object.
virtual ~PStringStream ()
 Destroy the string stream, deleting the stream buffer.

Protected Member Functions

virtual void AssignContents (const PContainer &cont)
 Copy the container contents.

Detailed Description

This class is a standard C++ stream class descendent for reading or writing streamed data to or from a PString class.

All of the standard stream I/O operators, manipulators etc will operate on the PStringStream class.


Constructor & Destructor Documentation

Create a new, empty, string stream.

Data may be output to this stream, but attempts to input from it will return end of file.

The internal string is continually grown as required during output.

PStringStream::PStringStream ( PINDEX  fixedBufferSize)

Create a new, empty, string stream of a fixed size.

Data may be output to this stream, but attempts to input from it will return end of file. When the fixed size is reached then no more data may be output to it.

Create a new string stream and initialise it to the provided value.

The string stream references the same string buffer as the str parameter until any output to the string stream is attempted. The reference is then broken and the instance of the string stream becomes a unique reference to a string buffer.

Parameters:
strInitial value for string stream.
PStringStream::PStringStream ( const char *  cstr)

Create a new string stream and initialise it with the provided value.

The stream may be read or written from. Writes will append to the end of the string.

Parameters:
cstrInitial value for the string stream.
virtual PStringStream::~PStringStream ( ) [virtual]

Destroy the string stream, deleting the stream buffer.


Member Function Documentation

virtual void PStringStream::AssignContents ( const PContainer c) [protected, virtual]

Copy the container contents.

This copies the contents from one reference to another.

No duplication of contents occurs, for instance if the container is an array, the pointer to the array memory is copied, not the array memory block itself.

This function will get called by the base assignment operator.

Reimplemented from PContainer.

Reimplemented in PHTML.

virtual PString& PStringStream::MakeEmpty ( ) [virtual]

Make the current string empty.

Reimplemented from PString.

PStringStream& PStringStream::operator= ( const PStringStream strm)

Assign the string part of the stream to the current object.

The current instance then becomes another reference to the same string in the strm parameter.

This will reset the read pointer for input to the beginning of the string. Also, any data output to the string up until the asasignement will be lost.

Returns:
reference to the current PStringStream object.
PStringStream& PStringStream::operator= ( const PString str)

Assign the string to the current object.

The current instance then becomes another reference to the same string in the str parameter.

This will reset the read pointer for input to the beginning of the string. Also, any data output to the string up until the asasignement will be lost.

Returns:
reference to the current PStringStream object.
Parameters:
strNew string to assign.

Reimplemented from PString.

Reimplemented in PHTML.

PStringStream& PStringStream::operator= ( const char *  cstr)

Assign the C string to the string stream.

The current instance then becomes a unique reference to a copy of the cstr parameter. The cstr parameter is typically a literal string, eg:


          myStr = "fred";

This will reset the read pointer for input to the beginning of the string. Also, any data output to the string up until the asasignement will be lost.

Returns:
reference to the current PStringStream object.
Parameters:
cstrC string to assign.

Reimplemented from PString.

Reimplemented in PHTML.

PStringStream& PStringStream::operator= ( char  ch)

Assign the character to the current object.

The current instance then becomes a unique reference to a copy of the character parameter. eg:


          myStr = 'A';
Returns:
reference to the current PString object.
Parameters:
chCharacter to assign.

Reimplemented from PString.

Reimplemented in PHTML.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines