PIByteArray works on binary stream

This commit is contained in:
2022-05-10 15:23:18 +03:00
parent 0f9e592273
commit b2bc385397
58 changed files with 254 additions and 923 deletions

View File

@@ -6,22 +6,6 @@
using namespace PICoutManipulators;
class ByteArray: public PIBinaryStream<ByteArray> {
public:
PIByteArray data;
bool binaryStreamAppendImp(const void * d, size_t s) {
data.append(d, s);
return true;
}
bool binaryStreamTakeImp(void * d, size_t s) {
if (data.size() < s)
return false;
memcpy(d, data.data(), s);
data.remove(0, s);
return true;
}
};
class File: public PIBinaryStream<File> {
public:
PIFile file;
@@ -50,7 +34,7 @@ template<typename P> inline PIBinaryStream<P> & operator <<(PIBinaryStream<P> &
template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, TS & v) {s >> v.i; return s;}
int main(int argc, char * argv[]) {
ByteArray ba;
PIByteArray ba;
/*ProcessStatsFixed_ ps;
ba << ps;
piCout << "s" << ba.data;*/
@@ -78,12 +62,12 @@ int main(int argc, char * argv[]) {
piCout << map;
ba << map;
piCout << ba.data;
piCout << ba;
map.clear();
ba >> map;
piCout << map;
piCout << ba.data;
piCout << ba;
return 0;
}