Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | List of all members
om::io::StringInputStream Class Referenceabstract

A class that abstracts a source for a stream of character information. More...

#include <omStringInputStream.h>

Inheritance diagram for om::io::StringInputStream:
om::io::FileReader

Public Member Functions

 StringInputStream ()
 Create a StringInputStream with the native endianness. More...
 
 StringInputStream (data::Endianness newEndianness)
 Create a StringInputStream with the specified input endianness. More...
 
virtual ~StringInputStream ()
 Destroy an input stream and free all of it's resources (close it). More...
 
virtual LargeSize getCharactersRemaining () const =0
 Return the number of ASCII characters remaining in the stream. More...
 
Bool hasCharactersRemaining () const
 Return whether or not there are bytes remaining in the stream. More...
 
Bool readASCII (Char &value)
 Read a single ASCII character and place it in the input parameter. More...
 
Bool readUTF32 (UTF32Char &value)
 Read a single UTF32 character and place it in the input parameter. More...
 
Size readASCII (Char *buffer, Size numBytes)
 Read the specified number of ASCII characters and place them in the output buffer. More...
 
Size readUTF8 (UTF8Char *buffer, Size numChars, Size capacity)
 Read the specified number of UTF-8 characters and place them in the output buffer. More...
 
Size readUTF16 (UTF16Char *buffer, Size numChars, Size capacity)
 Read the specified number of UTF-16 characters and place them in the output buffer. More...
 
Size readUTF32 (UTF32Char *buffer, Size numChars)
 Read the specified number of UTF-16 characters and place them in the output buffer. More...
 
Size readASCII (data::StringBuffer &buffer, Size numChars)
 Read the specified number of characters from the stream and place them in the specified string buffer. More...
 
Size readUTF8 (data::UTF8StringBuffer &buffer, Size numChars)
 Read the specified number of characters from the stream and place them in the specified UTF-8 string buffer. More...
 
Size readUTF16 (data::UTF16StringBuffer &buffer, Size numChars)
 Read the specified number of characters from the stream and place them in the specified UTF-16 string buffer. More...
 
Size readUTF32 (data::UTF32StringBuffer &buffer, Size numChars)
 Read the specified number of characters from the stream and place them in the specified UTF-32 string buffer. More...
 
data::String readAllASCII ()
 
data::UTF8String readAllUTF8 ()
 
data::UTF16String readAllUTF16 ()
 
data::UTF32String readAllUTF32 ()
 
data::Endianness getEndianness () const
 Get the endianness to assume when reading from the stream. More...
 
void setEndianness (data::Endianness newEndianness)
 Set the endianness to assume when reading from the stream. More...
 

Protected Member Functions

virtual Size readChars (Char *buffer, Size number)=0
 Read the specified number of characters from the stream and place them in the specified output buffer. More...
 
virtual Size readUTF8Chars (UTF8Char *buffer, Size numChars, Size capacity)=0
 Read the specified number of UTF-8 characters from the stream and place them in the specified output buffer. More...
 
virtual Size readUTF16Chars (UTF16Char *buffer, Size numChars, Size capacity)=0
 Read the specified number of UTF-16 characters from the stream and place them in the specified output buffer. More...
 
virtual Size readUTF32Chars (UTF32Char *buffer, Size numChars)=0
 Read the specified number of UTF-32 characters from the stream and place them in the specified output buffer. More...
 

Detailed Description

A class that abstracts a source for a stream of character information.

Constructor & Destructor Documentation

om::io::StringInputStream::StringInputStream ( )
inline

Create a StringInputStream with the native endianness.

om::io::StringInputStream::StringInputStream ( data::Endianness  newEndianness)
inline

Create a StringInputStream with the specified input endianness.

virtual om::io::StringInputStream::~StringInputStream ( )
inlinevirtual

Destroy an input stream and free all of it's resources (close it).

Member Function Documentation

virtual LargeSize om::io::StringInputStream::getCharactersRemaining ( ) const
pure virtual

Return the number of ASCII characters remaining in the stream.

The value returned must only be a lower bound on the number of characters remaining in the stream. If there are characters remaining, it must return at least 1.

Implemented in om::io::FileReader.

Bool om::io::StringInputStream::hasCharactersRemaining ( ) const
inline

Return whether or not there are bytes remaining in the stream.

Bool om::io::StringInputStream::readASCII ( Char value)
inline

