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

@@ -31,7 +31,7 @@ class PIP_CLOUD_EXPORT PICloudClient: public PIIODevice, public PICloudBase
{ {
PIIODEVICE(PICloudClient) PIIODEVICE(PICloudClient)
public: public:
//! //! PICloudClient
explicit PICloudClient(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite); explicit PICloudClient(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
virtual ~PICloudClient(); virtual ~PICloudClient();

View File

@@ -31,7 +31,7 @@ class PIP_CLOUD_EXPORT PICloudServer: public PIIODevice, public PICloudBase
{ {
PIIODEVICE(PICloudServer) PIIODEVICE(PICloudServer)
public: public:
//! //! PICloudServer
explicit PICloudServer(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite); explicit PICloudServer(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
virtual ~PICloudServer(); virtual ~PICloudServer();

View File

@@ -1,4 +1,4 @@
/*! \file pivecto2d.h /*! \file pivector2d.h
* \brief 2D wrapper around PIVector * \brief 2D wrapper around PIVector
* *
* This file declares PIVector * This file declares PIVector

View File

@@ -37,7 +37,12 @@
class PIString; class PIString;
class PIByteArray; 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> class PIP_EXPORT PIByteArray: public PIDeque<uchar>
{ {
public: public:
@@ -87,14 +92,15 @@ public:
//! Return converted to Base 64 data //! Return converted to Base 64 data
PIByteArray toBase64() const; PIByteArray toBase64() const;
//! Return converted from Base 64 data
PIByteArray & compressRLE(uchar threshold = 192); PIByteArray & compressRLE(uchar threshold = 192);
PIByteArray & decompressRLE(uchar threshold = 192); PIByteArray & decompressRLE(uchar threshold = 192);
PIByteArray compressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.compressRLE(threshold); return ba;} 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;} PIByteArray decompressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.decompressRLE(threshold); return ba;}
PIString toString(int base = 16) const; 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; PIString toHex() const;
//! Add to the end data "data" with size "size" //! Add to the end data "data" with size "size"
@@ -106,10 +112,18 @@ public:
//! Add to the end "t" //! Add to the end "t"
PIByteArray & append(uchar t) {push_back(t); return *this;} 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; 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; uint checksumPlain32() const;
//! Returns hash //! Returns hash
@@ -122,7 +136,10 @@ public:
PIByteArray & operator =(PIByteArray && o) {swap(o); return *this;} PIByteArray & operator =(PIByteArray && o) {swap(o); return *this;}
static PIByteArray fromUserInput(PIString str); static PIByteArray fromUserInput(PIString str);
static PIByteArray fromHex(PIString str); static PIByteArray fromHex(PIString str);
//! Return converted from Base 64 data
static PIByteArray fromBase64(const PIByteArray & base64); static PIByteArray fromBase64(const PIByteArray & base64);
static PIByteArray fromBase64(const PIString & base64); static PIByteArray fromBase64(const PIString & base64);

View File

@@ -754,30 +754,30 @@ private:
}; };
//! \relatesalso PIString \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
PIP_EXPORT PICout operator <<(PICout s, const PIString & v); PIP_EXPORT PICout operator <<(PICout s, const PIString & v);
//! \relatesalso PIString \relatesalso PIByteArray \brief Output operator to PIByteArray //! \relatesalso PIByteArray \brief Output operator to PIByteArray
inline PIByteArray & operator <<(PIByteArray & s, const PIString & v) {s << *(PIDeque<PIChar>*)&v; return s;} inline PIByteArray & operator <<(PIByteArray & s, const PIString & v) {s << *(PIDeque<PIChar>*)&v; return s;}
//! \relatesalso PIString \relatesalso PIByteArray \brief Input operator from PIByteArray //! \relatesalso PIByteArray \brief Input operator from PIByteArray
inline PIByteArray & operator >>(PIByteArray & s, PIString & v) {v.clear(); s >> *(PIDeque<PIChar>*)&v; return s;} inline PIByteArray & operator >>(PIByteArray & s, PIString & v) {v.clear(); s >> *(PIDeque<PIChar>*)&v; return s;}
//! \relatesalso PIString \brief Return concatenated string //! \brief Return concatenated string
inline PIString operator +(const PIString & str, const PIString & f) {PIString s(str); s += f; return s;} inline PIString operator +(const PIString & str, const PIString & f) {PIString s(str); s += f; return s;}
//! \relatesalso PIString \brief Return concatenated string //! \brief Return concatenated string
inline PIString operator +(const PIString & f, const char * str) {PIString s(f); s += str; return s;} inline PIString operator +(const PIString & f, const char * str) {PIString s(f); s += str; return s;}
//! \relatesalso PIString \brief Return concatenated string //! \brief Return concatenated string
inline PIString operator +(const char * str, const PIString & f) {return PIString(str) + f;} inline PIString operator +(const char * str, const PIString & f) {return PIString(str) + f;}
//! \relatesalso PIString \brief Return concatenated string //! \relatesalso PIString \brief Return concatenated string
inline PIString operator +(const char c, const PIString & f) {return PIChar(c) + f;} inline PIString operator +(const char c, const PIString & f) {return PIChar(c) + f;}
//! \relatesalso PIString \brief Return concatenated string //! \brief Return concatenated string
inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);} inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);}

View File

@@ -76,7 +76,7 @@ public:
PIStringList & removeDuplicates(); PIStringList & removeDuplicates();
//! \brief Trim all strings //! \brief Trim all strings
//! \details Example: \snippet pistring.cpp PIStringList::trim //! \details Example: \snippet pistring.cpp PIString::trim
PIStringList & trim() {for (uint i = 0; i < size(); ++i) (*this)[i].trim(); return *this;} PIStringList & trim() {for (uint i = 0; i < size(); ++i) (*this)[i].trim(); return *this;}
//! Return sum of lengths of all strings //! Return sum of lengths of all strings
@@ -97,13 +97,13 @@ public:
}; };
//! \relatesalso PIStringList \relatesalso PIByteArray \brief Output operator to PIByteArray //! \relatesalso PIByteArray \brief Output operator to PIByteArray
inline PIByteArray & operator <<(PIByteArray & s, const PIStringList & v) {s << int(v.size_s()); for (int i = 0; i < v.size_s(); ++i) s << v[i]; return s;} inline PIByteArray & operator <<(PIByteArray & s, const PIStringList & v) {s << int(v.size_s()); for (int i = 0; i < v.size_s(); ++i) s << v[i]; return s;}
//! \relatesalso PIStringList \relatesalso PIByteArray \brief Input operator from PIByteArray //! relatesalso PIByteArray \brief Input operator from PIByteArray
inline PIByteArray & operator >>(PIByteArray & s, PIStringList & v) {int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} inline PIByteArray & operator >>(PIByteArray & s, PIStringList & v) {int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;}
//! \relatesalso PIStringList \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;} inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
#endif // PISTRINGLIST_H #endif // PISTRINGLIST_H

View File

@@ -167,7 +167,7 @@ private:
}; };
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;} inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;}
@@ -191,7 +191,7 @@ inline bool operator !=(const PITime & t0, const PITime & t1) {return !(t0 == t1
inline bool operator <=(const PITime & t0, const PITime & t1) {return !(t0 > t1);} inline bool operator <=(const PITime & t0, const PITime & t1) {return !(t0 > t1);}
inline bool operator >=(const PITime & t0, const PITime & t1) {return !(t0 < t1);} inline bool operator >=(const PITime & t0, const PITime & t1) {return !(t0 < t1);}
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
PIP_EXPORT PICout operator <<(PICout s, const PITime & v); PIP_EXPORT PICout operator <<(PICout s, const PITime & v);
@@ -213,7 +213,7 @@ inline bool operator !=(const PIDate & t0, const PIDate & t1) {return !(t0 == t1
inline bool operator <=(const PIDate & t0, const PIDate & t1) {return !(t0 > t1);} inline bool operator <=(const PIDate & t0, const PIDate & t1) {return !(t0 > t1);}
inline bool operator >=(const PIDate & t0, const PIDate & t1) {return !(t0 < t1);} inline bool operator >=(const PIDate & t0, const PIDate & t1) {return !(t0 < t1);}
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
PIP_EXPORT PICout operator <<(PICout s, const PIDate & v); PIP_EXPORT PICout operator <<(PICout s, const PIDate & v);
@@ -258,7 +258,7 @@ inline bool operator >=(const PIDateTime & t0, const PIDateTime & t1) {return !(
inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v.year << v.month << v.day << v.hours << v.minutes << v.seconds << v.milliseconds; return s;} inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v.year << v.month << v.day << v.hours << v.minutes << v.seconds << v.milliseconds; return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;} inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;}
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout //! \relatesalso PICout \brief Output operator to PICout
PIP_EXPORT PICout operator <<(PICout s, const PIDateTime & v); PIP_EXPORT PICout operator <<(PICout s, const PIDateTime & v);

View File

@@ -324,7 +324,7 @@ private:
PIByteArray user_header; PIByteArray user_header;
}; };
//! \relatesalso PICout \relatesalso PIBinaryLog::BinLogInfo \brief Output operator to PICout //! \relatesalso PICout \brief Output operator PIBinaryLog::BinLogInfo to PICout
inline PICout operator <<(PICout s, const PIBinaryLog::BinLogInfo & bi) { inline PICout operator <<(PICout s, const PIBinaryLog::BinLogInfo & bi) {
s.space(); s.space();
s.setControl(0, true); s.setControl(0, true);

View File

@@ -45,7 +45,7 @@
* Application should use class \a PIPluginLoader to load * Application should use class \a PIPluginLoader to load
* plugin. Main function is \a load(PIString name). * plugin. Main function is \a load(PIString name).
* "name" is base name of library, %PIPluginLoader * "name" is base name of library, %PIPluginLoader
* try to use sevaral names, <name>, lib<name> and * try to use sevaral names, \<name\>, lib\<name\> and
* "dll", "so" and "dylib" extensions, depends on system. * "dll", "so" and "dylib" extensions, depends on system.
* For example: * For example:
* \code * \code

View File

@@ -87,6 +87,7 @@ public:
* exceeding the queue's capacity, returning true upon success and false if this queue is full. * exceeding the queue's capacity, returning true upon success and false if this queue is full.
* *
* @param v the element to add * @param v the element to add
* @param timeoutMs the timeout waiting for inserting if que is full, if timeout = 0, then returns immediately
* @return true if the element was added to this queue, else false * @return true if the element was added to this queue, else false
*/ */
bool offer(const T & v, int timeoutMs = 0) { bool offer(const T & v, int timeoutMs = 0) {

View File

@@ -2,6 +2,7 @@
#include "piresources.h" #include "piresources.h"
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
#define CL_TARGET_OPENCL_VERSION 120
#ifdef MAC_OS #ifdef MAC_OS
# include "cl.h" # include "cl.h"
#else #else