FileSource
#include <tpau-cpp-kernal/FileSource.h>
class FileSource
Represents a source of characters from a file, with support for lookahead and seeking.
constructor FileSource
| FileSource | ( | Symbol filename | ); |
| PARAMETER | DESCRIPTION |
|---|---|
filename |
method expand_locationconst
Expand a location within the file to include the current location.
If the location is not within the file, it will be left unchanged.
| void expand_location | ( | Location & location | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location to expand. |
method filenameconst
Get the name of the file.
| Symbol filename | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Symbol |
The name of the file. |
method get
Get the next character from the file. Returns EOF if the end of the file is reached.
| int get | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
int |
The next character from the file, or |
method locationconst
Get the current location in the file.
| Location location | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Location |
The current location in the file. |
method reset_to
Reset the current position to a new location.
| void reset_to | ( | const Location & new_location | ); |
| PARAMETER | DESCRIPTION |
|---|---|
new_location |
The new location to reset to. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If the new location is not within the file. |
method unget
Unget the last character read from the file. The next call to get() will return the same character again.
| void unget | ( | ); |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If at the beginning of the file. |