33 #include "../System/databuffer.h"
47 static std::string
read_text(
const std::string &filename);
53 static void write_text(
const std::string &filename,
const std::string &text,
bool write_bom =
false);
132 const std::string &filename);
138 const std::string &filename,
142 unsigned int flags = 0);
161 const std::string &filename);
167 const std::string &filename,
171 unsigned int flags = 0);
AccessFlags
Access flags.
Definition: file.h:65
@ open_existing_truncate
Open existing file and truncate it.
Definition: file.h:102
@ create_new
Create a new file. Fails if it already exists.
Definition: file.h:108
bool open(const std::string &filename)
Opens a file read only.
@ open_always
Open file or create it if it does not exist.
Definition: file.h:96
File(const std::string &filename)
Constructs a file object read only.
Flags
Optimization Flags.
Definition: file.h:113
General purpose data buffer.
Definition: databuffer.h:43
@ share_delete
Allow others to delete the file.
Definition: file.h:86
I/O Device interface.
Definition: iodevice.h:51
ShareFlags
File sharing flags.
Definition: file.h:78
File()
Constructs a file object.
@ open_existing
Open existing file. Fails if it does not exist.
Definition: file.h:99
static void write_text(const std::string &filename, const std::string &text, bool write_bom=false)
Saves an UTF-8 text string to file.
@ share_write
Allow others to open the file for writing.
Definition: file.h:83
File I/O device.
Definition: file.h:42
@ access_read
Generic read access.
Definition: file.h:67
@ flag_sequential_scan
Definition: file.h:117
static std::string read_text(const std::string &filename)
Loads an UTF-8 text file into a string.
@ access_write
Generic write access.
Definition: file.h:70
@ flag_write_through
Definition: file.h:114
@ flag_random_access
Definition: file.h:116
OpenMode
File opening modes.
Definition: file.h:94
static DataBuffer read_bytes(const std::string &filename)
Loads an file into a byte buffer.
static void write_bytes(const std::string &filename, const DataBuffer &bytes)
Saves a byte buffer to file.
@ share_read
Allow others to open the file for reading.
Definition: file.h:80
@ create_always
Create file, even if it already exists.
Definition: file.h:105
@ share_all
All other sharing flags combined.
Definition: file.h:89
@ flag_no_buffering
Definition: file.h:115
bool open(const std::string &filename, OpenMode mode, unsigned int access, unsigned int share=share_all, unsigned int flags=0)
Opens a file.
File(const std::string &filename, OpenMode mode, unsigned int access, unsigned int share=share_all, unsigned int flags=0)
Constructs a file object.
@ access_read_write
Generic read write access.
Definition: file.h:73