23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"

This commit is contained in:
peri4
2014-06-23 21:08:27 +04:00
parent 2e5e75c4c4
commit 15a20d40ac
56 changed files with 10315 additions and 760 deletions

View File

@@ -92,10 +92,10 @@ public:
//! Read from file to "read_to" no more than "max_size" and return readed bytes count
int read(void * read_to, int max_size) {if (!canRead() || fd == 0) return -1; return fread(read_to, max_size, 1, fd);}
int read(void * read_to, int max_size) {if (!canRead() || fd == 0) return -1; return fread(read_to, 1, max_size, fd);}
//! Write to file "data" with size "max_size" and return written bytes count
int write(const void * data, int max_size) {if (!canWrite() || fd == 0) return -1; return fwrite(data, max_size, 1, fd);}
int write(const void * data, int max_size) {if (!canWrite() || fd == 0) return -1; return fwrite(data, 1, max_size, fd);}
PIFile & writeToBinLog(ushort id, const void * data, int size) {if (!isWriteable() || fd == 0) return *this; writeBinary(id).writeBinary((ushort)size); write(data, size); flush(); return *this;}
@@ -183,6 +183,7 @@ public:
//! Read from file text representation of "v"
PIFile & operator >>(double & v) {if (canRead() && fd != 0) ret = fscanf(fd, "%lf", &v); return *this;}
PIString constructFullPath() const;
EVENT_HANDLER(void, clear) {close(); fd = fopen(path().data(), "w"); if (fd != 0) fclose(fd); fd = 0; opened_ = false; open();}
EVENT_HANDLER0(void, remove) {close(); std::remove(path().data());}