15.12.2011 - version 0.1.1
This commit is contained in:
6
pifile.h
6
pifile.h
@@ -15,7 +15,7 @@ public:
|
||||
|
||||
PIFile(const PIString & path, PIFlags<Mode> mode = ReadWrite): PIObject(path) {open(path, mode);}
|
||||
PIFile(const PIFile & file): PIObject(file.cpath) {cpath = file.cpath; cmode = file.cmode;}
|
||||
~PIFile() {if (isOpened()) close();}
|
||||
~PIFile() {close();}
|
||||
|
||||
PIFile & operator =(const PIFile & f) {cpath = f.cpath; cmode = f.cmode; return *this;}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
EVENT_HANDLER1(PIFile, bool, open, PIFlags<Mode>, mode) {return open(cpath, mode);}
|
||||
EVENT_HANDLER1(PIFile, bool, open, const PIString & , path) {return open(path, cmode);}
|
||||
EVENT_HANDLER0(PIFile, bool, open) {return open(cpath, cmode);}
|
||||
EVENT_HANDLER0(PIFile, void, close) {stream.close();}
|
||||
EVENT_HANDLER0(PIFile, void, close) {stream.clear(); stream.close();}
|
||||
EVENT_HANDLER0(PIFile, void, clear) {string st = cpath.stdString(); close(); stream.open(st.c_str(), fstream::trunc | fstream::binary | (fstream::openmode)(int)cmode);}
|
||||
void seek(llong position) {stream.clear(); stream.seekg(position); stream.seekp(position);}
|
||||
void seekToBegin() {stream.clear(); stream.seekg(0, fstream::beg); stream.seekp(0, fstream::beg);}
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
PIString readLine();
|
||||
llong readAll(void * data);
|
||||
PIByteArray readAll(bool forceRead = false);
|
||||
EVENT_HANDLER0(PIFile, void, remove) {if (isOpened()) close(); std::remove(cpath.data());}
|
||||
EVENT_HANDLER0(PIFile, void, remove) {close(); std::remove(cpath.data());}
|
||||
|
||||
PIString path() const {return cpath;}
|
||||
void setPath(const PIString & path) {cpath = path;}
|
||||
|
||||
Reference in New Issue
Block a user