FileReader
class FileReader
Provides an interface for reading files, with support for caching and binary files.
method std::vector< Symbol > file_names()
Get the names of all files that have been read.
| Returns | Description |
|---|---|
std::vector< Symbol > |
A vector of file names. |
method const std::string &get_line(Symbol file, size_t line_number)
Get a specific line from a file.
| Parameter | Description |
|---|---|
file |
The name of the file. TYPE: |
line_number |
The line number to retrieve (0-based). TYPE: |
| Returns | Description |
|---|---|
const std::string & |
The requested line. |
| Throws | Description |
|---|---|
Exception |
If the file has not been read or the line does not exist. |
method const std::vector< std::string > &read(Symbol file_name, bool optional = false)
Get the contents of a text file.
| Parameter | Description |
|---|---|
file_name |
The name of the file to read. TYPE: |
optional |
If TYPE: |
| Returns | Description |
|---|---|
const std::vector< std::string > & |
The contents of the file as a vector of lines. |
| Throws | Description |
|---|---|
Exception |
If the file does not exist and |
method std::string read_binary(Symbol file_name, bool optional = false)
Get the contents of a binary file.
| Parameter | Description |
|---|---|
file_name |
The name of the file to read. TYPE: |
optional |
If TYPE: |
| Returns | Description |
|---|---|
std::string |
The contents of the file as a string. |
| Throws | Description |
|---|---|
Exception |
If the file does not exist and |
member global
The global file reader instance.