Read a single ASCII character and place it in the input parameter.

If the read operation was successful, return TRUE, otherwise return FALSE.

Bool om::io::StringInputStream::readUTF32 ( UTF32Char value)
inline

Read a single UTF32 character and place it in the input parameter.

If the read operation was successful, return TRUE, otherwise return FALSE.

Size om::io::StringInputStream::readASCII ( Char buffer,
Size  numBytes 
)
inline

Read the specified number of ASCII characters and place them in the output buffer.

The number of characters successfully read is returned.

Size om::io::StringInputStream::readUTF8 ( UTF8Char buffer,
Size  numChars,
Size  capacity 
)
inline

Read the specified number of UTF-8 characters and place them in the output buffer.

The number of unicode code points successfully read is returned. The number of code points read is limited to the specified buffer capacity. The number of full unicode characters actually read is placed in the input/output paramter numChars.

Size om::io::StringInputStream::readUTF16 ( UTF16Char buffer,
Size  numChars,
Size  capacity 
)
inline

Read the specified number of UTF-16 characters and place them in the output buffer.

The number of unicode code points successfully read is returned. The number of code points read is limited to the specified buffer capacity. The number of full unicode characters actually read is placed in the input/output paramter numChars.

Size om::io::StringInputStream::readUTF32 ( UTF32Char buffer,
Size  numChars 
)
inline

Read the specified number of UTF-16 characters and place them in the output buffer.

The number of characters successfully read is returned.

Size om::io::StringInputStream::readASCII ( data::StringBuffer buffer,
Size  numChars 
)

Read the specified number of characters from the stream and place them in the specified string buffer.

Size om::io::StringInputStream::readUTF8 ( data::UTF8StringBuffer buffer,
Size  numChars 
)

Read the specified number of characters from the stream and place them in the specified UTF-8 string buffer.

The number of unicode code points read is returned and the number of characters actually read is placed in the input/output paramter numChars.

Size om::io::StringInputStream::readUTF16 ( data::UTF16StringBuffer buffer,
Size  numChars 
)

Read the specified number of characters from the stream and place them in the specified UTF-16 string buffer.

The number of unicode code points read is returned and the number of characters actually read is placed in the input/output paramter numChars.

Size om::io::StringInputStream::readUTF32 ( data::UTF32StringBuffer buffer,
Size  numChars 
)

Read the specified number of characters from the stream and place them in the specified UTF-32 string buffer.

The number of characters read is returned.

data::String om::io::StringInputStream::readAllASCII ( )
data::UTF8String om::io::StringInputStream::readAllUTF8 ( )
data::UTF16String om::io::StringInputStream::readAllUTF16 ( )
inline
data::UTF32String om::io::StringInputStream::readAllUTF32 ( )
inline
data::Endianness om::io::StringInputStream::getEndianness ( ) const
inline

Get the endianness to assume when reading from the stream.

void om::io::StringInputStream::setEndianness ( data::Endianness  newEndianness)
inline

Set the endianness to assume when reading from the stream.

virtual Size om::io::StringInputStream::readChars ( Char buffer,
Size  number 
)
protectedpure virtual

Read the specified number of characters from the stream and place them in the specified output buffer.

Implemented in om::io::FileReader.

virtual Size om::io::StringInputStream::readUTF8Chars ( UTF8Char buffer,
Size  numChars,
Size  capacity 
)
protectedpure virtual

Read the specified number of UTF-8 characters from the stream and place them in the specified output buffer.

If the number of unicode code points exceeds the capacity of the buffer, as many characters are read as possible. The number of code points read is returned.

Implemented in om::io::FileReader.

virtual Size om::io::StringInputStream::readUTF16Chars ( UTF16Char buffer,
Size  numChars,
Size  capacity 
)
protectedpure virtual

Read the specified number of UTF-16 characters from the stream and place them in the specified output buffer.

If the number of unicode code points exceeds the capacity of the buffer, as many characters are read as possible. The number of code points read is returned.

Implemented in om::io::FileReader.

virtual Size om::io::StringInputStream::readUTF32Chars ( UTF32Char buffer,
Size  numChars 
)
protectedpure virtual

Read the specified number of UTF-32 characters from the stream and place them in the specified output buffer.

If the number of unicode code points exceeds the capacity of the buffer, as many characters are read as possible. The number of code points read is returned.

Implemented in om::io::FileReader.


The documentation for this class was generated from the following file: