Text data stream.
More...
#include <gelDataStream.h>
List of all members.
Detailed Description
Constructor & Destructor Documentation
gel::GelTextStream::GelTextStream |
( |
| ) |
[inline] |
Convenience constructor.
Opens a file from disk.
- See also:
- open()
gel::GelTextStream::~GelTextStream |
( |
| ) |
|
Destructor.
Closes the file associated with this stream.
- See also:
- close()
Member Function Documentation
Opens a file from disk.
- Parameters:
-
filename | : The name of the file to open. |
mode | : The mode to open the file with. |
- Returns:
- True if successful, else false.
bool gel::GelTextStream::close |
( |
| ) |
|
Closes the file associated with this stream.
- Returns:
- True if the file was closed successfully, else false.
GelString gel::GelTextStream::read |
( |
int |
maxlen | ) |
|
Reads a specified number of characters.
- Parameters:
-
maxlen | : The maximum number of characters that will be read. |
- Returns:
- The characters read as a GelString.
Reads the entire stream.
This function can consume a significant amount of memory when reading from large files.
- Returns:
- The characters read as a GelString.
GelString gel::GelTextStream::readLine |
( |
int |
maxlen | ) |
|
Reads a line of text.
- Parameters:
-
maxlen | : The maximum line length. |
- Returns:
- A line of text as a GelString.
GelChar gel::GelTextStream::readChar |
( |
| ) |
|
Reads a character from the stream.
- Returns:
- The character read as a GelChar.
bool gel::GelTextStream::writeString |
( |
const GelString & |
str | ) |
|
Writes text to the stream.
- Parameters:
-
bool gel::GelTextStream::writeChar |
( |
GelChar |
chr | ) |
|
Writes a character to the stream.
- Parameters:
-
chr | : The character to write |
bool gel::GelTextStream::flush |
( |
| ) |
|
Flushes the stream.
If the file was open for writing, any unwritten data in the buffer will be written to the file.
- Returns:
- True if successful, else false.
long gel::GelTextStream::getSize |
( |
| ) |
const [inline] |
Gets the size of the file.
- Returns:
- The size of the file.
long gel::GelTextStream::tell |
( |
| ) |
const |
Gets the current value of the stream's position indicator.
- Returns:
- If successful, the current value of the stream's position indicator, else 0.
bool gel::GelTextStream::seek |
( |
long |
offset, |
|
|
DataSeek |
origin |
|
) |
| |
Sets the position of the stream's position indicator.
- Parameters:
-
offset | : The new position relative to origin |
origin | : The reference position to add offset to. |
- Returns:
- True if successful, else false.
bool gel::GelTextStream::atEnd |
( |
| ) |
const |
Checks if the end of the stream has been reached.
- Returns:
- True if the end of the stream has been reached, else false.
The documentation for this class was generated from the following file: