Orcus
|
#include <stream.hpp>
Public Member Functions | |
file_content (const file_content &)=delete | |
file_content & | operator= (const file_content &)=delete |
file_content (file_content &&other) | |
file_content (const char *filepath) | |
const char * | data () const |
size_t | size () const |
bool | empty () const |
void | swap (file_content &other) |
void | load (const char *filepath) |
void | convert_to_utf8 () |
pstring | str () const |
Represents the content of a file. The file content may be either in-memory, or memory-mapped; it is initially memory-mapped, but it may become in-memory when converted to a different encoding.
void orcus::file_content::convert_to_utf8 | ( | ) |
Convert a non-utf-8 stream to a utf-8 one if the source stream contains a byte order mark. If not, it does nothing. When the conversion happens, the converted content will be stored in-memory.
void orcus::file_content::load | ( | const char * | filepath | ) |
Load from a new file. This will invalidate the pointer returned from the file_content#data() method prior to the call.
filepath | path of the file to load from. |