Parses a text file by reading it completely into memory, delimiting tokens by user request.
More...
#include <parser.h>
|
enum | input_type { File,
String
} |
| Determines whether the parser parses a std::string or the contents of a file.
|
|
|
void | get_next () |
| Advances to the next token in the file or string, saving the result.
|
|
|
size_t | idx_ |
| The current position of the "cursor" into the file or string.
|
|
std::array< bool, 256 > | invalid_ |
| Array of booleans indicating whether or not a character is a delimiter.
|
|
std::string | filename_ |
| Saves the name of the file if the parser is parsing a file.
|
|
std::unique_ptr< io::mmap_file > | mmap_file_ |
| Memory-mapped file pointer if the parser is parsing a file.
|
|
uint64_t | size_ |
| The number of characters that will be read.
|
|
const char * | data_ |
| Pointer into a string or memory-mapped file.
|
|
util::optional< std::string > | next_ |
| The next token to be returned; "" if none.
|
|
Parses a text file by reading it completely into memory, delimiting tokens by user request.
meta::io::parser::parser |
( |
const std::string & |
input, |
|
|
const std::string & |
delims, |
|
|
input_type |
in_type = input_type::File |
|
) |
| |
- Parameters
-
path | The path to the file to parse |
delims | Delimiters to be used for separating tokens |
in_type | Determines whether the input is a file or a string |
std::string meta::io::parser::filename |
( |
| ) |
const |
- Returns
- the filename of the file that is being parsed
std::string meta::io::parser::peek |
( |
| ) |
const |
- Returns
- the next token in the parser without advancing the current position
std::string meta::io::parser::next |
( |
| ) |
|
- Returns
- the next token in the parser, advancing to the next one if it exists
bool meta::io::parser::has_next |
( |
| ) |
const |
- Returns
- whether the parser contains another token
The documentation for this class was generated from the following files: