#include <maxtextfile.h>
This class is the base for all text file readers.
It declare a common interface to all implementation
Public Member Functions |
|
virtual | ~BaseTextReader () |
virtual unsigned int | ReadCharUTF32 (bool peek=false) const =0 |
Reads a single char and returns it's UTF32
representation. |
|
virtual MaxString | ReadChars (size_t nchars) const =0 |
Reads characters from the file. |
|
virtual MaxString | ReadLine (size_t nchars=(size_t)-1, bool dontReturnEOL=false) const =0 |
Reads a line from the file (or nchars,
depending on which one comes first.) |
|
virtual size_t | Position () const =0 |
Get the number of characters read so far.
|
|
virtual size_t | LineNumber () const =0 |
Get the current line number. |
|
virtual Char | ReadChar (bool peek=false) const =0 |
Read a character from the file. |
|
virtual size_t | UnreadChar (const Char &c)=0 |
Unread a character. |
|
virtual size_t | Seek (long offset, int origin)=0 |
Seek inside the stream. |
|
virtual bool | IsFileOpen () const =0 |
Returns true if file is open. |
|
virtual bool | IsEndOfFile () const =0 |
Returns true if file at the end. |
virtual ~BaseTextReader | ( | ) | [virtual] |
virtual unsigned int ReadCharUTF32 | ( | bool | peek = false |
) | const [pure virtual] |
Reads a single char and returns it's UTF32 representation.
UTF-32 (or UCS-4) is a protocol to encode Unicode characters that uses exactly 32 bits per Unicode code point. All other Unicode transformation formats use variable-length encodings. The UTF-32 form of a character is a direct representation of its codepoint.
peek | - Read a char but does not move the internal pointer to next char. |
Implemented in Reader, and ReaderWriter.
virtual MaxString ReadChars | ( | size_t | nchars | ) | const [pure virtual] |
Reads characters from the file.
nchars | Stop reading after 'nchars' characters or when end of file reached. |
Implemented in Reader, and ReaderWriter.
virtual MaxString ReadLine | ( | size_t | nchars =
(size_t)-1 , |
bool | dontReturnEOL =
false |
||
) | const [pure virtual] |
Reads a line from the file (or nchars, depending on which one comes first.)
nchars | Stop reading after 'nchars' characters even if the EOL was not found. |
dontReturnEOL | By default, this function will returns the line including it's end-of-line character(s) unless you set "dontReturnEOL" to true. |
Implemented in Reader, and ReaderWriter.
virtual size_t Position | ( | ) | const [pure virtual] |
Get the number of characters read so far.
Implemented in Reader, and ReaderWriter.
virtual size_t LineNumber | ( | ) | const [pure virtual] |
virtual Char ReadChar | ( | bool | peek = false |
) | const [pure virtual] |
Read a character from the file.
peek | Read a char but does not move the internal pointer to next char. |
Implemented in Reader, and ReaderWriter.
virtual size_t UnreadChar | ( | const Char & | c | ) | [pure virtual] |
Unread a character.
Put back a character inside the buffer. The data will be re-read next time you call read. This is used internally when parsing max scripts.
c | Char to put back in the buffer |
Implemented in Reader, and ReaderWriter.
virtual size_t Seek | ( | long | offset, |
int | origin | ||
) | [pure virtual] |
Seek inside the stream.
offset | The seeks operations are done in number of characters (not bytes). |
origin | The direction to move. Origin can be one of the following * SEEK_CUR Current position of file pointer. * SEEK_END End of file. * SEEK_SET Beginning of file. |
Implemented in Reader, and ReaderWriter.
virtual bool IsFileOpen | ( | ) | const [pure virtual] |
virtual bool IsEndOfFile | ( | ) | const [pure virtual] |
Returns true if file at the end.
Implemented in Reader, and ReaderWriter.