git-svn-id: svn://db.shs.com.ru/pip@780 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-04-18 06:24:26 +00:00
parent b6801457ba
commit 93b62ba1b8
3 changed files with 58 additions and 4 deletions

View File

@@ -209,7 +209,17 @@ inline PIByteArray & operator >>(PIByteArray & s, ldouble & v) {assert(s.size()
//! \relatesalso PIByteArray \brief Restore operator
template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIFlags<T> & v) {PBA_OPERATOR_FROM return s;}
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); if (sz > 0) memcpy(v.data(), s.data(), v.size()); s.remove(0, v.size()); return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {
assert(s.size_s() >= 4);
int sz; s >> sz;
if (sz > s.size_s()) {
piCout << "[PIByteArray] Warning: operator >> want too much data!";
sz = s.size_s();
}
v.resize(sz);
if (sz > 0) memcpy(v.data(), s.data(), v.size());
s.remove(0, v.size());
return s;}
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {assert(s.size_s() >= v.s); if (v.s > 0) memcpy((void*)(v.d), s.data(), v.s); s.remove(0, v.s); return s;}