16.01.2011 - new modules - pimath and pigeometry
This commit is contained in:
12
pifile.h
12
pifile.h
@@ -11,17 +11,21 @@ class PIFile
|
||||
{
|
||||
public:
|
||||
PIFile() {;}
|
||||
|
||||
enum Mode {Read = fstream::in, Write = fstream::out, Truncate = fstream::trunc, New = fstream::app};
|
||||
|
||||
PIFile(const PIString & path, Flags<Mode> mode = Read | Write) {open(path, mode);}
|
||||
PIFile(const PIFile & file) {cpath = file.cpath; cmode = file.cmode;}
|
||||
~PIFile() {if (isOpened()) close();}
|
||||
|
||||
bool open(const PIString & path, Flags<Mode> mode = Read | Write);
|
||||
void close() {stream.close();}
|
||||
void clear() {close(); stream.open(cpath.stdString().c_str(), fstream::trunc | (fstream::openmode)(int)cmode);}
|
||||
inline void close() {stream.close();}
|
||||
inline void clear() {string st = cpath.stdString(); close(); stream.open(st.c_str(), fstream::trunc | fstream::binary | (fstream::openmode)(int)cmode);}
|
||||
void seek(int position);
|
||||
inline void seekToEnd() {stream.seekg(0, fstream::end);}
|
||||
void resize(int new_size, char fill = 0);
|
||||
void fill(char c) {stream.fill(c);}
|
||||
void flush() {stream.flush();}
|
||||
inline void fill(char c) {stream.fill(c);}
|
||||
inline void flush() {stream.flush();}
|
||||
PIString readLine();
|
||||
|
||||
PIString path() const {return cpath;}
|
||||
|
||||
Reference in New Issue
Block a user