version 2.98.0
remove PIFile::readLine() partially migrate PIConfig to text stream add more "override"
This commit is contained in:
@@ -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