From 9c68588447c13d42df62ebf315a278ed3a62e163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Wed, 30 Aug 2017 09:52:50 +0000 Subject: [PATCH] commit request git-svn-id: svn://db.shs.com.ru/pip@537 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/code/picodeparser.cpp | 4 +-- src_main/core/pibytearray.cpp | 2 +- src_main/core/pibytearray.h | 2 +- src_main/core/pistring.h | 58 +++++++++++++++++----------------- src_main/io/piconnection.cpp | 6 ++-- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src_main/code/picodeparser.cpp b/src_main/code/picodeparser.cpp index 5377c936..b1aad987 100755 --- a/src_main/code/picodeparser.cpp +++ b/src_main/code/picodeparser.cpp @@ -31,7 +31,7 @@ PIString PICodeParser::Macro::expand(PIString args_, bool * ok) const { } PIString ca; if (bi >= 0 && bi < ci) { - ca = args_.left(args_.takeLeft(bi)); + ca = args_.left(args_.takeLeft(bi).toInt()); ci -= ca.size_s(); bi -= ca.size_s(); ca += "(" + args_.takeRange("(", ")") + ")"; } else { @@ -311,7 +311,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) { str = pfc.takeLeft(sci + 1); } else { str = pfc.takeLeft(obi); - pfc.cutLeft(pfc.takeRange("{", "}")); + pfc.cutLeft(pfc.takeRange("{", "}").toInt()); } parseMember(&root_, str); } diff --git a/src_main/core/pibytearray.cpp b/src_main/core/pibytearray.cpp index 00eb3d23..3a493cc3 100755 --- a/src_main/core/pibytearray.cpp +++ b/src_main/core/pibytearray.cpp @@ -307,7 +307,7 @@ PIString PIByteArray::toHex() const { } -PIByteArray PIByteArray::fromString(PIString str) { +PIByteArray PIByteArray::fromUserInput(PIString str) { PIByteArray ret; if (str.trim().isEmpty()) return ret; str.replaceAll("\n", " ").replaceAll("\t", " ").replaceAll(" ", " "); diff --git a/src_main/core/pibytearray.h b/src_main/core/pibytearray.h index 082c2187..c1b6b7c6 100755 --- a/src_main/core/pibytearray.h +++ b/src_main/core/pibytearray.h @@ -122,7 +122,7 @@ public: void operator =(const PIDeque & d) {resize(d.size()); memcpy(data(), d.data(), d.size());} - static PIByteArray fromString(PIString str); + static PIByteArray fromUserInput(PIString str); static PIByteArray fromHex(PIString str); static PIByteArray fromBase64(const PIByteArray & base64); static PIByteArray fromBase64(const PIString & base64); diff --git a/src_main/core/pistring.h b/src_main/core/pistring.h index d859081f..bcba33e3 100755 --- a/src_main/core/pistring.h +++ b/src_main/core/pistring.h @@ -42,7 +42,7 @@ public: PIString & operator +=(const PIChar & c) {push_back(c); return *this;} PIString & operator +=(const char * str); PIString & operator +=(const wchar_t * str); - PIString & operator +=(const PIByteArray & ba) {appendFromChars((const char * )ba.data(), ba.size_s()); return *this;} +// PIString & operator +=(const PIByteArray & ba) {appendFromChars((const char * )ba.data(), ba.size_s()); return *this;} PIString & operator +=(const PIString & str); //PIString(const char c) {*this += c;} @@ -82,16 +82,16 @@ public: PIString(const int len, const PIChar & c): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; for (int i = 0; i < len; ++i) push_back(c);} - PIString(const short & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const ushort & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const int & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const uint & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const long & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const ulong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const llong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const ullong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const float & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} - PIString(const double & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const short & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const ushort & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const int & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const uint & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const long & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const ulong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const llong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const ullong & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const float & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} +// PIString(const double & value): PIDeque() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);} //~PIString() {piMonitor.strings--; piMonitor.containers++;} @@ -173,23 +173,23 @@ public: bool operator >=(const char * str) const {return *this >= PIString(str);} - operator bool() const {return toBool();} - operator short() const {return toShort();} - operator ushort() const {return toUShort();} - operator int() const {return toInt();} - operator uint() const {return toUInt();} - operator long() const {return toLong();} - operator ulong() const {return toULong();} - operator llong() const {return toLLong();} - operator ullong() const {return toULLong();} - operator float() const {return toFloat();} - operator double() const {return toDouble();} +// operator bool() const {return toBool();} +// operator short() const {return toShort();} +// operator ushort() const {return toUShort();} +// operator int() const {return toInt();} +// operator uint() const {return toUInt();} +// operator long() const {return toLong();} +// operator ulong() const {return toULong();} +// operator llong() const {return toLLong();} +// operator ullong() const {return toULLong();} +// operator float() const {return toFloat();} +// operator double() const {return toDouble();} /*! \brief Append string "str" at the end of string * \details Example: \snippet pistring.cpp PIString::<<(PIString) */ PIString & operator <<(const PIString & str) {*this += str; return *this;} - //inline PIString & operator <<(const char c) {*this += c; return *this;} +// inline PIString & operator <<(const char c) {*this += c; return *this;} /*! \brief Append symbol "c" at the end of string * \details Example: \snippet pistring.cpp PIString::<<(PIChar) */ @@ -800,13 +800,13 @@ public: PIStringList & operator <<(const PIString & str) {push_back(str); return *this;} PIStringList & operator <<(const PIStringList & sl) {piForeachC (PIString & i, sl) push_back(i); return *this;} - //inline PIStringList & operator <<(const char c) {push_back(PIString(c)); return *this;} +// inline PIStringList & operator <<(const char c) {push_back(PIString(c)); return *this;} PIStringList & operator <<(const char * str) {push_back(PIString(str)); return *this;} - PIStringList & operator <<(const int & num) {push_back(PIString::fromNumber(num)); return *this;} - PIStringList & operator <<(const short & num) {push_back(PIString::fromNumber(num)); return *this;} - PIStringList & operator <<(const long & num) {push_back(PIString::fromNumber(num)); return *this;} - PIStringList & operator <<(const float & num) {push_back(PIString::fromNumber(num)); return *this;} - PIStringList & operator <<(const double & num) {push_back(PIString::fromNumber(num)); return *this;} +// PIStringList & operator <<(const int & num) {push_back(PIString::fromNumber(num)); return *this;} +// PIStringList & operator <<(const short & num) {push_back(PIString::fromNumber(num)); return *this;} +// PIStringList & operator <<(const long & num) {push_back(PIString::fromNumber(num)); return *this;} +// PIStringList & operator <<(const float & num) {push_back(PIString::fromNumber(num)); return *this;} +// PIStringList & operator <<(const double & num) {push_back(PIString::fromNumber(num)); return *this;} }; diff --git a/src_main/io/piconnection.cpp b/src_main/io/piconnection.cpp index 1b5b65d3..c802effd 100755 --- a/src_main/io/piconnection.cpp +++ b/src_main/io/piconnection.cpp @@ -229,8 +229,8 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) { pe->setPayloadSize(e->getValue("payloadSize", pe->payloadSize())); pe->setPacketSize(e->getValue("packetSize", pe->packetSize())); pe->setTimeout(e->getValue("timeout", pe->timeout())); - pe->setHeader(PIByteArray::fromString(e->getValue("header", "").value())); - pe->setFooter(PIByteArray::fromString(e->getValue("footer", "").value())); + pe->setHeader(PIByteArray::fromUserInput(e->getValue("header", "").value())); + pe->setFooter(PIByteArray::fromUserInput(e->getValue("footer", "").value())); } } setDebug(pdebug); @@ -251,7 +251,7 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) { float freq = e->getValue("frequency"); piForeachC (PIString & d, devs) addSender(e->name(), dev_aliases.value(d, d), freq); - PIByteArray fd(PIByteArray::fromString(e->getValue("fixedData").value())); + PIByteArray fd(PIByteArray::fromUserInput(e->getValue("fixedData").value())); setSenderFixedData(e->name(), fd); } return true;