Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RAM. The struct contains two nested struct definitions, for a Reader and a Writer. Private objects of these structs can then be accessed with eponymous data() getter functions, returning the appropriate kind of access depending on the const-ness of the TextFile object itself.
More...
|
|
| ~TextFile ()=default |
| | Default destructor.
|
| |
|
std::string | getFileName () const |
| | Get the name of the original file.
|
| |
|
int | getLineCount () const |
| | Get the line count of a text file after converting it to a character vector in memory.
|
| |
| int | getLineLimits (int index) const |
| | Get one of the line limits of a text file converted to a character vector in memory.
|
| |
| int | getLineLength (int index) const |
| | Get the length of a line. A bounds check will be applied to the line index number.
|
| |
|
int | getLongestLineLength () const |
| | Get the length of the longest line in the file.
|
| |
|
size_t | getTextSize () const |
| | Get the number of text characters in the object's buffer (this will not count implicit carriage returns between lines).
|
| |
| char | getChar (int index) const |
| | Get one character of a text file after converting it to a character vector in memory.
|
| |
| std::string | getLineAsString (int line_index) const |
| | Get a line from the file as a string.
|
| |
| const char * | getTextPointer (int index) const |
| | Get a char pointer to a specific index in the object.
|
| |
| const char * | getLinePointer (int line_index) const |
| | Get a char pointer to a specific line in the object.
|
| |
|
const TextFileReader | data () const |
| | Get an abstract of a text file's CPU-RAM representation, for ease of use.
|
| |
| std::string | extractString (int line_number, int start_pos=0, int string_length=-1) const |
| | Extract a string based on a line number, starting position, and length.
|
| |
| char4 | extractChar4 (int line_number, int start_pos, int string_length) const |
| | Extract a char4 tuple based on a line number, starting position, and length.
|
| |
| std::string | toString (TextEnds line_endings=TextEnds::NEWLINE) const |
| | Convert all content to a string, with the option of making line endings carriage returns or simple spaces (fused line endings, which could create combined words out of the last word on one line and the first word on another, are not accepted).
|
| |
|
| | TextFile () |
| | Constructor for taking an ascii file or a very long, formatted string and transforming it into a std::vector of characters with line limits recorded.
|
| |
|
| TextFile (const std::string &file_name, TextOrigin source=TextOrigin::DISK, const std::string &content=std::string(""), const std::string &caller=std::string("")) |
| |
|
| TextFile (const char *content, const size_t length, const std::string &caller=std::string("")) |
| |
|
|
| TextFile (const TextFile &original)=default |
| | The default copy and move constructors as well as assignment operators are acceptable.
|
| |
|
| TextFile (TextFile &&original)=default |
| |
|
TextFile & | operator= (const TextFile &other)=default |
| |
|
TextFile & | operator= (TextFile &&other)=default |
| |
|
| void | write (std::ofstream *foutp) const |
| | Write the contents of the object to disk.
|
| |
|
void | write (const std::string &new_filename, PrintSituation expectation=PrintSituation::OPEN_NEW) const |
| |
|
void | write (PrintSituation expectation=PrintSituation::OPEN_NEW) const |
| |
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RAM. The struct contains two nested struct definitions, for a Reader and a Writer. Private objects of these structs can then be accessed with eponymous data() getter functions, returning the appropriate kind of access depending on the const-ness of the TextFile object itself.