|
Monad Engine da02fba2
> Undercity Codex_
|
Read helper bound to a single file path. More...
#include <FileReader.h>
Public Member Functions | |
| FileReader (const std::string &path) | |
| Bind the reader to the given file path. | |
| bool | Exists () |
| Check whether the file exists on disk. | |
| std::vector< std::string > | ReadLines () |
| Read the file line-by-line. | |
| std::string | ReadToString () |
| Read the entire file into a single string. | |
| std::vector< u64 > | ReadToBytes () |
| Read the file as raw bytes. | |
| u64 | GetSize () |
| Return the file size in bytes. | |
| std::string | GetPath () |
| Return the path this reader was constructed with. | |
Read helper bound to a single file path.
All read methods open, read, and close the file on each call — there is no persistent file handle. Check Exists() before reading to avoid error logs.
Definition at line 34 of file FileReader.h.
|
inlineexplicit |
Bind the reader to the given file path.
| path | Absolute or relative path to the file. |
Definition at line 44 of file FileReader.h.
| bool mnd::FileReader::Exists | ( | ) |
Check whether the file exists on disk.
Definition at line 7 of file FileReader.cpp.
Referenced by GetPath(), GetSize(), ReadLines(), ReadToBytes(), and ReadToString().
| std::string mnd::FileReader::GetPath | ( | ) |
Return the path this reader was constructed with.
Definition at line 79 of file FileReader.cpp.
| u64 mnd::FileReader::GetSize | ( | ) |
Return the file size in bytes.
Definition at line 65 of file FileReader.cpp.
| std::vector< std::string > mnd::FileReader::ReadLines | ( | ) |
Read the file line-by-line.
Definition at line 28 of file FileReader.cpp.
| std::vector< u64 > mnd::FileReader::ReadToBytes | ( | ) |
Read the file as raw bytes.
Definition at line 46 of file FileReader.cpp.
| std::string mnd::FileReader::ReadToString | ( | ) |
Read the entire file into a single string.
Definition at line 12 of file FileReader.cpp.