fix some warnings, add some doc

This commit is contained in:
2021-08-04 14:31:36 +03:00
parent cba6db4f38
commit 0c7ce272e6
11 changed files with 44 additions and 25 deletions

View File

@@ -37,7 +37,12 @@
class PIString;
class PIByteArray;
/*! \brief The PIByteArray class provides an array of bytes
* \details PIByteArray used to store raw bytes.
* It can be constructed from any data and size.
* You can use PIByteArray as binary stream
* to serialize/deserialize any objects and data.
*/
class PIP_EXPORT PIByteArray: public PIDeque<uchar>
{
public:
@@ -87,14 +92,15 @@ public:
//! Return converted to Base 64 data
PIByteArray toBase64() const;
//! Return converted from Base 64 data
PIByteArray & compressRLE(uchar threshold = 192);
PIByteArray & decompressRLE(uchar threshold = 192);
PIByteArray compressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.compressRLE(threshold); return ba;}
PIByteArray decompressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.decompressRLE(threshold); return ba;}
PIString toString(int base = 16) const;
//! Returns a hex encoded copy of the byte array.
//! The hex encoding uses the numbers 0-9 and the letters a-f.
PIString toHex() const;
//! Add to the end data "data" with size "size"
@@ -106,10 +112,18 @@ public:
//! Add to the end "t"
PIByteArray & append(uchar t) {push_back(t); return *this;}
//! Returns plain 8-bit checksum
//! Returns 8-bit checksum
//! sum all bytes, add 1, inverse
//! Pseudocode:
//! sum += at(i);
//! return ~(sum + 1)
uchar checksumPlain8() const;
//! Returns plain 32-bit checksum
//! Returns 32-bit checksum
//! sum all bytes multiplyed by index+1, add 1, inverse
//! Pseudocode:
//! sum += at(i) * (i + 1);
//! return ~(sum + 1)
uint checksumPlain32() const;
//! Returns hash
@@ -122,7 +136,10 @@ public:
PIByteArray & operator =(PIByteArray && o) {swap(o); return *this;}
static PIByteArray fromUserInput(PIString str);
static PIByteArray fromHex(PIString str);
//! Return converted from Base 64 data
static PIByteArray fromBase64(const PIByteArray & base64);
static PIByteArray fromBase64(const PIString & base64);