rename doc macros

This commit is contained in:
2021-08-04 16:31:32 +03:00
parent 0c7ce272e6
commit 25def958a1
140 changed files with 963 additions and 983 deletions

View File

@@ -1,5 +1,5 @@
/*! \file pibytearray.h
* \brief Byte array
/*! @file pibytearray.h
* @brief Byte array
*/
/*
PIP - Platform Independent Primitives
@@ -37,12 +37,45 @@
class PIString;
class PIByteArray;
/*! \brief The PIByteArray class provides an array of bytes
* \details PIByteArray used to store raw bytes.
/*! @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.
* This class based on PIDeque<uchar> and provide some handle function
* to manipulate it.
*
* @section PIByteArray_sec0 Usage
* %PIByteArray can be used to store custom data and manipulate it. There are many
* stream operators to store/restore common types to byte array. Store operators
* places data at the end of array, restore operators takes data from the beginning
* of array.
* In addition there are Hex and Base64 convertions
*
* One of the major usage of %PIByteArray is stream functions. You can form binary
* packet from many types (also dynamic types, e.g. PIVector) with one line:
* @snippet pibytearray.cpp 0
*
* Or you can descibe stream operator of your own type and store/restore vectors of
* your type:
* @snippet pibytearray.cpp 1
*
* For store/restore custom data blocks there is PIByteArray::RawData class. Stream
* operators of this class simply store/restore data block to/from byte array.
* @snippet pibytearray.cpp 2
*
* @section PIByteArray_sec1 Attention
* Stream operator of %PIByteArray store byte array as vector, not simply append
* content of byte array. This operators useful to transmit custom data as %PIByteArray
* packed into parent byte array, e.g. to form packet from %PIByteArray.
* To append one byte array to another use funtion \a append().
* @snippet pibytearray.cpp 3
*
*
*/
class PIP_EXPORT PIByteArray: public PIDeque<uchar>
{
public:
@@ -154,7 +187,7 @@ public:
};
//! \relatesalso PIByteArray \brief Byte arrays compare operator
//! \relatesalso PIByteArray @brief Byte arrays compare operator
inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {
if (v0.size() == v1.size()) {
for (uint i = 0; i < v0.size(); ++i)
@@ -165,7 +198,7 @@ inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {
return v0.size() < v1.size();
}
//! \relatesalso PIByteArray \brief Byte arrays compare operator
//! \relatesalso PIByteArray @brief Byte arrays compare operator
inline bool operator ==(PIByteArray & f, PIByteArray & s) {
if (f.size_s() != s.size_s())
return false;
@@ -175,7 +208,7 @@ inline bool operator ==(PIByteArray & f, PIByteArray & s) {
return true;
}
//! \relatesalso PIByteArray \brief Byte arrays compare operator
//! \relatesalso PIByteArray @brief Byte arrays compare operator
inline bool operator !=(PIByteArray & f, PIByteArray & s) {
if (f.size_s() != s.size_s())
return true;
@@ -186,11 +219,11 @@ inline bool operator !=(PIByteArray & f, PIByteArray & s) {
}
#ifdef PIP_STD_IOSTREAM
//! \relatesalso PIByteArray \brief Output to std::ostream operator
//! \relatesalso PIByteArray @brief Output to std::ostream operator
inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba);
#endif
//! \relatesalso PIByteArray \brief Output to PICout operator
//! \relatesalso PIByteArray @brief Output to PICout operator
PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba);
@@ -199,16 +232,16 @@ PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba);
// store operators for basic types
//! \relatesalso PIByteArray \brief Store operator
//! \relatesalso PIByteArray @brief Store operator
inline PIByteArray & operator <<(PIByteArray & s, const bool v) {s.push_back(v); return s;}
//! \relatesalso PIByteArray \brief Store operator
//! \relatesalso PIByteArray @brief Store operator
inline PIByteArray & operator <<(PIByteArray & s, const char v) {s.push_back(v); return s;}
//! \relatesalso PIByteArray \brief Store operator
//! \relatesalso PIByteArray @brief Store operator
inline PIByteArray & operator <<(PIByteArray & s, const uchar v) {s.push_back(v); return s;}
//! \relatesalso PIByteArray \brief Store operator for any trivial copyable type
//! \relatesalso PIByteArray @brief Store operator for any trivial copyable type
template<typename T, typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray::StreamRef operator <<(PIByteArray & s, const T & v) {
int os = s.size_s();
@@ -217,10 +250,10 @@ inline PIByteArray::StreamRef operator <<(PIByteArray & s, const T & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator, see \ref PIByteArray_sec1 for details
//! \relatesalso PIByteArray @brief Store operator, see \ref PIByteArray_sec1 for details
PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PIByteArray & v);
//! \relatesalso PIByteArray \brief Store operator, see \ref PIByteArray_sec1 for details
//! \relatesalso PIByteArray @brief Store operator, see \ref PIByteArray_sec1 for details
inline PIByteArray & operator <<(PIByteArray & s, const PIByteArray::RawData & v) {
int os = s.size_s();
if (v.s > 0) {
@@ -230,7 +263,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIByteArray::RawData & v
return s;
}
//! \relatesalso PIByteArray \brief Store operator for PIVector of any trivial copyable type
//! \relatesalso PIByteArray @brief Store operator for PIVector of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -252,7 +285,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator for PIDeque of any trivial copyable type
//! \relatesalso PIByteArray @brief Store operator for PIDeque of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -274,7 +307,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator for PIVector2D of any trivial copyable type
//! \relatesalso PIByteArray @brief Store operator for PIVector2D of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -295,10 +328,10 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIVector2D<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator
//! \relatesalso PIByteArray @brief Store operator
inline PIByteArray & operator <<(PIByteArray & s, const PIBitArray & v) {s << v.size_ << v.data_; return s;}
//! \relatesalso PIPair \brief Store operator
//! \relatesalso PIPair @brief Store operator
template<typename Type0, typename Type1>
inline PIByteArray & operator <<(PIByteArray & s, const PIPair<Type0, Type1> & v) {s << v.first << v.second; return s;}
@@ -308,16 +341,16 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIPair<Type0, Type1> & v
// restore operators for basic types
//! \relatesalso PIByteArray \brief Restore operator
//! \relatesalso PIByteArray @brief Restore operator
inline PIByteArray & operator >>(PIByteArray & s, bool & v) {assert(s.size() >= 1u); v = s.take_front(); return s;}
//! \relatesalso PIByteArray \brief Restore operator
//! \relatesalso PIByteArray @brief Restore operator
inline PIByteArray & operator >>(PIByteArray & s, char & v) {assert(s.size() >= 1u); v = s.take_front(); return s;}
//! \relatesalso PIByteArray \brief Restore operator
//! \relatesalso PIByteArray @brief Restore operator
inline PIByteArray & operator >>(PIByteArray & s, uchar & v) {assert(s.size() >= 1u); v = s.take_front(); return s;}
//! \relatesalso PIByteArray \brief Restore operator for any trivial copyable type
//! \relatesalso PIByteArray @brief Restore operator for any trivial copyable type
template<typename T, typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray::StreamRef operator >>(PIByteArray & s, T & v) {
if (s.size() < sizeof(v)) {
@@ -329,10 +362,10 @@ inline PIByteArray::StreamRef operator >>(PIByteArray & s, T & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
//! \relatesalso PIByteArray @brief Restore operator, see \ref PIByteArray_sec1 for details
PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PIByteArray & v);
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
//! \relatesalso PIByteArray @brief Restore operator, see \ref PIByteArray_sec1 for details
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {
if (s.size_s() < v.s) {
printf("error with RawData %d < %d\n", (int)s.size_s(), v.s);
@@ -345,7 +378,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator for PIVector of any trivial copyable type
//! \relatesalso PIByteArray @brief Restore operator for PIVector of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -376,7 +409,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator for PIDeque of any trivial copyable type
//! \relatesalso PIByteArray @brief Restore operator for PIDeque of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -407,7 +440,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator for PIVector2D of any trivial copyable type
//! \relatesalso PIByteArray @brief Restore operator for PIVector2D of any trivial copyable type
template<typename T,
typename std::enable_if< std::is_trivially_copyable<T>::value, int>::type = 0,
typename std::enable_if< std::is_same<decltype(std::declval<PIByteArray&>() << std::declval<const T &>()), PIByteArray::StreamRef>::value, int>::type = 0>
@@ -440,10 +473,10 @@ inline PIByteArray & operator >>(PIByteArray & s, PIVector2D<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator
//! \relatesalso PIByteArray @brief Restore operator
inline PIByteArray & operator >>(PIByteArray & s, PIBitArray & v) {assert(s.size_s() >= 8); s >> v.size_ >> v.data_; return s;}
//! \relatesalso PIPair \brief Restore operator
//! \relatesalso PIPair @brief Restore operator
template<typename Type0, typename Type1>
inline PIByteArray & operator >>(PIByteArray & s, PIPair<Type0, Type1> & v) {s >> v.first >> v.second; return s;}
@@ -453,7 +486,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIPair<Type0, Type1> & v) {s >
// store operators for complex types
//! \relatesalso PIByteArray \brief Store operator for PIVector of any compound type
//! \relatesalso PIByteArray @brief Store operator for PIVector of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v) {
s << int(v.size_s());
@@ -461,7 +494,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator for PIDeque of any compound type
//! \relatesalso PIByteArray @brief Store operator for PIDeque of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v) {
s << int(v.size_s());
@@ -469,7 +502,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Store operator for PIVector2D of any compound type
//! \relatesalso PIByteArray @brief Store operator for PIVector2D of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator <<(PIByteArray & s, const PIVector2D<T> & v) {
s << int(v.rows()) << int(v.cols()) << v.toPlainVector();
@@ -482,7 +515,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIVector2D<T> & v) {
// restore operators for complex types
//! \relatesalso PIByteArray \brief Restore operator for PIVector of any compound type
//! \relatesalso PIByteArray @brief Restore operator for PIVector of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v) {
if (s.size_s() < 4) {
@@ -495,7 +528,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator for PIDeque of any compound type
//! \relatesalso PIByteArray @brief Restore operator for PIDeque of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v) {
if (s.size_s() < 4) {
@@ -508,7 +541,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v) {
return s;
}
//! \relatesalso PIByteArray \brief Restore operator for PIVector2D of any compound type
//! \relatesalso PIByteArray @brief Restore operator for PIVector2D of any compound type
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator >>(PIByteArray & s, PIVector2D<T> & v) {
if (s.size_s() < 8) {