version 2.98.0
remove PIFile::readLine() partially migrate PIConfig to text stream add more "override"
This commit is contained in:
@@ -390,32 +390,32 @@
|
||||
|
||||
#define PIOBJECT(name) \
|
||||
protected: \
|
||||
typedef name __PIObject__; \
|
||||
typedef name __PIObject__; \
|
||||
public: \
|
||||
static const char * __classNameCC() {return #name;} \
|
||||
static uint __classNameIDS() {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
virtual const char * className() const {return #name;} \
|
||||
virtual uint classNameID() const {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
static const char * __classNameCC() {return #name;} \
|
||||
static uint __classNameIDS() {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
const char * className() const override {return #name;} \
|
||||
uint classNameID() const override {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
private: \
|
||||
virtual int ptrOffset() const {name * o = (name*)100; return int(llong((PIObject*)o) - llong(o));} \
|
||||
class __BaseInitializer__ { \
|
||||
public: \
|
||||
__BaseInitializer__() { \
|
||||
uint pid = PIObject::__classNameIDS(); \
|
||||
if (pid == 0) return; \
|
||||
uint id = __classNameIDS(); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
if (__meta_data().contains(id)) return; \
|
||||
__meta_data()[pid]; \
|
||||
__meta_data()[id]; \
|
||||
__MetaData & ehp(__meta_data()[pid]); \
|
||||
__MetaData & eh(__meta_data()[id]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.addScope(__classNameCC(), id); \
|
||||
} \
|
||||
}; \
|
||||
__BaseInitializer__ __base_init__;
|
||||
int ptrOffset() const override {name * o = (name*)100; return int(llong((PIObject*)o) - llong(o));} \
|
||||
class __BaseInitializer__ { \
|
||||
public: \
|
||||
__BaseInitializer__() { \
|
||||
uint pid = PIObject::__classNameIDS(); \
|
||||
if (pid == 0) return; \
|
||||
uint id = __classNameIDS(); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
if (__meta_data().contains(id)) return; \
|
||||
__meta_data()[pid]; \
|
||||
__meta_data()[id]; \
|
||||
__MetaData & ehp(__meta_data()[pid]); \
|
||||
__MetaData & eh(__meta_data()[id]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.addScope(__classNameCC(), id); \
|
||||
} \
|
||||
}; \
|
||||
__BaseInitializer__ __base_init__;
|
||||
|
||||
#define PIOBJECT_PARENT(name) \
|
||||
class __ParentInitializer__ { \
|
||||
@@ -437,8 +437,8 @@
|
||||
}; \
|
||||
__ParentInitializer__ __parent_init__; \
|
||||
public: \
|
||||
virtual const char * parentClassName() const {return #name;} \
|
||||
typedef name __Parent__; \
|
||||
const char * parentClassName() const override {return #name;} \
|
||||
typedef name __Parent__; \
|
||||
private:
|
||||
|
||||
#define PIOBJECT_SUBCLASS(name, parent) PIOBJECT(name) PIOBJECT_PARENT(parent)
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
|
||||
//! \~english Read character
|
||||
//! \~russian Читает символ
|
||||
char takeChar(bool * rok) {
|
||||
char readChar(bool * rok) {
|
||||
char ret;
|
||||
bool ok = s->binaryStreamTake(&ret, sizeof(ret));
|
||||
if (!ok) is_end = true;
|
||||
@@ -156,11 +156,11 @@ public:
|
||||
|
||||
//! \~english Read line
|
||||
//! \~russian Читает строку
|
||||
PIString takeLine() {
|
||||
PIString readLine() {
|
||||
PIByteArray ret;
|
||||
bool ok = true;
|
||||
for (;;) {
|
||||
char b = takeChar(&ok);
|
||||
char b = readChar(&ok);
|
||||
if (!ok || b == '\n') break;
|
||||
if (b != '\r')
|
||||
ret.append((uchar)b);
|
||||
@@ -170,16 +170,16 @@ public:
|
||||
|
||||
//! \~english Read word, skip leading whitespaces, until next whitespace
|
||||
//! \~russian Читает слово, пропуская начальные пробельные символы, до следующего пробельного символа
|
||||
PIString takeWord() {
|
||||
PIString readWord() {
|
||||
static PIConstChars spaces(" \t\n\r");
|
||||
return takeUntil(spaces);
|
||||
return readUntil(spaces);
|
||||
}
|
||||
|
||||
//! \~english
|
||||
//! \~russian
|
||||
PIString takeCWord() {
|
||||
PIString readCWord() {
|
||||
static PIConstChars chars(" \t\n\r:;%$&#@!?~/*-+=.,\\\"'`[](){}<>");
|
||||
return takeUntil(chars);
|
||||
return readUntil(chars);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -190,7 +190,7 @@ private:
|
||||
}
|
||||
return PIString();
|
||||
}
|
||||
PIString takeUntil(const PIConstChars & chars) {
|
||||
PIString readUntil(const PIConstChars & chars) {
|
||||
//static PIConstChars spaces(" \t\n\r");
|
||||
bool ok = true;
|
||||
char c = skipWhile(chars, &ok);
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
PIByteArray ret;
|
||||
ret.append((uchar)c);
|
||||
for (;;) {
|
||||
c = takeChar(&ok);
|
||||
c = readChar(&ok);
|
||||
if (!ok || chars.contains(c)) break;
|
||||
ret.append((uchar)c);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ private:
|
||||
bool ok = true;
|
||||
char c = 0;
|
||||
for (;;) {
|
||||
c = takeChar(&ok);
|
||||
c = readChar(&ok);
|
||||
if (!ok || !chars.contains(c)) break;
|
||||
}
|
||||
if (rok) *rok = ok;
|
||||
@@ -291,51 +291,51 @@ template<typename P> inline PITextStream<P> & operator <<(PITextStream<P> & s, c
|
||||
|
||||
//! \~english Read word as bool
|
||||
//! \~russian Читает слово как логическое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, bool & v) {v = s.takeWord().toBool(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, bool & v) {v = s.readWord().toBool(); return s;}
|
||||
|
||||
//! \~english Read character
|
||||
//! \~russian Читает символ
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, char & v) {v = s.takeChar(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, char & v) {v = s.readChar(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, uchar & v) {v = s.takeWord().toUInt(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, uchar & v) {v = s.readWord().toUInt(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, short & v) {v = s.takeWord().toInt(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, short & v) {v = s.readWord().toInt(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, ushort & v) {v = s.takeWord().toUInt(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, ushort & v) {v = s.readWord().toUInt(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, int & v) {v = s.takeWord().toInt(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, int & v) {v = s.readWord().toInt(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, uint & v) {v = s.takeWord().toUInt(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, uint & v) {v = s.readWord().toUInt(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, llong & v) {v = s.takeWord().toLLong(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, llong & v) {v = s.readWord().toLLong(); return s;}
|
||||
|
||||
//! \~english Read word as integer
|
||||
//! \~russian Читает слово как целое
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, ullong & v) {v = s.takeWord().toULLong(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, ullong & v) {v = s.readWord().toULLong(); return s;}
|
||||
|
||||
//! \~english Read word as floating-point number
|
||||
//! \~russian Читает слово как число с плавающей точкой
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, float & v) {v = s.takeWord().toFloat(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, float & v) {v = s.readWord().toFloat(); return s;}
|
||||
|
||||
//! \~english Read word as floating-point number
|
||||
//! \~russian Читает слово как число с плавающей точкой
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, double & v) {v = s.takeWord().toDouble(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, double & v) {v = s.readWord().toDouble(); return s;}
|
||||
|
||||
|
||||
//! \~english Read word
|
||||
//! \~russian Читает слово
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, PIString & v) {v = s.takeWord(); return s;}
|
||||
template<typename P> inline PITextStream<P> & operator >>(PITextStream<P> & s, PIString & v) {v = s.readWord(); return s;}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user