FileReader
#include <tpau-cpp-kernal/FileReader.h>
class FileReader
Provides an interface for reading files, with support for caching and binary files.
method file_namesconst
Get the names of all files that have been read.
| std::vector< Symbol > file_names | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::vector< Symbol > |
A vector of file names. |
method get_lineconst
Get a specific line from a file.
| const std::string & get_line | ( | Symbol file, | |
| size_t line_number | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
file |
The name of the file. |
line_number |
The line number to retrieve (0-based). |
| 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 read
Get the contents of a text file.
| const std::vector< std::string > & read | ( | Symbol file_name, | |
| bool optional = false | ); |
| PARAMETER | DESCRIPTION |
|---|---|
file_name |
The name of the file to read. |
optional |
If |
| 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 read_binary
Get the contents of a binary file.
| std::string read_binary | ( | Symbol file_name, | |
| bool optional = false | ); |
| PARAMETER | DESCRIPTION |
|---|---|
file_name |
The name of the file to read. |
optional |
If |
| RETURNS | DESCRIPTION |
|---|---|
std::string |
The contents of the file as a string. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If the file does not exist and |
method read_stdin
Get the contents of the standard input.
| const std::vector< std::string > & read_stdin | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
const std::vector< std::string > & |
The contents of the standard input as a vector of lines. |
member globalstatic
The global file reader instance.