2 #include "oxygine-include.h" 5 #include "FileSystem.h" 15 typedef file::fileHandle* handle;
21 typedef unsigned char uchar;
23 uchar& front() {
return data.front(); }
24 const uchar& front()
const {
return data.front(); }
26 uchar& back() {
return data.back(); }
27 const uchar& back()
const {
return data.back(); }
29 uchar& operator[](
size_t i) {
return data[i]; }
30 const uchar& operator[](
size_t i)
const {
return data[i]; }
32 uchar& at(
size_t i) {
return data.at(i); }
33 const uchar& at(
size_t i)
const {
return data.at(i); }
35 void push_back(uchar v) {
return data.push_back(v); }
36 uchar pop_back() { uchar v = data.back(); data.pop_back();
return v; }
37 void reserve(
size_t v) { data.reserve(v); }
38 void resize(
size_t v) { data.resize(v); }
40 size_t size()
const {
return data.size(); }
41 bool empty()
const {
return data.empty(); }
43 const void* getData()
const {
if (data.empty())
return 0;
return &data[0];}
44 void* getData() {
if (data.empty())
return 0;
return &data[0]; }
45 unsigned int getSize()
const {
return (
unsigned int)data.size();}
47 std::string getString()
const {
return std::string((
char*)&data[0], size());}
49 typedef std::vector<uchar> buff;
54 handle open(
const std::string& file,
const char* mode, error_policy ep = ep_show_error);
60 int seek(
handle,
unsigned int offset,
int whence);
66 unsigned int read(
handle,
void* dest,
unsigned int size);
69 bool read(
const std::string& file,
buffer& dest, error_policy ep = ep_show_error);
75 unsigned int write(
handle,
const void* data,
unsigned int size);
78 unsigned int write(
const std::string& file,
const buffer& data, error_policy ep = ep_show_error);
79 unsigned int write(
const std::string& file,
const void* data,
unsigned int size, error_policy ep = ep_show_error);
82 bool exists(
const std::string& file);
88 bool deleteFile(
const std::string& path, error_policy ep = ep_show_warning);
91 bool rename(
const std::string& src,
const std::string& dest, error_policy ep = ep_show_warning);
94 bool makeDirectory(
const std::string& path);
95 void makeDirectories(
const std::string& path);
98 void deleteDirectory(
const std::string& path);
116 ~
autoClose() {
if (_handle) close(_handle);}
118 handle getHandle()
const {
return _handle;}
131 void init(
const char* company,
const char* app);
Definition: FileSystem.h:12
–oxgl-end–!
Definition: Actor.h:14
Definition: STDFileSystem.h:8
Definition: FileSystem.h:27