PIByteArray works on binary stream
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#ifndef PIBINARYSTREAM_H
|
||||
#define PIBINARYSTREAM_H
|
||||
|
||||
#include "pimemoryblock.h"
|
||||
#include "pibitarray.h"
|
||||
#include "pimap.h"
|
||||
#include "pivector2d.h"
|
||||
@@ -86,7 +87,7 @@ template<typename P, typename T> inline PIBinaryStream<P> & operator <<(PIBinary
|
||||
template<typename P, typename T> inline PIBinaryStream<P> & operator >>(PIBinaryStreamTrivialRef<P> s, T & v) {s.p >> v; return s.p;}
|
||||
|
||||
|
||||
// small types
|
||||
// specify types
|
||||
template<typename P> inline PIBinaryStreamTrivialRef<P> operator <<(PIBinaryStream<P> & s, const bool v) {s.binaryStreamAppend((uchar)v); return s;}
|
||||
template<typename P> inline PIBinaryStreamTrivialRef<P> operator <<(PIBinaryStream<P> & s, const char v) {s.binaryStreamAppend((uchar)v); return s;}
|
||||
template<typename P> inline PIBinaryStreamTrivialRef<P> operator <<(PIBinaryStream<P> & s, const uchar v) {s.binaryStreamAppend((uchar)v); return s;}
|
||||
@@ -94,6 +95,15 @@ template<typename P> inline PIBinaryStreamTrivialRef<P> operator >>(PIBinaryStre
|
||||
template<typename P> inline PIBinaryStreamTrivialRef<P> operator >>(PIBinaryStream<P> & s, char & v) {v = s.binaryStreamTakeByte(); return s;}
|
||||
template<typename P> inline PIBinaryStreamTrivialRef<P> operator >>(PIBinaryStream<P> & s, uchar & v) {v = s.binaryStreamTakeByte(); return s;}
|
||||
|
||||
template<typename P> inline PIBinaryStream<P> & operator <<(PIBinaryStream<P> & s, const PIMemoryBlock v) {
|
||||
s.binaryStreamAppend(v.data(), v.size());
|
||||
return s;
|
||||
}
|
||||
template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, PIMemoryBlock v) {
|
||||
s.binaryStreamTake(v.data(), v.size());
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -308,7 +318,18 @@ inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, PIVector2D<T> & v)
|
||||
v = PIVector2D<T>(r, c, tmp);
|
||||
return s;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
//! \~english Restore operator
|
||||
//! \~russian Оператор извлечения
|
||||
template<typename P>
|
||||
inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, PIBitArray & v) {s >> v.size_ >> v.data_; return s;}
|
||||
|
||||
|
||||
//! \~english Restore operator
|
||||
//! \~russian Оператор извлечения
|
||||
template<typename P, typename Type0, typename Type1>
|
||||
inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, PIPair<Type0, Type1> & v) {s >> v.first >> v.second; return s;}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user