04.11.2011 - adjust for Windows & QNX, multiprotocol, repeater, signals, process, codec, console input

This commit is contained in:
peri4
2011-11-04 15:33:15 +03:00
parent 39ec9cac5c
commit e25553b97b
32 changed files with 468 additions and 294 deletions

View File

@@ -25,23 +25,23 @@ public:
bool open() {return open(cpath, cmode);}
void close() {stream.close();}
void clear() {string st = cpath.stdString(); close(); stream.open(st.c_str(), fstream::trunc | fstream::binary | (fstream::openmode)(int)cmode);}
void seek(int position) {stream.clear(); stream.seekg(position); stream.seekp(position);}
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);}
void seekToEnd() {stream.clear(); stream.seekg(0, fstream::end); stream.seekp(0, fstream::end);}
void seekToLine(int line) {stream.clear(); seekToBegin(); piForTimes (line) readLine();} // line 0 - begin of file
void resize(int new_size, char fill = 0);
void seekToLine(llong line) {stream.clear(); seekToBegin(); piForTimes (line) readLine();} // line 0 - begin of file
void resize(llong new_size, char fill = 0);
void fill(char c) {stream.fill(c);}
void flush() {stream.flush();}
PIString readLine();
int readAll(void * data);
llong readAll(void * data);
PIByteArray readAll();
void remove() {if (isOpened()) close(); std::remove(cpath.data());}
PIString path() const {return cpath;}
void setPath(const PIString & path) {cpath = path;}
PIFlags<Mode> mode() const {return cmode;}
int size();
int pos();
llong size();
llong pos();
bool isOpened() {return stream.is_open();}
bool isEnd() {return stream.eof();}
bool isEmpty() {return (size() <= 0);}