16.01.2011 - new modules - pimath and pigeometry

This commit is contained in:
peri4
2011-01-18 13:15:41 +03:00
parent a32edb1fef
commit 3610ea9212
17 changed files with 817 additions and 63 deletions

View File

@@ -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;}