A file reading class that provides buffered and unbuffered access to files with support for non-POD classes.
More...
|
|
| FileRead () |
| | Default constructor.
|
| |
| | FileRead (const RStr &filename) |
| | Opens the file specified by filename for reading. More...
|
| |
|
| FileRead (FILE *fp, bool do_close) |
| | Wraps the FILE* fp for reading. It will close it when finished if do_close is true.
|
| |
|
| FileRead (FILE *fp) |
| | Wraps the FILE* fp for reading. It will close it when finished unless fp is stdin.
|
| |
|
| FileRead (const FileBase &other) |
| | Base copy constructor.
|
| |
| bool | Open (const RStr &filename) |
| | Opens the file specified by filename for reading. More...
|
| |
|
void | Open (FILE *fp, bool do_close) |
| | Wraps the FILE* fp for reading. It will close it when finished if do_close is true.
|
| |
|
void | Open (FILE *fp) |
| | Wraps the FILE* fp for reading. It will close it when finished unless fp is stdin.
|
| |
| template<class T > |
| size_t | Read (Data1D< T > &data, const size_t amnt_to_read) |
| | Reads amnt_to_read elements of plain old data type T into data without buffering, resizing if too small. More...
|
| |
| template<class T > |
| size_t | Read (Data1D< T > &data) |
| | Fills data with plain old data type T without buffering. More...
|
| |
|
template<class T > |
| void | ReadAll (Data1D< T > &data) |
| | Reads all data until the end of file into data as plain old data type T.
|
| |
| bool | ReadLine (RStr &line, bool crop_newline=true) |
| | Reads one line until newline, null, or end of file. The newline is removed if crop_newline is true. More...
|
| |
|
bool | Read (RStr &line, bool crop_newline=true) |
| | Does ReadLine.
|
| |
|
bool | SkipLine () |
| | Discards one line until newline, null, or end of file.
|
| |
|
void | ReadAllLines (Data1D< RStr > &lines, bool crop_newlines=true) |
| | Reads all the lines found until the end of the file. If crop_newlines is true they are removed from each line.
|
| |
|
void | ReadAll (Data1D< RStr > &lines, bool crop_newlines=true) |
| | Does ReadAllLines.
|
| |
| template<class T > |
| bool | RawGet (T &data) |
| | Performs a buffered read of sizeof(T) bytes and assigns them to data. More...
|
| |
| template<class T > |
| bool | Get (T &data) |
| | Gets data of type T, after passing through FileGetWrapper. More...
|
| |
| bool | Get (RStr &data, bool crop_newline=true) |
| | Gets one line into data, up to the newline, null, or end of file, removing the newline if crop_newline is true. More...
|
| |
| bool | Get (Data1D< RStr > &data, bool crop_newlines=true) |
| | Fill data with lines from the file, removing the newlines if crop_newlines is true. More...
|
| |
| template<class T > |
| bool | Get (Data1D< T > &data) |
| | Fill data with elements of type T, calling Get on each one. More...
|
| |
| template<class T > |
| bool | Get (Data2D< T > &data) |
| | Fill data with elements of type T, calling Get on each one. More...
|
| |
| template<class T > |
| bool | Get (Data3D< T > &data) |
| | Fill data with elements of type T, calling Get on each one. More...
|
| |
| bool | GetAll (Data1D< RStr > &data, bool crop_newlines=true) |
| | Fill data with all lines from the file until the end, removing the newlines if crop_newlines is true. More...
|
| |
| template<class T > |
| bool | GetAll (Data1D< T > &data) |
| | Fill data with all elements of type T until the end of file, calling Get on each one. More...
|
| |
|
| FileBase () |
| | Default constructor.
|
| |
|
| FileBase (const FileBase &other) |
| | Copy constructor.
|
| |
|
FileBase & | operator= (const FileBase &other) |
| | Assignment operator.
|
| |
|
virtual | ~FileBase () |
| | Flushes the write buffer before destructing. This will close the file if it is the last FileBase sharing it.
|
| |
|
RStr | GetFilename () const |
| | Returns the filename if one was given upon opening.
|
| |
|
void | SetFilename (const RStr &newfilename) const |
| | Manually changes the associated filename.
|
| |
|
void | Close () |
| | Flushes the buffers and closes the file.
|
| |
|
bool | IsOpen () const |
| | True if the file is open.
|
| |
|
bool | IsClosed () const |
| | True if the file is closed.
|
| |
|
bool | IsReadable () const |
| | True if the file is open and readable.
|
| |
|
bool | IsWritable () const |
| | True if the file is open and writable.
|
| |
|
FILE * | Raw () const |
| | Returns a raw FILE* which can be used with the C file functions.
|
| |
|
void | Assert () const |
| | Throws ErrorMsgFile if the file is closed.
|
| |
|
size_t | Size () const |
| | Returns the file size in bytes.
|
| |
|
void | SetPosition (const size_t pos) |
| | Sets the reading and writing position to pos bytes into the file.
|
| |
| void | RelativePosition (const i64 amnt) |
| | Sets the position for the next read or write operation. More...
|
| |
| size_t | GetPosition (bool quiet_fail=false) const |
| | Gets the position for the next read or write operation. More...
|
| |
|
void | Rewind () |
| | Clears the read-ahead buffer used by FileRead::Get calls.
|
| |
|
void | Flush () |
| | Flushes all unsaved data to the storage system.
|
| |
|
void | ClearBuffer () |
| | Processes the remaining data in the Put/Get buffer.
|
| |
A file reading class that provides buffered and unbuffered access to files with support for non-POD classes.