This commit is contained in:
2022-11-25 21:35:39 +03:00
parent a2256a3872
commit dc6fbbf7ec
37 changed files with 1498 additions and 1321 deletions

View File

@@ -1,5 +1,5 @@
/*! \file pibinarystream.h /*! \file pibinarystream.h
* \ingroup Core * \ingroup Serialization
* \~\brief * \~\brief
* \~english Binary serialization interface * \~english Binary serialization interface
* \~russian Интерфейс бинарной сериализации * \~russian Интерфейс бинарной сериализации
@@ -42,7 +42,7 @@
template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, T & v) template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, T & v)
//! \ingroup Core //! \ingroup Serialization
//! \~\brief //! \~\brief
//! \~english Binary serialization interface. //! \~english Binary serialization interface.
//! \~russian Интерфейс бинарной сериализации. //! \~russian Интерфейс бинарной сериализации.

View File

@@ -1,5 +1,5 @@
/*! \file pichunkstream.h /*! \file pichunkstream.h
* \ingroup Core * \ingroup Serialization
* \~\brief * \~\brief
* \~english Binary markup de/serializator stream * \~english Binary markup de/serializator stream
* \~russian Бинарный поток для де/сериализации с разметкой * \~russian Бинарный поток для де/сериализации с разметкой
@@ -29,7 +29,7 @@
#include "pibytearray.h" #include "pibytearray.h"
//! \ingroup Core //! \ingroup Serialization
//! \~\brief //! \~\brief
//! \~english Class for binary de/serialization. //! \~english Class for binary de/serialization.
//! \~russian Класс для бинарной де/сериализации. //! \~russian Класс для бинарной де/сериализации.

View File

@@ -1,5 +1,5 @@
/*! \file pijson.h /*! \file pijson.h
* \ingroup Core * \ingroup Serialization
* \brief * \brief
* \~english JSON class * \~english JSON class
* \~russian Класс JSON * \~russian Класс JSON
@@ -29,7 +29,7 @@
#include "pivariant.h" #include "pivariant.h"
//! \ingroup Core //! \ingroup Serialization
//! \~\brief //! \~\brief
//! \~english JSON class. //! \~english JSON class.
//! \~russian Класс JSON. //! \~russian Класс JSON.

View File

@@ -0,0 +1,58 @@
/*
PIP - Platform Independent Primitives
Module includes
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//! \defgroup Serialization Serialization
//! \~\brief
//! \~english Serialization.
//! \~russian Сериализация.
//!
//! \~\details
//! \~english \section cmake_module_Serialization Building with CMake
//! \~russian \section cmake_module_Serialization Сборка с использованием CMake
//!
//! \~\code
//! find_package(PIP REQUIRED)
//! target_link_libraries([target] PIP)
//! \endcode
//!
//! \~english \par Common
//! \~russian \par Общее
//!
//! \~english
//!
//!
//! \~russian
//!
//!
//! \~\authors
//! \~english
//! Ivan Pelipenko peri4ko@yandex.ru;
//! Andrey Bychkov work.a.b@yandex.ru;
//! \~russian
//! Иван Пелипенко peri4ko@yandex.ru;
//! Андрей Бычков work.a.b@yandex.ru;
//!
#ifndef PISERIALIZATIONMODULE_H
#define PISERIALIZATIONMODULE_H
#include "pibinarystream.h"
#include "pichunkstream.h"
#include "pijson.h"
#endif // PISERIALIZATIONMODULE_H

View File

@@ -1,5 +1,5 @@
/*! \file pichar.h /*! \file pichar.h
* \ingroup Core * \ingroup Text
* \~\brief * \~\brief
* \~english Single string character * \~english Single string character
* \~russian Один символ строки * \~russian Один символ строки
@@ -32,7 +32,7 @@ extern PIP_EXPORT char * __syslocname__;
extern PIP_EXPORT char * __sysoemname__; extern PIP_EXPORT char * __sysoemname__;
extern PIP_EXPORT char * __utf8name__; extern PIP_EXPORT char * __utf8name__;
//! \ingroup Core //! \ingroup Text
//! \~\brief //! \~\brief
//! \~english %PIChar represents a single character. //! \~english %PIChar represents a single character.
//! \~russian %PIChar представляет собой один символ строки. //! \~russian %PIChar представляет собой один символ строки.

View File

@@ -1,5 +1,5 @@
/*! \file piconstchars.h /*! \file piconstchars.h
* \ingroup Core * \ingroup Text
* \brief * \brief
* \~english C-String class * \~english C-String class
* \~russian Класс C-строки * \~russian Класс C-строки
@@ -29,7 +29,7 @@
#include "picout.h" #include "picout.h"
//! \ingroup Core //! \ingroup Text
//! \~\brief //! \~\brief
//! \~english C-String class. //! \~english C-String class.
//! \~russian Класс C-строки. //! \~russian Класс C-строки.

View File

@@ -1,5 +1,5 @@
/*! \file pistring.h /*! \file pistring.h
* \ingroup Core * \ingroup Text
* \brief * \brief
* \~english String class * \~english String class
* \~russian Класс строки * \~russian Класс строки
@@ -34,7 +34,7 @@
class PIStringList; class PIStringList;
//! \ingroup Core //! \ingroup Text
//! \~\brief //! \~\brief
//! \~english String class. //! \~english String class.
//! \~russian Класс строки. //! \~russian Класс строки.

View File

@@ -1,5 +1,5 @@
/*! \file pistring_std.h /*! \file pistring_std.h
* \ingroup Core * \ingroup Text
* \brief * \brief
* \~english STD convertions for PIString * \~english STD convertions for PIString
* \~russian Преобразования в/из STD для строки * \~russian Преобразования в/из STD для строки

View File

@@ -1,5 +1,5 @@
/*! \file pistringlist.h /*! \file pistringlist.h
* \ingroup Core * \ingroup Text
* \~\brief * \~\brief
* \~english Based on \a PIDeque<PIString> strings list * \~english Based on \a PIDeque<PIString> strings list
* \~russian Основанный на \a PIDeque<PIString> массив строк * \~russian Основанный на \a PIDeque<PIString> массив строк
@@ -29,7 +29,7 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup Core //! \ingroup Text
//! \~\brief //! \~\brief
//! \~english Based on \a PIDeque<PIString> strings list. //! \~english Based on \a PIDeque<PIString> strings list.
//! \~russian Основанный на \a PIDeque<PIString> массив строк. //! \~russian Основанный на \a PIDeque<PIString> массив строк.

View File

@@ -0,0 +1,58 @@
/*
PIP - Platform Independent Primitives
Module includes
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//! \defgroup Text Text
//! \~\brief
//! \~english String classes.
//! \~russian Классы строк.
//!
//! \~\details
//! \~english \section cmake_module_Text Building with CMake
//! \~russian \section cmake_module_Text Сборка с использованием CMake
//!
//! \~\code
//! find_package(PIP REQUIRED)
//! target_link_libraries([target] PIP)
//! \endcode
//!
//! \~english \par Common
//! \~russian \par Общее
//!
//! \~english
//!
//!
//! \~russian
//!
//!
//! \~\authors
//! \~english
//! Ivan Pelipenko peri4ko@yandex.ru;
//! Andrey Bychkov work.a.b@yandex.ru;
//! \~russian
//! Иван Пелипенко peri4ko@yandex.ru;
//! Андрей Бычков work.a.b@yandex.ru;
//!
#ifndef PITEXTMODULE_H
#define PITEXTMODULE_H
#include "pistringlist.h"
#include "piconstchars.h"
#include "pitextstream.h"
#endif // PITEXTMODULE_H

View File

@@ -1,5 +1,5 @@
/*! \file pitextstream.h /*! \file pitextstream.h
* \ingroup Core * \ingroup Text
* \~\brief * \~\brief
* \~english Text serialization functionality over PIBinaryStream * \~english Text serialization functionality over PIBinaryStream
* \~russian Функциональность текстовой сериализации поверх PIBinaryStream * \~russian Функциональность текстовой сериализации поверх PIBinaryStream
@@ -29,7 +29,7 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup Core //! \ingroup Text
//! \~\brief //! \~\brief
//! \~english Text serialization functionality over PIBinaryStream. //! \~english Text serialization functionality over PIBinaryStream.
//! \~russian Функциональность текстовой сериализации поверх PIBinaryStream. //! \~russian Функциональность текстовой сериализации поверх PIBinaryStream.

View File

@@ -28,7 +28,7 @@
#include "pivector.h" #include "pivector.h"
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english The %PIBitArray class provides an space-efficient array of bits. //! \~english The %PIBitArray class provides an space-efficient array of bits.
//! \~russian Класс %PIBitArray представляет собой компактный массив битов. //! \~russian Класс %PIBitArray представляет собой компактный массив битов.

View File

@@ -1,1272 +1,1272 @@
/*! \file pibytearray.h /*! \file pibytearray.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english Byte array * \~english Byte array
* \~russian Байтовый массив * \~russian Байтовый массив
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Byte array Byte array
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIBYTEARRAY_H #ifndef PIBYTEARRAY_H
#define PIBYTEARRAY_H #define PIBYTEARRAY_H
#include "pichar.h" #include "pichar.h"
#include "pibinarystream.h" #include "pibinarystream.h"
#include <stdio.h> #include <stdio.h>
class PIString; class PIString;
class PIByteArray; class PIByteArray;
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english The %PIByteArray class provides an array of bytes. //! \~english The %PIByteArray class provides an array of bytes.
//! \~russian Класс %PIByteArray представляет собой массив байтов. //! \~russian Класс %PIByteArray представляет собой массив байтов.
class PIP_EXPORT PIByteArray: public PIBinaryStream<PIByteArray> class PIP_EXPORT PIByteArray: public PIBinaryStream<PIByteArray>
{ {
public: public:
typedef ::PIMemoryBlock RawData DEPRECATEDM("use PIMemoryBlock instead"); typedef ::PIMemoryBlock RawData DEPRECATEDM("use PIMemoryBlock instead");
//! \~english Constructs an empty byte array //! \~english Constructs an empty byte array
//! \~russian Создает пустой байтовый массив //! \~russian Создает пустой байтовый массив
PIByteArray() {} PIByteArray() {}
//! \~english Constructs copy of byte array "o" //! \~english Constructs copy of byte array "o"
//! \~russian Создает копию байтового массива "o" //! \~russian Создает копию байтового массива "o"
PIByteArray(const PIByteArray & o): d(o.d) {} PIByteArray(const PIByteArray & o): d(o.d) {}
//! \~english Constructs copy of byte array "o" //! \~english Constructs copy of byte array "o"
//! \~russian Создает копию байтового массива "o" //! \~russian Создает копию байтового массива "o"
PIByteArray(const PIDeque<uchar> & o): d(o) {} PIByteArray(const PIDeque<uchar> & o): d(o) {}
PIByteArray(PIByteArray && o): d(std::move(o.d)) {} PIByteArray(PIByteArray && o): d(std::move(o.d)) {}
//! \~english Constructs 0-filled byte array with size "size" //! \~english Constructs 0-filled byte array with size "size"
//! \~russian Создает заполненный "0" байтовый массив размером "size" //! \~russian Создает заполненный "0" байтовый массив размером "size"
PIByteArray(const uint size) {resize(size);} PIByteArray(const uint size) {resize(size);}
//! \~english Constructs byte array from data "data" and size "size" //! \~english Constructs byte array from data "data" and size "size"
//! \~russian Создает байтовый массив из данных по указателю "data" размером "size" //! \~russian Создает байтовый массив из данных по указателю "data" размером "size"
PIByteArray(const void * data, const uint size): d((const uchar*)data, size_t(size)) {} PIByteArray(const void * data, const uint size): d((const uchar*)data, size_t(size)) {}
//! \~english Constructs byte array with size "size" filled by "t" //! \~english Constructs byte array with size "size" filled by "t"
//! \~russian Создает заполненный "t" байтовый массив размером "size" //! \~russian Создает заполненный "t" байтовый массив размером "size"
PIByteArray(const uint size, uchar t): d(size, t) {} PIByteArray(const uint size, uchar t): d(size, t) {}
//! \~english Contructs array from //! \~english Contructs array from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Создает массив из //! \~russian Создает массив из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\details //! \~\details
//! \~\code //! \~\code
//! PIByteArray v{1,2,3}; //! PIByteArray v{1,2,3};
//! piCout << v; // {1, 2, 3} //! piCout << v; // {1, 2, 3}
//! \endcode //! \endcode
PIByteArray(std::initializer_list<uchar> init_list) : d(init_list) {} PIByteArray(std::initializer_list<uchar> init_list) : d(init_list) {}
//! \~english Swaps array `v` other with this array. //! \~english Swaps array `v` other with this array.
//! \~russian Меняет местами массив `v` с этим массивом. //! \~russian Меняет местами массив `v` с этим массивом.
//! \~\details //! \~\details
//! \~english This operation is very fast and never fails. //! \~english This operation is very fast and never fails.
//! \~russian Эта операция выполняется мгновенно без копирования памяти и никогда не дает сбоев. //! \~russian Эта операция выполняется мгновенно без копирования памяти и никогда не дает сбоев.
inline void swap(PIByteArray & other) { inline void swap(PIByteArray & other) {
d.swap(other.d); d.swap(other.d);
} }
//! \~english Iterator to the first element. //! \~english Iterator to the first element.
//! \~russian Итератор на первый элемент. //! \~russian Итератор на первый элемент.
//! \~\details ![begin, end](doc/images/pivector_begin.png) //! \~\details ![begin, end](doc/images/pivector_begin.png)
//! //!
//! \~english If the array is empty, the returned iterator is equal to \a end(). //! \~english If the array is empty, the returned iterator is equal to \a end().
//! \~russian Если массив - пуст, возвращаемый итератор будет равен \a end(). //! \~russian Если массив - пуст, возвращаемый итератор будет равен \a end().
//! \~\return \ref stl_iterators //! \~\return \ref stl_iterators
//! \~\sa \a end(), \a rbegin(), \a rend() //! \~\sa \a end(), \a rbegin(), \a rend()
inline PIDeque<uchar>::iterator begin() {return d.begin();} inline PIDeque<uchar>::iterator begin() {return d.begin();}
//! \~english Iterator to the element following the last element. //! \~english Iterator to the element following the last element.
//! \~russian Итератор на элемент, следующий за последним элементом. //! \~russian Итератор на элемент, следующий за последним элементом.
//! \~\details ![begin, end](doc/images/pivector_begin.png) //! \~\details ![begin, end](doc/images/pivector_begin.png)
//! //!
//! \~english This element acts as a placeholder; //! \~english This element acts as a placeholder;
//! attempting to access it results in undefined behavior. //! attempting to access it results in undefined behavior.
//! \~russian Этот элемент существует лишь условно, //! \~russian Этот элемент существует лишь условно,
//! попытка доступа к нему приведёт к выходу за разрешенную память. //! попытка доступа к нему приведёт к выходу за разрешенную память.
//! \~\return \ref stl_iterators //! \~\return \ref stl_iterators
//! \~\sa \a begin(), \a rbegin(), \a rend() //! \~\sa \a begin(), \a rbegin(), \a rend()
inline PIDeque<uchar>::iterator end() {return d.end();} inline PIDeque<uchar>::iterator end() {return d.end();}
inline PIDeque<uchar>::const_iterator begin() const {return d.begin();} inline PIDeque<uchar>::const_iterator begin() const {return d.begin();}
inline PIDeque<uchar>::const_iterator end() const {return d.end();} inline PIDeque<uchar>::const_iterator end() const {return d.end();}
//! \~english Returns a reverse iterator to the first element of the reversed array. //! \~english Returns a reverse iterator to the first element of the reversed array.
//! \~russian Обратный итератор на первый элемент. //! \~russian Обратный итератор на первый элемент.
//! \~\details ![rbegin, rend](doc/images/pivector_rbegin.png) //! \~\details ![rbegin, rend](doc/images/pivector_rbegin.png)
//! //!
//! \~english It corresponds to the last element of the non-reversed array. //! \~english It corresponds to the last element of the non-reversed array.
//! If the array is empty, the returned iterator is equal to \a rend(). //! If the array is empty, the returned iterator is equal to \a rend().
//! \~russian Итератор для прохода массива в обратном порядке. //! \~russian Итератор для прохода массива в обратном порядке.
//! Указывает на последний элемент. //! Указывает на последний элемент.
//! Если массив пустой, то совпадает с итератором \a rend(). //! Если массив пустой, то совпадает с итератором \a rend().
//! \~\return \ref stl_iterators //! \~\return \ref stl_iterators
//! \~\sa \a rend(), \a begin(), \a end() //! \~\sa \a rend(), \a begin(), \a end()
inline PIDeque<uchar>::reverse_iterator rbegin() {return d.rbegin();} inline PIDeque<uchar>::reverse_iterator rbegin() {return d.rbegin();}
//! \~english Returns a reverse iterator to the element. //! \~english Returns a reverse iterator to the element.
//! following the last element of the reversed array. //! following the last element of the reversed array.
//! \~russian Обратный итератор на элемент, следующий за последним элементом. //! \~russian Обратный итератор на элемент, следующий за последним элементом.
//! \~\details ![rbegin, rend](doc/images/pivector_rbegin.png) //! \~\details ![rbegin, rend](doc/images/pivector_rbegin.png)
//! //!
//! \~english It corresponds to the element preceding the first element of the non-reversed array. //! \~english It corresponds to the element preceding the first element of the non-reversed array.
//! This element acts as a placeholder, attempting to access it results in undefined behavior. //! This element acts as a placeholder, attempting to access it results in undefined behavior.
//! \~russian Итератор для прохода массива в обратном порядке. //! \~russian Итератор для прохода массива в обратном порядке.
//! Указывает на элемент, предшествующий первому элементу. //! Указывает на элемент, предшествующий первому элементу.
//! Этот элемент существует лишь условно, //! Этот элемент существует лишь условно,
//! попытка доступа к нему приведёт к выходу за разрешенную память. //! попытка доступа к нему приведёт к выходу за разрешенную память.
//! \~\return \ref stl_iterators //! \~\return \ref stl_iterators
//! \~\sa \a rbegin(), \a begin(), \a end() //! \~\sa \a rbegin(), \a begin(), \a end()
inline PIDeque<uchar>::reverse_iterator rend() {return d.rend();} inline PIDeque<uchar>::reverse_iterator rend() {return d.rend();}
inline PIDeque<uchar>::const_reverse_iterator rbegin() const {return d.rbegin();} inline PIDeque<uchar>::const_reverse_iterator rbegin() const {return d.rbegin();}
inline PIDeque<uchar>::const_reverse_iterator rend() const {return d.rend();} inline PIDeque<uchar>::const_reverse_iterator rend() const {return d.rend();}
//! \~english Number of elements in the container. //! \~english Number of elements in the container.
//! \~russian Количество элементов массива. //! \~russian Количество элементов массива.
//! \~\sa \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve() //! \~\sa \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
inline size_t size() const {return d.size();} inline size_t size() const {return d.size();}
//! \~english Number of elements in the container as signed value. //! \~english Number of elements in the container as signed value.
//! \~russian Количество элементов массива в виде знакового числа. //! \~russian Количество элементов массива в виде знакового числа.
//! \~\sa \a size(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve() //! \~\sa \a size(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
inline ssize_t size_s() const {return d.size_s();} inline ssize_t size_s() const {return d.size_s();}
//! \~english Same as \a size(). //! \~english Same as \a size().
//! \~russian Синоним \a size(). //! \~russian Синоним \a size().
//! \~\sa \a size(), \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve() //! \~\sa \a size(), \a size_s(), \a capacity(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
inline size_t length() const {return d.length();} inline size_t length() const {return d.length();}
//! \~english Number of elements that the container has currently allocated space for. //! \~english Number of elements that the container has currently allocated space for.
//! \~russian Количество элементов, для которого сейчас выделена память массивом. //! \~russian Количество элементов, для которого сейчас выделена память массивом.
//! \~\details //! \~\details
//! \~english To find out the actual number of items, use the function \a size(). //! \~english To find out the actual number of items, use the function \a size().
//! \~russian Чтобы узнать фактическое количество элементов используйте функцию \a size(). //! \~russian Чтобы узнать фактическое количество элементов используйте функцию \a size().
//! \~\sa \a reserve(), \a size(), \a size_s() //! \~\sa \a reserve(), \a size(), \a size_s()
inline size_t capacity() const {return d.capacity();} inline size_t capacity() const {return d.capacity();}
//! \~english Checks if the container has no elements. //! \~english Checks if the container has no elements.
//! \~russian Проверяет пуст ли массив. //! \~russian Проверяет пуст ли массив.
//! \~\return //! \~\return
//! \~english **true** if the container is empty, **false** otherwise //! \~english **true** if the container is empty, **false** otherwise
//! \~russian **true** если массив пуст, **false** иначе. //! \~russian **true** если массив пуст, **false** иначе.
//! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve() //! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
inline bool isEmpty() const {return d.isEmpty();} inline bool isEmpty() const {return d.isEmpty();}
//! \~english Checks if the container has elements. //! \~english Checks if the container has elements.
//! \~russian Проверяет не пуст ли массив. //! \~russian Проверяет не пуст ли массив.
//! \~\return //! \~\return
//! \~english **true** if the container is not empty, **false** otherwise //! \~english **true** if the container is not empty, **false** otherwise
//! \~russian **true** если массив не пуст, **false** иначе. //! \~russian **true** если массив не пуст, **false** иначе.
//! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve() //! \~\sa \a size(), \a size_s(), \a isEmpty(), \a isNotEmpty(), \a resize(), \a reserve()
inline bool isNotEmpty() const {return d.isNotEmpty();} inline bool isNotEmpty() const {return d.isNotEmpty();}
//! \~english Tests whether at least one element in the array //! \~english Tests whether at least one element in the array
//! passes the test implemented by the provided function `test`. //! passes the test implemented by the provided function `test`.
//! \~russian Проверяет, удовлетворяет ли какой-либо элемент массива условию, //! \~russian Проверяет, удовлетворяет ли какой-либо элемент массива условию,
//! заданному в передаваемой функции `test`. //! заданному в передаваемой функции `test`.
//! \~\return //! \~\return
//! \~english **true** if, in the array, //! \~english **true** if, in the array,
//! it finds an element for which the provided function returns **true**; //! it finds an element for which the provided function returns **true**;
//! otherwise it returns **false**. Always returns **false** if is empty. //! otherwise it returns **false**. Always returns **false** if is empty.
//! \~russian **true** если хотя бы для одного элемента //! \~russian **true** если хотя бы для одного элемента
//! передаваемая функция возвращает **true**, в остальных случаях **false**. //! передаваемая функция возвращает **true**, в остальных случаях **false**.
//! Метод возвращает **false** при любом условии для пустого массива. //! Метод возвращает **false** при любом условии для пустого массива.
//! \~\details //! \~\details
//! \~\sa \a every(), \a contains(), \a entries(), \a forEach() //! \~\sa \a every(), \a contains(), \a entries(), \a forEach()
inline bool any(std::function<bool(uchar e)> test) const { inline bool any(std::function<bool(uchar e)> test) const {
return d.any(test); return d.any(test);
} }
//! \~english Tests whether all elements in the array passes the test //! \~english Tests whether all elements in the array passes the test
//! implemented by the provided function `test`. //! implemented by the provided function `test`.
//! \~russian Проверяет, удовлетворяют ли все элементы массива условию, //! \~russian Проверяет, удовлетворяют ли все элементы массива условию,
//! заданному в передаваемой функции `test`. //! заданному в передаваемой функции `test`.
//! \~\return //! \~\return
//! \~english **true** if, in the array, //! \~english **true** if, in the array,
//! it finds an element for which the provided function returns **true**; //! it finds an element for which the provided function returns **true**;
//! otherwise it returns **false**. Always returns **true** if is empty. //! otherwise it returns **false**. Always returns **true** if is empty.
//! \~russian **true** если для всех элементов передаваемая функция возвращает **true**, //! \~russian **true** если для всех элементов передаваемая функция возвращает **true**,
//! в остальных случаях **false**. //! в остальных случаях **false**.
//! Метод возвращает **true** при любом условии для пустого массива. //! Метод возвращает **true** при любом условии для пустого массива.
//! \~\details //! \~\details
//! \~\sa \a any(), \a contains(), \a entries(), \a forEach() //! \~\sa \a any(), \a contains(), \a entries(), \a forEach()
inline bool every(std::function<bool(uchar e)> test) const { inline bool every(std::function<bool(uchar e)> test) const {
return d.every(test); return d.every(test);
} }
//! \~english Full access to element by `index`. //! \~english Full access to element by `index`.
//! \~russian Полный доступ к элементу по индексу `index`. //! \~russian Полный доступ к элементу по индексу `index`.
//! \~\details //! \~\details
//! \~english Element index starts from `0`. //! \~english Element index starts from `0`.
//! Element index must be in range from `0` to `size()-1`. //! Element index must be in range from `0` to `size()-1`.
//! Otherwise will be undefined behavior. //! Otherwise will be undefined behavior.
//! \~russian Индекс элемента считается от `0`. //! \~russian Индекс элемента считается от `0`.
//! Индекс элемента должен лежать в пределах от `0` до `size()-1`. //! Индекс элемента должен лежать в пределах от `0` до `size()-1`.
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти. //! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
//! \~\sa \a at() //! \~\sa \a at()
inline uchar & operator [](size_t index) {return d[index];} inline uchar & operator [](size_t index) {return d[index];}
inline uchar operator [](size_t index) const {return d[index];} inline uchar operator [](size_t index) const {return d[index];}
//! \~english Read only access to element by `index`. //! \~english Read only access to element by `index`.
//! \~russian Доступ исключительно на чтение к элементу по индексу `index`. //! \~russian Доступ исключительно на чтение к элементу по индексу `index`.
//! \~\details //! \~\details
//! \~english Element index starts from `0`. //! \~english Element index starts from `0`.
//! Element index must be in range from `0` to `size()-1`. //! Element index must be in range from `0` to `size()-1`.
//! Otherwise will be undefined behavior. //! Otherwise will be undefined behavior.
//! \~russian Индекс элемента считается от `0`. //! \~russian Индекс элемента считается от `0`.
//! Индекс элемента должен лежать в пределах от `0` до `size()-1`. //! Индекс элемента должен лежать в пределах от `0` до `size()-1`.
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти. //! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
inline uchar at(size_t index) const {return d.at(index);} inline uchar at(size_t index) const {return d.at(index);}
//! \~english Last element. //! \~english Last element.
//! \~russian Последний элемент массива. //! \~russian Последний элемент массива.
//! \~\details //! \~\details
//! \~english Returns a reference to the last item in the array. //! \~english Returns a reference to the last item in the array.
//! This function assumes that the array isn't empty. //! This function assumes that the array isn't empty.
//! Otherwise will be undefined behavior. //! Otherwise will be undefined behavior.
//! \~russian Возвращает ссылку на последний элемент в массиве. //! \~russian Возвращает ссылку на последний элемент в массиве.
//! Эта функция предполагает, что массив не пустой. //! Эта функция предполагает, что массив не пустой.
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти. //! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
inline uchar & back() {return d.back();} inline uchar & back() {return d.back();}
inline uchar back() const {return d.back();} inline uchar back() const {return d.back();}
//! \~english Last element. //! \~english Last element.
//! \~russian Первый элемент массива. //! \~russian Первый элемент массива.
//! \~\details //! \~\details
//! \~english Returns a reference to the last item in the array. //! \~english Returns a reference to the last item in the array.
//! This function assumes that the array isn't empty. //! This function assumes that the array isn't empty.
//! Otherwise will be undefined behavior. //! Otherwise will be undefined behavior.
//! \~russian Возвращает ссылку на пенрвый элемент в массиве. //! \~russian Возвращает ссылку на пенрвый элемент в массиве.
//! Эта функция предполагает, что массив не пустой. //! Эта функция предполагает, что массив не пустой.
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти. //! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
inline uchar & front() {return d.front();} inline uchar & front() {return d.front();}
inline uchar front() const {return d.front();} inline uchar front() const {return d.front();}
//! \~english Tests if element `e` exists in the array. //! \~english Tests if element `e` exists in the array.
//! \~russian Проверяет наличие элемента `e` в массиве. //! \~russian Проверяет наличие элемента `e` в массиве.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array at which to begin searching. //! \~english Optional argument `start` - the position in this array at which to begin searching.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! **false** is returned, which means the array will not be searched. //! **false** is returned, which means the array will not be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from front to back. //! the array is still searched from front to back.
//! Default: 0 (entire array is searched). //! Default: 0 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск. //! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск.
//! Если индекс больше или равен длине массива, //! Если индекс больше или равен длине массива,
//! возвращается **false**, что означает, что массив даже не просматривается. //! возвращается **false**, что означает, что массив даже не просматривается.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив. //! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив. //! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
//! \~\code //! \~\code
//! PIByteArray v{1, 2, 3, 4}; //! PIByteArray v{1, 2, 3, 4};
//! piCout << v.contains(3); // true //! piCout << v.contains(3); // true
//! piCout << v.contains(5); // false //! piCout << v.contains(5); // false
//! piCout << v.contains(3, 3); // false //! piCout << v.contains(3, 3); // false
//! piCout << v.contains(3, -2); // true //! piCout << v.contains(3, -2); // true
//! piCout << v.contains(3, -99); // true //! piCout << v.contains(3, -99); // true
//! \endcode //! \endcode
//! \~\return //! \~\return
//! \~english **true** if the array contains an occurrence of element `e`, //! \~english **true** if the array contains an occurrence of element `e`,
//! otherwise it returns **false**. //! otherwise it returns **false**.
//! \~russian **true** если элемент `e` присутствует в массиве, //! \~russian **true** если элемент `e` присутствует в массиве,
//! в остальных случаях **false**. //! в остальных случаях **false**.
//! \~\sa \a every(), \a any(), \a entries() //! \~\sa \a every(), \a any(), \a entries()
inline bool contains(uchar e, ssize_t start = 0) const { inline bool contains(uchar e, ssize_t start = 0) const {
return d.contains(e, start); return d.contains(e, start);
} }
//! \~english Count elements equal `e` in the array. //! \~english Count elements equal `e` in the array.
//! \~russian Подсчитывает количество элементов, совпадающих с элементом `e` в массиве. //! \~russian Подсчитывает количество элементов, совпадающих с элементом `e` в массиве.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array at which to begin searching. //! \~english Optional argument `start` - the position in this array at which to begin searching.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! 0 is returned, which means the array will not be searched. //! 0 is returned, which means the array will not be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from front to back. //! the array is still searched from front to back.
//! Default: 0 (entire array is searched). //! Default: 0 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск. //! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск.
//! Если индекс больше или равен длине массива, //! Если индекс больше или равен длине массива,
//! возвращается 0, что означает, что массив даже не просматривается. //! возвращается 0, что означает, что массив даже не просматривается.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив. //! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив. //! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
//! \~\sa \a every(), \a any(), \a contains(), \a indexOf() //! \~\sa \a every(), \a any(), \a contains(), \a indexOf()
inline int entries(uchar e, ssize_t start = 0) const { inline int entries(uchar e, ssize_t start = 0) const {
return d.entries(e, start); return d.entries(e, start);
} }
//! \~english Count elements in the array passes the test implemented by the provided function `test`. //! \~english Count elements in the array passes the test implemented by the provided function `test`.
//! \~russian Подсчитывает количество элементов в массиве, //! \~russian Подсчитывает количество элементов в массиве,
//! проходящих по условию, заданному в передаваемой функции `test`. //! проходящих по условию, заданному в передаваемой функции `test`.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Optional argument `start` - the position in this array at which to begin searching. //! Optional argument `start` - the position in this array at which to begin searching.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! 0 is returned, which means the array will not be searched. //! 0 is returned, which means the array will not be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from front to back. //! the array is still searched from front to back.
//! Default: 0 (entire array is searched). //! Default: 0 (entire array is searched).
//! \~russian Перегруженная функция. //! \~russian Перегруженная функция.
//! Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск. //! Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск.
//! Если индекс больше или равен длине массива, //! Если индекс больше или равен длине массива,
//! возвращается 0, что означает, что массив даже не просматривается. //! возвращается 0, что означает, что массив даже не просматривается.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив. //! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив. //! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
//! \~\sa \a every(), \a any(), \a contains(), \a indexWhere() //! \~\sa \a every(), \a any(), \a contains(), \a indexWhere()
inline int entries(std::function<bool(uchar e)> test, ssize_t start = 0) const { inline int entries(std::function<bool(uchar e)> test, ssize_t start = 0) const {
return d.entries(test, start); return d.entries(test, start);
} }
//! \~english Returns the first index at which a given element `e` //! \~english Returns the first index at which a given element `e`
//! can be found in the array, or `-1` if it is not present. //! can be found in the array, or `-1` if it is not present.
//! \~russian Возвращает первый индекс, по которому данный элемент `e` //! \~russian Возвращает первый индекс, по которому данный элемент `e`
//! может быть найден в массиве или `-1`, если такого индекса нет. //! может быть найден в массиве или `-1`, если такого индекса нет.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array at which to begin searching. //! \~english Optional argument `start` - the position in this array at which to begin searching.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! `-1` is returned, which means the array will not be searched. //! `-1` is returned, which means the array will not be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from front to back. //! the array is still searched from front to back.
//! Default: 0 (entire array is searched). //! Default: 0 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск. //! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск.
//! Если индекс больше или равен длине массива, //! Если индекс больше или равен длине массива,
//! возвращается `-1`, что означает, что массив даже не просматривается. //! возвращается `-1`, что означает, что массив даже не просматривается.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив. //! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив. //! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
//! \~\code //! \~\code
//! PIByteArray v{2, 5, 9}; //! PIByteArray v{2, 5, 9};
//! piCout << v.indexOf(2); // 0 //! piCout << v.indexOf(2); // 0
//! piCout << v.indexOf(7); // -1 //! piCout << v.indexOf(7); // -1
//! piCout << v.indexOf(9, 2); // 2 //! piCout << v.indexOf(9, 2); // 2
//! piCout << v.indexOf(2, -1); // -1 //! piCout << v.indexOf(2, -1); // -1
//! piCout << v.indexOf(2, -3); // 0 //! piCout << v.indexOf(2, -3); // 0
//! \endcode //! \endcode
//! \~\sa \a indexWhere(), \a lastIndexOf(), \a lastIndexWhere(), \a contains() //! \~\sa \a indexWhere(), \a lastIndexOf(), \a lastIndexWhere(), \a contains()
inline ssize_t indexOf(const uchar & e, ssize_t start = 0) const { inline ssize_t indexOf(const uchar & e, ssize_t start = 0) const {
return d.indexOf(e, start); return d.indexOf(e, start);
} }
//! \~english Returns the first index passes the test implemented by the provided function `test`, //! \~english Returns the first index passes the test implemented by the provided function `test`,
//! or `-1` if it is not present. //! or `-1` if it is not present.
//! can be found in the array, or `-1` if it is not present. //! can be found in the array, or `-1` if it is not present.
//! \~russian Возвращает первый индекс элемента проходящего по условию, //! \~russian Возвращает первый индекс элемента проходящего по условию,
//! заданному в передаваемой функции `test`, или `-1`, если таких элементов нет. //! заданному в передаваемой функции `test`, или `-1`, если таких элементов нет.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array at which to begin searching. //! \~english Optional argument `start` - the position in this array at which to begin searching.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! `-1` is returned, which means the array will not be searched. //! `-1` is returned, which means the array will not be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from front to back. //! the array is still searched from front to back.
//! Default: 0 (entire array is searched). //! Default: 0 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск. //! \~russian Опциональный аргумент `start` указывает на индекс в массиве, откуда будет начинаться поиск.
//! Если индекс больше или равен длине массива, //! Если индекс больше или равен длине массива,
//! возвращается `-1`, что означает, что массив даже не просматривается. //! возвращается `-1`, что означает, что массив даже не просматривается.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив. //! Если рассчитанный индекс все равно оказывается меньше 0, просматривается весь массив.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от начала к концу.
//! Значение по умолчанию равно 0, что означает, что просматривается весь массив. //! Значение по умолчанию равно 0, что означает, что просматривается весь массив.
//! \~\code //! \~\code
//! PIByteArray v{2, 5, 9}; //! PIByteArray v{2, 5, 9};
//! piCout << v.indexWhere([](const uchar & s){return s > 3;}); // 1 //! piCout << v.indexWhere([](const uchar & s){return s > 3;}); // 1
//! piCout << v.indexWhere([](const uchar & s){return s > 3;}, 2); // 2 //! piCout << v.indexWhere([](const uchar & s){return s > 3;}, 2); // 2
//! piCout << v.indexWhere([](const uchar & s){return s > 10;}); // -1 //! piCout << v.indexWhere([](const uchar & s){return s > 10;}); // -1
//! \endcode //! \endcode
//! \~\sa \a indexOf(), \a lastIndexOf(), \a lastIndexWhere(), \a contains() //! \~\sa \a indexOf(), \a lastIndexOf(), \a lastIndexWhere(), \a contains()
inline ssize_t indexWhere(std::function<bool(const uchar & e)> test, ssize_t start = 0) const { inline ssize_t indexWhere(std::function<bool(const uchar & e)> test, ssize_t start = 0) const {
return d.indexWhere(test, start); return d.indexWhere(test, start);
} }
//! \~english Returns the last index at which a given element `e` //! \~english Returns the last index at which a given element `e`
//! can be found in the array, or `-1` if it is not present. //! can be found in the array, or `-1` if it is not present.
//! \~russian Возвращает последний индекс, по которому данный элемент `e` //! \~russian Возвращает последний индекс, по которому данный элемент `e`
//! может быть найден в массиве или `-1`, если такого индекса нет. //! может быть найден в массиве или `-1`, если такого индекса нет.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array //! \~english Optional argument `start` - the position in this array
//! at which to start searching backwards. //! at which to start searching backwards.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! causes the whole array to be searched. //! causes the whole array to be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Therefore, if calculated index less than 0, //! Therefore, if calculated index less than 0,
//! the array is not searched, and the method returns `-1`. //! the array is not searched, and the method returns `-1`.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from back to front. //! the array is still searched from back to front.
//! Default: -1 (entire array is searched). //! Default: -1 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс //! \~russian Опциональный аргумент `start` указывает на индекс
//! c которого начинать поиск в обратном направлении. //! c которого начинать поиск в обратном направлении.
//! Если индекс больше или равен длине массива, просматривается весь массив. //! Если индекс больше или равен длине массива, просматривается весь массив.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от конца к началу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от конца к началу.
//! Если рассчитанный индекс оказывается меньше 0, массив даже не просматривается. //! Если рассчитанный индекс оказывается меньше 0, массив даже не просматривается.
//! Значение по умолчанию равно `-1`, что равно индексу последнего элемента //! Значение по умолчанию равно `-1`, что равно индексу последнего элемента
//! и означает, что просматривается весь массив. //! и означает, что просматривается весь массив.
//! \~\code //! \~\code
//! PIByteArray v{2, 5, 9, 2}; //! PIByteArray v{2, 5, 9, 2};
//! piCout << v.lastIndexOf(2); // 3 //! piCout << v.lastIndexOf(2); // 3
//! piCout << v.lastIndexOf(7); // -1 //! piCout << v.lastIndexOf(7); // -1
//! piCout << v.lastIndexOf(2, 2); // 0 //! piCout << v.lastIndexOf(2, 2); // 0
//! piCout << v.lastIndexOf(2, -3); // 0 //! piCout << v.lastIndexOf(2, -3); // 0
//! piCout << v.lastIndexOf(2, -300); // -1 //! piCout << v.lastIndexOf(2, -300); // -1
//! piCout << v.lastIndexOf(2, 300); // 3 //! piCout << v.lastIndexOf(2, 300); // 3
//! \endcode //! \endcode
//! \~\sa \a indexOf(), \a indexWhere(), \a lastIndexWhere(), \a contains() //! \~\sa \a indexOf(), \a indexWhere(), \a lastIndexWhere(), \a contains()
inline ssize_t lastIndexOf(const uchar & e, ssize_t start = -1) const { inline ssize_t lastIndexOf(const uchar & e, ssize_t start = -1) const {
return d.lastIndexOf(e, start); return d.lastIndexOf(e, start);
} }
//! \~english Returns the last index passes the test implemented by the provided function `test`, //! \~english Returns the last index passes the test implemented by the provided function `test`,
//! or `-1` if it is not present. //! or `-1` if it is not present.
//! \~russian Возвращает последний индекс элемента проходящего по условию, //! \~russian Возвращает последний индекс элемента проходящего по условию,
//! заданному в передаваемой функции `test`, или `-1`, если таких элементов нет. //! заданному в передаваемой функции `test`, или `-1`, если таких элементов нет.
//! \~\details //! \~\details
//! \~english Optional argument `start` - the position in this array //! \~english Optional argument `start` - the position in this array
//! at which to start searching backwards. //! at which to start searching backwards.
//! If the index is greater than or equal to the array's size, //! If the index is greater than or equal to the array's size,
//! causes the whole array to be searched. //! causes the whole array to be searched.
//! If the provided index value is a negative number, //! If the provided index value is a negative number,
//! it is taken as the offset from the end of the array. //! it is taken as the offset from the end of the array.
//! Therefore, if calculated index less than 0, //! Therefore, if calculated index less than 0,
//! the array is not searched, and the method returns `-1`. //! the array is not searched, and the method returns `-1`.
//! Note: if the provided index is negative, //! Note: if the provided index is negative,
//! the array is still searched from back to front. //! the array is still searched from back to front.
//! Default: -1 (entire array is searched). //! Default: -1 (entire array is searched).
//! \~russian Опциональный аргумент `start` указывает на индекс //! \~russian Опциональный аргумент `start` указывает на индекс
//! c которого начинать поиск в обратном направлении. //! c которого начинать поиск в обратном направлении.
//! Если индекс больше или равен длине массива, просматривается весь массив. //! Если индекс больше или равен длине массива, просматривается весь массив.
//! Если индекс является отрицательным числом, он трактуется как смещение с конца массива. //! Если индекс является отрицательным числом, он трактуется как смещение с конца массива.
//! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от конца к началу. //! Обратите внимание: если индекс отрицателен, массив всё равно просматривается от конца к началу.
//! Если рассчитанный индекс оказывается меньше 0, массив даже не просматривается. //! Если рассчитанный индекс оказывается меньше 0, массив даже не просматривается.
//! Значение по умолчанию равно `-1`, что равно индексу последнего элемента //! Значение по умолчанию равно `-1`, что равно индексу последнего элемента
//! и означает, что просматривается весь массив. //! и означает, что просматривается весь массив.
//! \~\sa \a indexOf(), \a lastIndexOf(), \a indexWhere(), \a contains() //! \~\sa \a indexOf(), \a lastIndexOf(), \a indexWhere(), \a contains()
inline ssize_t lastIndexWhere(std::function<bool(const uchar & e)> test, ssize_t start = -1) const { inline ssize_t lastIndexWhere(std::function<bool(const uchar & e)> test, ssize_t start = -1) const {
return d.lastIndexWhere(test, start); return d.lastIndexWhere(test, start);
} }
//! \~english Pointer to array //! \~english Pointer to array
//! \~russian Указатель на память массива //! \~russian Указатель на память массива
//! \~\details //! \~\details
//! \~english Optional argument `index` the position in this array, //! \~english Optional argument `index` the position in this array,
//! where is pointer. Default: start of array. //! where is pointer. Default: start of array.
//! \~russian Опциональный аргумент `index` указывает на индекс c которого брать указатель. //! \~russian Опциональный аргумент `index` указывает на индекс c которого брать указатель.
//! По умолчанию указывает на начало массива. //! По умолчанию указывает на начало массива.
inline uchar * data(size_t index = 0) {return d.data(index);} inline uchar * data(size_t index = 0) {return d.data(index);}
//! \~english Read only pointer to array //! \~english Read only pointer to array
//! \~russian Указатель на память массива только для чтения. //! \~russian Указатель на память массива только для чтения.
//! \~\details //! \~\details
//! \~english The pointer can be used to access and modify the items in the array. //! \~english The pointer can be used to access and modify the items in the array.
//! The pointer remains valid as long as the array isn't reallocated. //! The pointer remains valid as long as the array isn't reallocated.
//! Optional argument `index` the position in this array, //! Optional argument `index` the position in this array,
//! where is pointer. Default: start of array. //! where is pointer. Default: start of array.
//! \~russian Указатель можно использовать для доступа и изменения элементов в массиве. //! \~russian Указатель можно использовать для доступа и изменения элементов в массиве.
//! Указатель остается действительным только до тех пор, пока массив не будет перераспределен. //! Указатель остается действительным только до тех пор, пока массив не будет перераспределен.
//! Опциональный аргумент `index` указывает на индекс c которого брать указатель. //! Опциональный аргумент `index` указывает на индекс c которого брать указатель.
//! По умолчанию указывает на начало массива. //! По умолчанию указывает на начало массива.
inline const uchar * data(size_t index = 0) const {return d.data(index);} inline const uchar * data(size_t index = 0) const {return d.data(index);}
//! \~english Clear array, remove all elements. //! \~english Clear array, remove all elements.
//! \~russian Очищает массив, удаляет все элементы. //! \~russian Очищает массив, удаляет все элементы.
//! \~\details //! \~\details
//! \~\note //! \~\note
//! \~english Reserved memory will not be released. //! \~english Reserved memory will not be released.
//! \~russian Зарезервированная память не освободится. //! \~russian Зарезервированная память не освободится.
//! \~\sa \a resize() //! \~\sa \a resize()
inline PIByteArray & clear() { inline PIByteArray & clear() {
resize(0); resize(0);
return *this; return *this;
} }
//! \~english Assigns element 'e' to all items in the array. //! \~english Assigns element 'e' to all items in the array.
//! \~russian Заполняет весь массив копиями элемента 'e'. //! \~russian Заполняет весь массив копиями элемента 'e'.
//! \~\details //! \~\details
//! \~\sa \a resize() //! \~\sa \a resize()
inline PIByteArray & fill(uchar e = 0) { inline PIByteArray & fill(uchar e = 0) {
d.fill(e); d.fill(e);
return *this; return *this;
} }
//! \~english Assigns result of function 'f(size_t i)' to all items in the array. //! \~english Assigns result of function 'f(size_t i)' to all items in the array.
//! \~russian Заполняет весь массив результатом вызова функции 'f(size_t i)'. //! \~russian Заполняет весь массив результатом вызова функции 'f(size_t i)'.
//! \~\details //! \~\details
//! \~\sa \a resize() //! \~\sa \a resize()
inline PIByteArray & fill(std::function<uchar(size_t i)> f) { inline PIByteArray & fill(std::function<uchar(size_t i)> f) {
d.fill(f); d.fill(f);
return *this; return *this;
} }
//! \~english Same as \a fill(). //! \~english Same as \a fill().
//! \~russian Тоже самое что и \a fill(). //! \~russian Тоже самое что и \a fill().
//! \~\sa \a fill(), \a resize() //! \~\sa \a fill(), \a resize()
inline PIByteArray & assign(uchar e = 0) {return fill(e);} inline PIByteArray & assign(uchar e = 0) {return fill(e);}
//! \~english First does `resize(new_size)` then `fill(e)`. //! \~english First does `resize(new_size)` then `fill(e)`.
//! \~russian Сначала делает `resize(new_size)`, затем `fill(e)`. //! \~russian Сначала делает `resize(new_size)`, затем `fill(e)`.
//! \~\sa \a fill(), \a resize() //! \~\sa \a fill(), \a resize()
inline PIByteArray & assign(size_t new_size, uchar e) { inline PIByteArray & assign(size_t new_size, uchar e) {
resize(new_size); resize(new_size);
return fill(e); return fill(e);
} }
//! \~english Sets size of the array, new elements are copied from `e`. //! \~english Sets size of the array, new elements are copied from `e`.
//! \~russian Устанавливает размер массива, новые элементы копируются из `e`. //! \~russian Устанавливает размер массива, новые элементы копируются из `e`.
//! \~\details //! \~\details
//! \~english If `new_size` is greater than the current \a size(), //! \~english If `new_size` is greater than the current \a size(),
//! elements are added to the end; the new elements are initialized from `e`. //! elements are added to the end; the new elements are initialized from `e`.
//! If `new_size` is less than the current \a size(), elements are removed from the end. //! If `new_size` is less than the current \a size(), elements are removed from the end.
//! \~russian Если `new_size` больше чем текущий размер массива \a size(), //! \~russian Если `new_size` больше чем текущий размер массива \a size(),
//! новые элементы добавляются в конец массива и создаются из `e`. //! новые элементы добавляются в конец массива и создаются из `e`.
//! Если `new_size` меньше чем текущий размер массива \a size(), //! Если `new_size` меньше чем текущий размер массива \a size(),
//! лишние элементы удаляются с конца массива. //! лишние элементы удаляются с конца массива.
//! \~\sa \a size(), \a clear() //! \~\sa \a size(), \a clear()
inline PIByteArray & resize(size_t new_size, uchar e = 0) { inline PIByteArray & resize(size_t new_size, uchar e = 0) {
d.resize(new_size, e); d.resize(new_size, e);
return *this; return *this;
} }
//! \~english Sets size of the array, new elements created by function `f(size_t i)`. //! \~english Sets size of the array, new elements created by function `f(size_t i)`.
//! \~russian Устанавливает размер массива, новые элементы создаются функцией `f(size_t i)`. //! \~russian Устанавливает размер массива, новые элементы создаются функцией `f(size_t i)`.
//! \~\details //! \~\details
//! \~english If `new_size` is greater than the current \a size(), //! \~english If `new_size` is greater than the current \a size(),
//! elements are added to the end; the new elements created by function `f(size_t i)`. //! elements are added to the end; the new elements created by function `f(size_t i)`.
//! If `new_size` is less than the current \a size(), elements are removed from the end. //! If `new_size` is less than the current \a size(), elements are removed from the end.
//! \~russian Если `new_size` больше чем текущий размер массива \a size(), //! \~russian Если `new_size` больше чем текущий размер массива \a size(),
//! новые элементы добавляются в конец массива и функцией `f(size_t i)`. //! новые элементы добавляются в конец массива и функцией `f(size_t i)`.
//! Если `new_size` меньше чем текущий размер массива \a size(), //! Если `new_size` меньше чем текущий размер массива \a size(),
//! лишние элементы удаляются с конца массива. //! лишние элементы удаляются с конца массива.
//! \~\sa \a size(), \a clear() //! \~\sa \a size(), \a clear()
inline PIByteArray & resize(size_t new_size, std::function<uchar(size_t i)> f) { inline PIByteArray & resize(size_t new_size, std::function<uchar(size_t i)> f) {
d.resize(new_size, f); d.resize(new_size, f);
return *this; return *this;
} }
//! \~english Return resized byte array //! \~english Return resized byte array
//! \~russian Возвращает копию байтового массива с измененным размером //! \~russian Возвращает копию байтового массива с измененным размером
PIByteArray resized(uint new_size) const { PIByteArray resized(uint new_size) const {
PIByteArray ret(new_size); PIByteArray ret(new_size);
memcpy(ret.data(), data(), new_size); memcpy(ret.data(), data(), new_size);
return ret; return ret;
} }
//! \~english Attempts to allocate memory for at least `new_size` elements. //! \~english Attempts to allocate memory for at least `new_size` elements.
//! \~russian Резервируется память под как минимум `new_size` элементов. //! \~russian Резервируется память под как минимум `new_size` элементов.
//! \~\details //! \~\details
//! \~english If you know in advance how large the array will be, //! \~english If you know in advance how large the array will be,
//! you should call this function to prevent reallocations and memory fragmentation. //! you should call this function to prevent reallocations and memory fragmentation.
//! If `new_size` is greater than the current \a capacity(), //! If `new_size` is greater than the current \a capacity(),
//! new storage is allocated, otherwise the function does nothing. //! new storage is allocated, otherwise the function does nothing.
//! This function does not change the \a size() of the array. //! This function does not change the \a size() of the array.
//! \~russian Если вы заранее знаете, насколько велик будет массив, //! \~russian Если вы заранее знаете, насколько велик будет массив,
//! вы можете вызвать эту функцию, чтобы предотвратить перераспределение и фрагментацию памяти. //! вы можете вызвать эту функцию, чтобы предотвратить перераспределение и фрагментацию памяти.
//! Если размер `new_size` больше чем выделенная память \a capacity(), //! Если размер `new_size` больше чем выделенная память \a capacity(),
//! то произойдёт выделение новой памяти и перераспределение массива. //! то произойдёт выделение новой памяти и перераспределение массива.
//! Эта функция не изменяет количество элементов в массиве \a size(). //! Эта функция не изменяет количество элементов в массиве \a size().
//! \~\sa \a size(), \a capacity(), \a resize() //! \~\sa \a size(), \a capacity(), \a resize()
inline PIByteArray & reserve(size_t new_size) { inline PIByteArray & reserve(size_t new_size) {
d.reserve(new_size); d.reserve(new_size);
return *this; return *this;
} }
//! \~english Inserts value `e` at `index` position in the array. //! \~english Inserts value `e` at `index` position in the array.
//! \~russian Вставляет значение `e` в позицию `index` в массиве. //! \~russian Вставляет значение `e` в позицию `index` в массиве.
//! \~\details //! \~\details
//! \~english The index must be greater than 0 and less than or equal to \a size(). //! \~english The index must be greater than 0 and less than or equal to \a size().
//! \~russian Индекс должен быть больше 0 и меньше или равен \a size(). //! \~russian Индекс должен быть больше 0 и меньше или равен \a size().
//! \~\sa \a append(), \a prepend(), \a remove() //! \~\sa \a append(), \a prepend(), \a remove()
inline PIByteArray & insert(size_t index, uchar e = 0) { inline PIByteArray & insert(size_t index, uchar e = 0) {
d.insert(index, e); d.insert(index, e);
return *this; return *this;
} }
//! \~english Inserts array `v` at `index` position in the array. //! \~english Inserts array `v` at `index` position in the array.
//! \~russian Вставляет массив `v` в позицию `index` в массиве. //! \~russian Вставляет массив `v` в позицию `index` в массиве.
//! \~\details //! \~\details
//! \~english The index must be greater than or equal to 0 and less than or equal to \a size(). //! \~english The index must be greater than or equal to 0 and less than or equal to \a size().
//! \~russian Индекс должен быть больше или равен 0 и меньше или равен \a size(). //! \~russian Индекс должен быть больше или равен 0 и меньше или равен \a size().
//! \~\sa \a append(), \a prepend(), \a remove() //! \~\sa \a append(), \a prepend(), \a remove()
inline PIByteArray & insert(size_t index, const PIByteArray & v) { inline PIByteArray & insert(size_t index, const PIByteArray & v) {
d.insert(index, v.d); d.insert(index, v.d);
return *this; return *this;
} }
//! \~english Inserts the given elements at `index` position in the array. //! \~english Inserts the given elements at `index` position in the array.
//! \~russian Вставляет элементы в позицию `index` в массиве. //! \~russian Вставляет элементы в позицию `index` в массиве.
//! \~\details //! \~\details
//! \~english The index must be greater than or equal to 0 and less than or equal to \a size(). //! \~english The index must be greater than or equal to 0 and less than or equal to \a size().
//! Inserts the given elements from //! Inserts the given elements from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Индекс должен быть больше или равен 0 и меньше или равен \a size(). //! \~russian Индекс должен быть больше или равен 0 и меньше или равен \a size().
//! Вставляет элементы из //! Вставляет элементы из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\sa \a append(), \a prepend(), \a remove() //! \~\sa \a append(), \a prepend(), \a remove()
inline PIByteArray & insert(size_t index, std::initializer_list<uchar> init_list) { inline PIByteArray & insert(size_t index, std::initializer_list<uchar> init_list) {
d.insert(index, init_list); d.insert(index, init_list);
return *this; return *this;
} }
//! \~english Removes `count` elements from the middle of the array, starting at `index` position. //! \~english Removes `count` elements from the middle of the array, starting at `index` position.
//! \~russian Удаляет элементы из массива, начиная с позиции `index` в количестве `count`. //! \~russian Удаляет элементы из массива, начиная с позиции `index` в количестве `count`.
//! \~\details //! \~\details
//! \~\sa \a resize(), \a insert(), \a removeOne(), \a removeAll(), \a removeWhere() //! \~\sa \a resize(), \a insert(), \a removeOne(), \a removeAll(), \a removeWhere()
inline PIByteArray & remove(size_t index, size_t count = 1) { inline PIByteArray & remove(size_t index, size_t count = 1) {
d.remove(index, count); d.remove(index, count);
return *this; return *this;
} }
//! \~english Return sub-array starts from "index" and has "count" or less bytes //! \~english Return sub-array starts from "index" and has "count" or less bytes
//! \~russian Возвращает подмассив с данными от индекса "index" и размером не более "count" //! \~russian Возвращает подмассив с данными от индекса "index" и размером не более "count"
PIByteArray getRange(size_t index, size_t count) const { PIByteArray getRange(size_t index, size_t count) const {
return d.getRange(index, count); return d.getRange(index, count);
} }
//! \~english Reverses this array. //! \~english Reverses this array.
//! \~russian Обращает порядок следования элементов этого массива. //! \~russian Обращает порядок следования элементов этого массива.
//! \~\details //! \~\details
//! \~english This method reverses an array [in place](https://en.wikipedia.org/wiki/In-place_algorithm). //! \~english This method reverses an array [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
//! The first array element becomes the last, and the last array element becomes the first. //! The first array element becomes the last, and the last array element becomes the first.
//! The reverse method transposes the elements of the calling array object in place, //! The reverse method transposes the elements of the calling array object in place,
//! mutating the array, and returning a reference to the array. //! mutating the array, and returning a reference to the array.
//! \~russian Метод reverse() на месте переставляет элементы массива, //! \~russian Метод reverse() на месте переставляет элементы массива,
//! на котором он был вызван, изменяет массив и возвращает ссылку на него. //! на котором он был вызван, изменяет массив и возвращает ссылку на него.
//! Первый элемент массива становится последним, а последний — первым. //! Первый элемент массива становится последним, а последний — первым.
//! \~\sa \a reversed() //! \~\sa \a reversed()
inline PIByteArray & reverse() { inline PIByteArray & reverse() {
d.reverse(); d.reverse();
return *this; return *this;
} }
//! \~english Returns reversed array. //! \~english Returns reversed array.
//! \~russian Возвращает перевернутый массив. //! \~russian Возвращает перевернутый массив.
//! \~\details //! \~\details
//! \~english Returns a copy of the array with elements in reverse order. //! \~english Returns a copy of the array with elements in reverse order.
//! The first array element becomes the last, and the last array element becomes the first. //! The first array element becomes the last, and the last array element becomes the first.
//! \~russian Возвращает копию массива с элементами в обратном порядке. //! \~russian Возвращает копию массива с элементами в обратном порядке.
//! Первый элемент массива становится последним, а последний — первым. //! Первый элемент массива становится последним, а последний — первым.
//! \~\sa \a reverse() //! \~\sa \a reverse()
inline PIByteArray reversed() const { inline PIByteArray reversed() const {
PIByteArray ret(*this); PIByteArray ret(*this);
return ret.reverse(); return ret.reverse();
} }
//! \~english Increases or decreases the size of the array by `add_size` elements. //! \~english Increases or decreases the size of the array by `add_size` elements.
//! \~russian Увеличивает или уменьшает размер массива на `add_size` элементов. //! \~russian Увеличивает или уменьшает размер массива на `add_size` элементов.
//! \~\details //! \~\details
//! \~english If `add_size > 0` then elements are added to the end of the array. //! \~english If `add_size > 0` then elements are added to the end of the array.
//! If `add_size < 0` then elements are removed from the end of the array. //! If `add_size < 0` then elements are removed from the end of the array.
//! If `add_size < 0` and there are fewer elements in the array than specified, then the array becomes empty. //! If `add_size < 0` and there are fewer elements in the array than specified, then the array becomes empty.
//! \~russian Если `add_size > 0`, то в конец массива добавляются элементы. //! \~russian Если `add_size > 0`, то в конец массива добавляются элементы.
//! Если `add_size < 0`, то с конца массива удаляются элементы. //! Если `add_size < 0`, то с конца массива удаляются элементы.
//! Если `add_size < 0` и в массиве меньше элементов чем указано, то массив становится пустым. //! Если `add_size < 0` и в массиве меньше элементов чем указано, то массив становится пустым.
//! \~\sa \a resize() //! \~\sa \a resize()
inline PIByteArray & enlarge(ssize_t add_size, uchar e = 0) { inline PIByteArray & enlarge(ssize_t add_size, uchar e = 0) {
d.enlarge(add_size, e); d.enlarge(add_size, e);
return *this; return *this;
} }
//! \~english Remove no more than one element equal `e`. //! \~english Remove no more than one element equal `e`.
//! \~russian Удаляет первый элемент, который равен элементу `e`. //! \~russian Удаляет первый элемент, который равен элементу `e`.
//! \~\details //! \~\details
//! \~\sa \a remove(), \a removeAll(), \a removeWhere() //! \~\sa \a remove(), \a removeAll(), \a removeWhere()
inline PIByteArray & removeOne(uchar e) { inline PIByteArray & removeOne(uchar e) {
d.removeOne(e); d.removeOne(e);
return *this; return *this;
} }
//! \~english Remove all elements equal `e`. //! \~english Remove all elements equal `e`.
//! \~russian Удаляет все элементы, равные элементу `e`. //! \~russian Удаляет все элементы, равные элементу `e`.
//! \~\details //! \~\details
//! \~\sa \a remove(), \a removeOne(), \a removeWhere() //! \~\sa \a remove(), \a removeOne(), \a removeWhere()
inline PIByteArray & removeAll(uchar e) { inline PIByteArray & removeAll(uchar e) {
d.removeAll(e); d.removeAll(e);
return *this; return *this;
} }
//! \~english Remove all elements in the array //! \~english Remove all elements in the array
//! passes the test implemented by the provided function `test`. //! passes the test implemented by the provided function `test`.
//! \~russian Удаляет все элементы, удовлетворяющие условию, //! \~russian Удаляет все элементы, удовлетворяющие условию,
//! заданному в передаваемой функции `test`. //! заданному в передаваемой функции `test`.
//! \~\details //! \~\details
//! \~\sa \a remove(), \a removeOne(), \a removeWhere() //! \~\sa \a remove(), \a removeOne(), \a removeWhere()
inline PIByteArray & removeWhere(std::function<bool(uchar e)> test) { inline PIByteArray & removeWhere(std::function<bool(uchar e)> test) {
d.removeWhere(test); d.removeWhere(test);
return *this; return *this;
} }
//! \~english Appends the given element `e` to the end of the array. //! \~english Appends the given element `e` to the end of the array.
//! \~russian Добавляет элемент `e` в конец массива. //! \~russian Добавляет элемент `e` в конец массива.
//! \~\details //! \~\details
//! \~english If size() is less than capacity(), which is most often //! \~english If size() is less than capacity(), which is most often
//! then the addition will be very fast. //! then the addition will be very fast.
//! In any case, the addition is fast and does not depend on the size of the array. //! In any case, the addition is fast and does not depend on the size of the array.
//! If the new size() is greater than capacity() //! If the new size() is greater than capacity()
//! then all iterators and references //! then all iterators and references
//! (including the past-the-end iterator) are invalidated. //! (including the past-the-end iterator) are invalidated.
//! Otherwise only the past-the-end iterator is invalidated. //! Otherwise only the past-the-end iterator is invalidated.
//! \~russian Если size() меньше capacity(), что часто бывает, //! \~russian Если size() меньше capacity(), что часто бывает,
//! то добавление будет очень быстрым. //! то добавление будет очень быстрым.
//! В любом случае добавление быстрое и не зависит от размера массива. //! В любом случае добавление быстрое и не зависит от размера массива.
//! Если новый size() больше, чем capacity(), //! Если новый size() больше, чем capacity(),
//! то все итераторы и указатели становятся нерабочими. //! то все итераторы и указатели становятся нерабочими.
//! В противном случае все, кроме итераторов, указывающих на конец массива, //! В противном случае все, кроме итераторов, указывающих на конец массива,
//! остаются в рабочем состоянии. //! остаются в рабочем состоянии.
//! \~\sa \a push_front(), \a append(), \a prepend(), \a insert() //! \~\sa \a push_front(), \a append(), \a prepend(), \a insert()
inline PIByteArray & push_back(uchar e) { inline PIByteArray & push_back(uchar e) {
d.push_back(e); d.push_back(e);
return *this; return *this;
} }
//! \~english Appends the given elements to the end of the array. //! \~english Appends the given elements to the end of the array.
//! \~russian Добавляет элементы в конец массива. //! \~russian Добавляет элементы в конец массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Appends the given elements from //! Appends the given elements from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! Добавляет элементы из //! Добавляет элементы из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\sa \a push_back() //! \~\sa \a push_back()
inline PIByteArray & push_back(std::initializer_list<uchar> init_list) { inline PIByteArray & push_back(std::initializer_list<uchar> init_list) {
d.push_back(init_list); d.push_back(init_list);
return *this; return *this;
} }
//! \~english Appends the given array `v` to the end of the array. //! \~english Appends the given array `v` to the end of the array.
//! \~russian Добавляет массив `v` в конец массива. //! \~russian Добавляет массив `v` в конец массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! \~\sa \a push_back() //! \~\sa \a push_back()
inline PIByteArray & push_back(const PIByteArray & v) { inline PIByteArray & push_back(const PIByteArray & v) {
d.push_back(v.d); d.push_back(v.d);
return *this; return *this;
} }
//! \~english Add to the end data "data" with size "size" //! \~english Add to the end data "data" with size "size"
//! \~russian Добавляет в конец массива данные по указателю "data" размером "size" //! \~russian Добавляет в конец массива данные по указателю "data" размером "size"
PIByteArray & push_back(const void * data_, int size_) {uint ps = size(); enlarge(size_); memcpy(data(ps), data_, size_); return *this;} PIByteArray & push_back(const void * data_, int size_) {uint ps = size(); enlarge(size_); memcpy(data(ps), data_, size_); return *this;}
//! \~english Appends the given element `e` to the begin of the array. //! \~english Appends the given element `e` to the begin of the array.
//! \~russian Добавляет элемент `e` в начало массива. //! \~russian Добавляет элемент `e` в начало массива.
//! \~\details //! \~\details
//! \~english If there is free space at the beginning of the array, //! \~english If there is free space at the beginning of the array,
//! which is most often, then the addition will be very fast. //! which is most often, then the addition will be very fast.
//! In any case, the addition is fast and does not depend on the size of the array. //! In any case, the addition is fast and does not depend on the size of the array.
//! If there is no free space at the beginning of the array //! If there is no free space at the beginning of the array
//! then all iterators and references //! then all iterators and references
//! (including the past-the-begin iterator) are invalidated. //! (including the past-the-begin iterator) are invalidated.
//! Otherwise only the past-the-begin iterator is invalidated. //! Otherwise only the past-the-begin iterator is invalidated.
//! \~russian Если в начале массива имеется свободное место, //! \~russian Если в начале массива имеется свободное место,
//! что часто бывает, то добавление будет очень быстрым. //! что часто бывает, то добавление будет очень быстрым.
//! В любом случае добавление быстрое и не зависит от размера массива. //! В любом случае добавление быстрое и не зависит от размера массива.
//! Если в начале массива нет свободного места, //! Если в начале массива нет свободного места,
//! то все итераторы и указатели становятся нерабочими. //! то все итераторы и указатели становятся нерабочими.
//! В противном случае все, кроме итераторов указывающих, на начало массива, //! В противном случае все, кроме итераторов указывающих, на начало массива,
//! остаются в рабочем состоянии. //! остаются в рабочем состоянии.
//! \~\sa \a push_back(), \a append(), \a prepend(), \a insert() //! \~\sa \a push_back(), \a append(), \a prepend(), \a insert()
inline PIByteArray & push_front(uchar e) { inline PIByteArray & push_front(uchar e) {
d.push_front(e); d.push_front(e);
return *this; return *this;
} }
//! \~english Appends the given array `v` to the begin of the array. //! \~english Appends the given array `v` to the begin of the array.
//! \~russian Добавляет массив `v` в начало массива. //! \~russian Добавляет массив `v` в начало массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! \~\sa \a push_front() //! \~\sa \a push_front()
inline PIByteArray & push_front(const PIByteArray & v) { inline PIByteArray & push_front(const PIByteArray & v) {
d.push_front(v.d); d.push_front(v.d);
return *this; return *this;
} }
//! \~english Appends the given elements to the begin of the array. //! \~english Appends the given elements to the begin of the array.
//! \~russian Добавляет элементы в начало массива. //! \~russian Добавляет элементы в начало массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Appends the given elements from //! Appends the given elements from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! Добавляет элементы из //! Добавляет элементы из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\sa \a append() //! \~\sa \a append()
inline PIByteArray & push_front(std::initializer_list<uchar> init_list) { inline PIByteArray & push_front(std::initializer_list<uchar> init_list) {
d.push_front(init_list); d.push_front(init_list);
return *this; return *this;
} }
//! \~english Appends the given element `e` to the begin of the array. //! \~english Appends the given element `e` to the begin of the array.
//! \~russian Добавляет элемент `e` в начало массива. //! \~russian Добавляет элемент `e` в начало массива.
//! \~\details //! \~\details
//! \~english If there is free space at the beginning of the array, //! \~english If there is free space at the beginning of the array,
//! which is most often, then the addition will be very fast. //! which is most often, then the addition will be very fast.
//! In any case, the addition is fast and does not depend on the size of the array. //! In any case, the addition is fast and does not depend on the size of the array.
//! If there is no free space at the beginning of the array //! If there is no free space at the beginning of the array
//! then all iterators and references //! then all iterators and references
//! (including the past-the-begin iterator) are invalidated. //! (including the past-the-begin iterator) are invalidated.
//! Otherwise only the past-the-begin iterator is invalidated. //! Otherwise only the past-the-begin iterator is invalidated.
//! \~russian Если в начале массива имеется свободное место, //! \~russian Если в начале массива имеется свободное место,
//! что часто бывает, то добавление будет очень быстрым. //! что часто бывает, то добавление будет очень быстрым.
//! В любом случае добавление быстрое и не зависит от размера массива. //! В любом случае добавление быстрое и не зависит от размера массива.
//! Если в начале массива нет свободного места, //! Если в начале массива нет свободного места,
//! то все итераторы и указатели становятся нерабочими. //! то все итераторы и указатели становятся нерабочими.
//! В противном случае все, кроме итераторов указывающих, на начало массива, //! В противном случае все, кроме итераторов указывающих, на начало массива,
//! остаются в рабочем состоянии. //! остаются в рабочем состоянии.
//! \~\sa \a push_back(), \a append(), \a prepend(), \a insert() //! \~\sa \a push_back(), \a append(), \a prepend(), \a insert()
inline PIByteArray & prepend(uchar e) { inline PIByteArray & prepend(uchar e) {
d.prepend(e); d.prepend(e);
return *this; return *this;
} }
//! \~english Appends the given array `v` to the begin of the array. //! \~english Appends the given array `v` to the begin of the array.
//! \~russian Добавляет массив `v` в начало массива. //! \~russian Добавляет массив `v` в начало массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! \~\sa \a prepend() //! \~\sa \a prepend()
inline PIByteArray & prepend(const PIByteArray & v) { inline PIByteArray & prepend(const PIByteArray & v) {
d.prepend(v.d); d.prepend(v.d);
return *this; return *this;
} }
//! \~english Appends the given elements to the begin of the array. //! \~english Appends the given elements to the begin of the array.
//! \~russian Добавляет элементы в начало массива. //! \~russian Добавляет элементы в начало массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Appends the given elements from //! Appends the given elements from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! Добавляет элементы из //! Добавляет элементы из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\sa \a append() //! \~\sa \a append()
inline PIByteArray & prepend(std::initializer_list<uchar> init_list) { inline PIByteArray & prepend(std::initializer_list<uchar> init_list) {
d.prepend(init_list); d.prepend(init_list);
return *this; return *this;
} }
//! \~english Remove one element from the end of the array. //! \~english Remove one element from the end of the array.
//! \~russian Удаляет один элемент с конца массива. //! \~russian Удаляет один элемент с конца массива.
//! \~\details //! \~\details
//! \~english Deleting an element from the end is very fast //! \~english Deleting an element from the end is very fast
//! and does not depend on the size of the array. //! and does not depend on the size of the array.
//! \~russian Удаление элемента с конца выполняется очень быстро //! \~russian Удаление элемента с конца выполняется очень быстро
//! и не зависит от размера массива. //! и не зависит от размера массива.
//! \~\sa \a pop_front(), \a take_back(), \a take_front() //! \~\sa \a pop_front(), \a take_back(), \a take_front()
inline PIByteArray & pop_back() { inline PIByteArray & pop_back() {
d.pop_back(); d.pop_back();
return *this; return *this;
} }
//! \~english Remove one element from the begining of the array. //! \~english Remove one element from the begining of the array.
//! \~russian Удаляет один элемент с начала массива. //! \~russian Удаляет один элемент с начала массива.
//! \~\details //! \~\details
//! \~english Removing an element from the beginning takes longer than from the end. //! \~english Removing an element from the beginning takes longer than from the end.
//! This time is directly proportional to the size of the array. //! This time is directly proportional to the size of the array.
//! All iterators and references are invalidated. //! All iterators and references are invalidated.
//! \~russian Удаление элемента с начала выполняется дольше, чем с конца. //! \~russian Удаление элемента с начала выполняется дольше, чем с конца.
//! Это время прямопропорционально размеру массива. //! Это время прямопропорционально размеру массива.
//! При удалении элемента все итераторы и указатели становятся нерабочими. //! При удалении элемента все итераторы и указатели становятся нерабочими.
//! \~\sa \a pop_back(), \a take_back(), \a take_front() //! \~\sa \a pop_back(), \a take_back(), \a take_front()
inline PIByteArray & pop_front() { inline PIByteArray & pop_front() {
d.pop_front(); d.pop_front();
return *this; return *this;
} }
//! \~english Remove one element from the end of the array and return it. //! \~english Remove one element from the end of the array and return it.
//! \~russian Удаляет один элемент с начала массива и возвращает его. //! \~russian Удаляет один элемент с начала массива и возвращает его.
//! \~\details //! \~\details
//! \~\sa \a take_front(), \a pop_back(), \a pop_front() //! \~\sa \a take_front(), \a pop_back(), \a pop_front()
inline uchar take_back() { inline uchar take_back() {
return d.take_back(); return d.take_back();
} }
//! \~english Remove one element from the begining of the array and return it. //! \~english Remove one element from the begining of the array and return it.
//! \~russian Удаляет один элемент с конца массива и возвращает его. //! \~russian Удаляет один элемент с конца массива и возвращает его.
//! \~\details //! \~\details
//! \~\sa \a take_front(), \a pop_back(), \a pop_front() //! \~\sa \a take_front(), \a pop_back(), \a pop_front()
inline uchar take_front() { inline uchar take_front() {
return d.take_front(); return d.take_front();
} }
//! \~english Returns a new array with all elements //! \~english Returns a new array with all elements
//! that pass the test implemented by the provided function `test`. //! that pass the test implemented by the provided function `test`.
//! \~russian Возвращает новый массив со всеми элементами, //! \~russian Возвращает новый массив со всеми элементами,
//! прошедшими проверку, задаваемую в передаваемой функции `test`. //! прошедшими проверку, задаваемую в передаваемой функции `test`.
//! \~\details //! \~\details
//! \~\code //! \~\code
//! PIByteArray v{3, 2, 5, 2, 7}; //! PIByteArray v{3, 2, 5, 2, 7};
//! PIByteArray v2 = v.filter([](const uchar & i){return i > 2;}); //! PIByteArray v2 = v.filter([](const uchar & i){return i > 2;});
//! piCout << v2; // {3, 5, 7} //! piCout << v2; // {3, 5, 7}
//! \endcode //! \endcode
//! \~\sa \a map(), \a any(), \a every() //! \~\sa \a map(), \a any(), \a every()
inline PIByteArray filter(std::function<bool(const uchar & e)> test) const { inline PIByteArray filter(std::function<bool(const uchar & e)> test) const {
return PIByteArray(d.filter(test)); return PIByteArray(d.filter(test));
} }
//! \~english Execute function `void f(const uchar & e)` for every element in array. //! \~english Execute function `void f(const uchar & e)` for every element in array.
//! \~russian Выполняет функцию `void f(const uchar & e)` для каждого элемента массива. //! \~russian Выполняет функцию `void f(const uchar & e)` для каждого элемента массива.
//! \~\details //! \~\details
//! \~russian Не позволяет изменять элементы массива. //! \~russian Не позволяет изменять элементы массива.
//! Для редактирования элементов используйте функцию вида `void f(uchar & e)`. //! Для редактирования элементов используйте функцию вида `void f(uchar & e)`.
//! \~english Does not allow changing array elements. //! \~english Does not allow changing array elements.
//! To edit elements, use the function like `void f(T & e)` //! To edit elements, use the function like `void f(T & e)`
//! \~\code //! \~\code
//! PIByteArray v{1, 2, 3, 4, 5}; //! PIByteArray v{1, 2, 3, 4, 5};
//! int s = 0; //! int s = 0;
//! v.forEach([&s](const uchar & e){s += e;}); //! v.forEach([&s](const uchar & e){s += e;});
//! piCout << s; // 15 //! piCout << s; // 15
//! \endcode //! \endcode
//! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every() //! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every()
inline void forEach(std::function<void(const uchar & e)> f) const { inline void forEach(std::function<void(const uchar & e)> f) const {
d.forEach(f); d.forEach(f);
} }
//! \~english Execute function `void f(uchar & e)` for every element in array. //! \~english Execute function `void f(uchar & e)` for every element in array.
//! \~russian Выполняет функцию `void f(uchar & e)` для каждого элемента массива. //! \~russian Выполняет функцию `void f(uchar & e)` для каждого элемента массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Allows you to change the elements of the array. //! Allows you to change the elements of the array.
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! Позволяет изменять элементы массива. //! Позволяет изменять элементы массива.
//! \~\code //! \~\code
//! PIByteArray v{1, 2, 3, 4, 5}; //! PIByteArray v{1, 2, 3, 4, 5};
//! v.forEach([](uchar & e){e++;}); //! v.forEach([](uchar & e){e++;});
//! piCout << v; // {2, 3, 4, 5, 6} //! piCout << v; // {2, 3, 4, 5, 6}
//! \endcode //! \endcode
//! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every() //! \~\sa \a filter(), \a map(), \a reduce(), \a any(), \a every()
inline PIByteArray & forEach(std::function<void(uchar & e)> f) { inline PIByteArray & forEach(std::function<void(uchar & e)> f) {
d.forEach(f); d.forEach(f);
return *this; return *this;
} }
//! \~english Сreates a new array populated with the results //! \~english Сreates a new array populated with the results
//! of calling a provided function `ST f(const uchar & e)` on every element in the calling array. //! of calling a provided function `ST f(const uchar & e)` on every element in the calling array.
//! \~russian Создаёт новый массив с результатом вызова указанной функции //! \~russian Создаёт новый массив с результатом вызова указанной функции
//! `ST f(const T & e)` для каждого элемента массива. //! `ST f(const T & e)` для каждого элемента массива.
//! \~\details //! \~\details
//! \~english Calls a provided function`ST f(const uchar & e)` //! \~english Calls a provided function`ST f(const uchar & e)`
//! once for each element in an array, in order, //! once for each element in an array, in order,
//! and constructs a new array from the results. //! and constructs a new array from the results.
//! \~russian Метод `map` вызывает переданную функцию `ST f(const uchar & e)` //! \~russian Метод `map` вызывает переданную функцию `ST f(const uchar & e)`
//! один раз для каждого элемента в порядке их появления //! один раз для каждого элемента в порядке их появления
//! и конструирует новый массив из результатов её вызова. //! и конструирует новый массив из результатов её вызова.
//! \~\code //! \~\code
//! PIByteArray v{0x31, 0x0A, 0xFF}; //! PIByteArray v{0x31, 0x0A, 0xFF};
//! PIStringList sl = v.map<PIString>([](const uchar & i){return PIString::fromNumber(i, 16);}); //! PIStringList sl = v.map<PIString>([](const uchar & i){return PIString::fromNumber(i, 16);});
//! piCout << sl; {"31", "A", "FF"} //! piCout << sl; {"31", "A", "FF"}
//! \endcode //! \endcode
//! \~\sa \a forEach(), \a reduce() //! \~\sa \a forEach(), \a reduce()
template <typename ST> template <typename ST>
inline PIDeque<ST> map(std::function<ST(const uchar & e)> f) const { inline PIDeque<ST> map(std::function<ST(const uchar & e)> f) const {
return d.map<ST>(f); return d.map<ST>(f);
} }
//! \~english Applies the function `ST f(const uchar & e, const ST & acc)` //! \~english Applies the function `ST f(const uchar & e, const ST & acc)`
//! to each element of the array (from left to right), returns one value. //! to each element of the array (from left to right), returns one value.
//! \~russian Применяет функцию `ST f(const uchar & e, const ST & acc)` //! \~russian Применяет функцию `ST f(const uchar & e, const ST & acc)`
//! к каждому элементу массива (слева-направо), возвращает одно значение. //! к каждому элементу массива (слева-направо), возвращает одно значение.
//! \~\details //! \~\details
//! \~english The reduce() method performs the `f` function //! \~english The reduce() method performs the `f` function
//! once for each element in the array. //! once for each element in the array.
//! If the `initial` argument is passed when calling reduce(), //! If the `initial` argument is passed when calling reduce(),
//! then when the function `f` is called for the first time, //! then when the function `f` is called for the first time,
//! the value of `acc` will be assigned to `initial`. //! the value of `acc` will be assigned to `initial`.
//! If the array is empty, the value `initial` will be returned. //! If the array is empty, the value `initial` will be returned.
//! \param f is a function like `ST f(const uchar & e, const ST & acc)`, //! \param f is a function like `ST f(const uchar & e, const ST & acc)`,
//! executed for each element of the array. It takes two arguments: //! executed for each element of the array. It takes two arguments:
//! * **e** - current element of the array //! * **e** - current element of the array
//! * **acc** - accumulator accumulating the value //! * **acc** - accumulator accumulating the value
//! which this function returns after visiting the next element //! which this function returns after visiting the next element
//! //!
//! \param initial _optional_ Object used as the second argument //! \param initial _optional_ Object used as the second argument
//! when the `f` function is first called. //! when the `f` function is first called.
//! \~russian Метод reduce() выполняет функцию `f` //! \~russian Метод reduce() выполняет функцию `f`
//! один раз для каждого элемента, присутствующего в массиве. //! один раз для каждого элемента, присутствующего в массиве.
//! Если при вызове reduce() передан аргумент `initial`, //! Если при вызове reduce() передан аргумент `initial`,
//! то при первом вызове функции `f` значение `acc` //! то при первом вызове функции `f` значение `acc`
//! будет равным значению `initial`. //! будет равным значению `initial`.
//! Если массив пустой то будет возвращено значение `initial`. //! Если массив пустой то будет возвращено значение `initial`.
//! \param f Функция, вида `ST f(const uchar & e, const ST & acc)`, //! \param f Функция, вида `ST f(const uchar & e, const ST & acc)`,
//! выполняющаяся для каждого элемента массива. //! выполняющаяся для каждого элемента массива.
//! Она принимает два аргумента: //! Она принимает два аргумента:
//! * **e** - текущий элемент массива //! * **e** - текущий элемент массива
//! * **acc** - аккумулятор, аккумулирующий значение //! * **acc** - аккумулятор, аккумулирующий значение
//! которое возвращает эта функция после посещения очередного элемента //! которое возвращает эта функция после посещения очередного элемента
//! //!
//! \param initial _опциональный_ Объект, //! \param initial _опциональный_ Объект,
//! используемый в качестве второго аргумента при первом вызове функции `f`. //! используемый в качестве второго аргумента при первом вызове функции `f`.
//! //!
//! \~\code //! \~\code
//! PIByteArray v{1, 2, 3, 4, 5}; //! PIByteArray v{1, 2, 3, 4, 5};
//! PIString s = v.reduce<PIString>([](const uchar & e, const PIString & acc){return acc + PIString::fromNumber(e);}); //! PIString s = v.reduce<PIString>([](const uchar & e, const PIString & acc){return acc + PIString::fromNumber(e);});
//! piCout << s; // "12345" //! piCout << s; // "12345"
//! \endcode //! \endcode
//! \~\sa \a forEach(), \a map() //! \~\sa \a forEach(), \a map()
template <typename ST> template <typename ST>
inline ST reduce(std::function<ST(const uchar & e, const ST & acc)> f, const ST & initial = ST()) const { inline ST reduce(std::function<ST(const uchar & e, const ST & acc)> f, const ST & initial = ST()) const {
return d.reduce<ST>(f, initial); return d.reduce<ST>(f, initial);
} }
//! \~english Convert data to Base 64 and return this byte array //! \~english Convert data to Base 64 and return this byte array
//! \~russian Преобразует данные в Base 64 и возвращает текущий массив //! \~russian Преобразует данные в Base 64 и возвращает текущий массив
PIByteArray & convertToBase64(); PIByteArray & convertToBase64();
//! \~english Convert data from Base 64 and return this byte array //! \~english Convert data from Base 64 and return this byte array
//! \~russian Преобразует данные из Base 64 и возвращает текущий массив //! \~russian Преобразует данные из Base 64 и возвращает текущий массив
PIByteArray & convertFromBase64(); PIByteArray & convertFromBase64();
//! \~english Return converted to Base 64 data //! \~english Return converted to Base 64 data
//! \~russian Возвращает копию байтового массива, преобразованного в Base 64 //! \~russian Возвращает копию байтового массива, преобразованного в Base 64
PIByteArray toBase64() const; PIByteArray toBase64() const;
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;}
//! \~english Return string representation of data, each byte in "base" base, separated by spaces //! \~english Return string representation of data, each byte in "base" base, separated by spaces
//! \~russian Возвращает текстовое представление байтового массива, каждый байт в "base" системе, с пробелами //! \~russian Возвращает текстовое представление байтового массива, каждый байт в "base" системе, с пробелами
PIString toString(int base = 16) const; PIString toString(int base = 16) const;
//! \~english //! \~english
//! Returns a hex encoded copy of the byte array, without spaces. //! Returns a hex encoded copy of the byte array, without spaces.
//! The hex encoding uses the numbers 0-9 and the letters a-f. //! The hex encoding uses the numbers 0-9 and the letters a-f.
//! \~russian //! \~russian
//! Возвращает шестнадцатеричное представление массива, без пробелов. //! Возвращает шестнадцатеричное представление массива, без пробелов.
//! Оно использует цифры 0-9 и буквы a-f. //! Оно использует цифры 0-9 и буквы a-f.
PIString toHex() const; PIString toHex() const;
//! \~english Add to the end data "data" with size "size" //! \~english Add to the end data "data" with size "size"
//! \~russian Добавляет в конец массива данные по указателю "data" размером "size" //! \~russian Добавляет в конец массива данные по указателю "data" размером "size"
PIByteArray & append(const void * data_, int size_) {uint ps = size(); enlarge(size_); memcpy(data(ps), data_, size_); return *this;} PIByteArray & append(const void * data_, int size_) {uint ps = size(); enlarge(size_); memcpy(data(ps), data_, size_); return *this;}
//! \~english Add to the end byte array "data" //! \~english Add to the end byte array "data"
//! \~russian Добавляет в конец массива содержимое массива "data" //! \~russian Добавляет в конец массива содержимое массива "data"
PIByteArray & append(const PIByteArray & data_) {uint ps = size(); enlarge(data_.size_s()); memcpy(data(ps), data_.data(), data_.size()); return *this;} PIByteArray & append(const PIByteArray & data_) {uint ps = size(); enlarge(data_.size_s()); memcpy(data(ps), data_.data(), data_.size()); return *this;}
//! \~english Add to the end "t" //! \~english Add to the end "t"
//! \~russian Добавляет в конец массива байт "t" //! \~russian Добавляет в конец массива байт "t"
PIByteArray & append(uchar t) {push_back(t); return *this;} PIByteArray & append(uchar t) {push_back(t); return *this;}
//! \~english Appends the given elements to the end of the array. //! \~english Appends the given elements to the end of the array.
//! \~russian Добавляет элементы в конец массива. //! \~russian Добавляет элементы в конец массива.
//! \~\details //! \~\details
//! \~english Overloaded function. //! \~english Overloaded function.
//! Appends the given elements from //! Appends the given elements from
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list). //! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
//! \~russian Перегруженая функция. //! \~russian Перегруженая функция.
//! Добавляет элементы из //! Добавляет элементы из
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list). //! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
//! \~\sa \a push_back() //! \~\sa \a push_back()
inline PIByteArray & append(std::initializer_list<uchar> init_list) { inline PIByteArray & append(std::initializer_list<uchar> init_list) {
d.append(init_list); d.append(init_list);
return *this; return *this;
} }
//! \~english Returns 8-bit checksum //! \~english Returns 8-bit checksum
//! \~russian Возвращает 8-битную контрольную сумму //! \~russian Возвращает 8-битную контрольную сумму
uchar checksumPlain8(bool inverse = true) const; uchar checksumPlain8(bool inverse = true) const;
//! \~english Returns 32-bit checksum //! \~english Returns 32-bit checksum
//! \~russian Возвращает 32-битную контрольную сумму //! \~russian Возвращает 32-битную контрольную сумму
uint checksumPlain32(bool inverse = true) const; uint checksumPlain32(bool inverse = true) const;
//! \~english Returns 8-bit checksum CRC-8 //! \~english Returns 8-bit checksum CRC-8
//! \~russian Возвращает 8-битную контрольную сумму CRC-8 //! \~russian Возвращает 8-битную контрольную сумму CRC-8
uchar checksumCRC8() const; uchar checksumCRC8() const;
//! \~english Returns 16-bit checksum CRC-16 //! \~english Returns 16-bit checksum CRC-16
//! \~russian Возвращает 16-битную контрольную сумму CRC-16 //! \~russian Возвращает 16-битную контрольную сумму CRC-16
ushort checksumCRC16() const; ushort checksumCRC16() const;
//! \~english Returns 32-bit checksum CRC-32 //! \~english Returns 32-bit checksum CRC-32
//! \~russian Возвращает 32-битную контрольную сумму CRC-32 //! \~russian Возвращает 32-битную контрольную сумму CRC-32
uint checksumCRC32() const; uint checksumCRC32() const;
//! \~english Returns hash of content //! \~english Returns hash of content
//! \~russian Возвращает хэш содержимого //! \~russian Возвращает хэш содержимого
uint hash() const; uint hash() const;
void operator =(const PIDeque<uchar> & o) {resize(o.size()); memcpy(data(), o.data(), o.size());} void operator =(const PIDeque<uchar> & o) {resize(o.size()); memcpy(data(), o.data(), o.size());}
PIByteArray & operator =(const PIByteArray & o) {if (this == &o) return *this; clear(); append(o); return *this;} PIByteArray & operator =(const PIByteArray & o) {if (this == &o) return *this; clear(); append(o); return *this;}
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);
//! \~english Return converted from Base 64 data //! \~english Return converted from Base 64 data
//! \~russian Возвращает массив из Base 64 представления //! \~russian Возвращает массив из Base 64 представления
static PIByteArray fromBase64(const PIByteArray & base64); static PIByteArray fromBase64(const PIByteArray & base64);
static PIByteArray fromBase64(const PIString & base64); static PIByteArray fromBase64(const PIString & base64);
bool binaryStreamAppendImp(const void * d_, size_t s) { bool binaryStreamAppendImp(const void * d_, size_t s) {
append(d_, s); append(d_, s);
return true; return true;
} }
bool binaryStreamTakeImp(void * d_, size_t s) { bool binaryStreamTakeImp(void * d_, size_t s) {
size_t rs = size(); size_t rs = size();
if (rs > s) rs = s; if (rs > s) rs = s;
memcpy(d_, data(), rs); memcpy(d_, data(), rs);
remove(0, rs); remove(0, rs);
return rs == s; return rs == s;
} }
ssize_t binaryStreamSizeImp() const {return size();} ssize_t binaryStreamSizeImp() const {return size();}
private: private:
PIDeque<uchar> d; PIDeque<uchar> d;
}; };
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Byte arrays compare operator //! \~english Byte arrays compare operator
//! \~russian Оператор сравнения //! \~russian Оператор сравнения
inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) { inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {
if (v0.size() == v1.size()) { if (v0.size() == v1.size()) {
if (v0.isEmpty()) return false; if (v0.isEmpty()) return false;
return memcmp(v0.data(), v1.data(), v0.size()) < 0; return memcmp(v0.data(), v1.data(), v0.size()) < 0;
} }
return v0.size() < v1.size(); return v0.size() < v1.size();
} }
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Byte arrays compare operator //! \~english Byte arrays compare operator
//! \~russian Оператор сравнения //! \~russian Оператор сравнения
inline bool operator >(const PIByteArray & v0, const PIByteArray & v1) { inline bool operator >(const PIByteArray & v0, const PIByteArray & v1) {
if (v0.size() == v1.size()) { if (v0.size() == v1.size()) {
if (v0.isEmpty()) return false; if (v0.isEmpty()) return false;
return memcmp(v0.data(), v1.data(), v0.size()) > 0; return memcmp(v0.data(), v1.data(), v0.size()) > 0;
} }
return v0.size() > v1.size(); return v0.size() > v1.size();
} }
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Byte arrays compare operator //! \~english Byte arrays compare operator
//! \~russian Оператор сравнения //! \~russian Оператор сравнения
inline bool operator ==(const PIByteArray & v0, const PIByteArray & v1) { inline bool operator ==(const PIByteArray & v0, const PIByteArray & v1) {
if (v0.size() == v1.size()) { if (v0.size() == v1.size()) {
if (v0.isEmpty()) return true; if (v0.isEmpty()) return true;
return memcmp(v0.data(), v1.data(), v0.size()) == 0; return memcmp(v0.data(), v1.data(), v0.size()) == 0;
} }
return false; return false;
} }
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Byte arrays compare operator //! \~english Byte arrays compare operator
//! \~russian Оператор сравнения //! \~russian Оператор сравнения
inline bool operator !=(const PIByteArray & v0, const PIByteArray & v1) { inline bool operator !=(const PIByteArray & v0, const PIByteArray & v1) {
if (v0.size() == v1.size()) { if (v0.size() == v1.size()) {
if (v0.isEmpty()) return false; if (v0.isEmpty()) return false;
return memcmp(v0.data(), v1.data(), v0.size()) != 0; return memcmp(v0.data(), v1.data(), v0.size()) != 0;
} }
return true; return true;
} }
#ifdef PIP_STD_IOSTREAM #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); inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba);
#endif #endif
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Output operator to \a PICout //! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout //! \~russian Оператор вывода в \a PICout
PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba); PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba);
//! \relatesalso PIBinaryStream //! \relatesalso PIBinaryStream
//! \~english Store operator. //! \~english Store operator.
//! \~russian Оператор сохранения. //! \~russian Оператор сохранения.
BINARY_STREAM_WRITE(PIByteArray) { BINARY_STREAM_WRITE(PIByteArray) {
s.binaryStreamAppend((int)v.size_s()); s.binaryStreamAppend((int)v.size_s());
s.binaryStreamAppend(v.data(), v.size()); s.binaryStreamAppend(v.data(), v.size());
return s; return s;
} }
//! \relatesalso PIBinaryStream //! \relatesalso PIBinaryStream
//! \~english Restore operator. //! \~english Restore operator.
//! \~russian Оператор извлечения. //! \~russian Оператор извлечения.
BINARY_STREAM_READ(PIByteArray) { BINARY_STREAM_READ(PIByteArray) {
v.resize(s.binaryStreamTakeInt()); v.resize(s.binaryStreamTakeInt());
s.binaryStreamTake(v.data(), v.size()); s.binaryStreamTake(v.data(), v.size());
return s; return s;
} }
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Returns PIByteArray::hash() of "ba" //! \~english Returns PIByteArray::hash() of "ba"
//! \~russian Возвращает PIByteArray::hash() от "ba" //! \~russian Возвращает PIByteArray::hash() от "ba"
template<> inline uint piHash(const PIByteArray & ba) {return ba.hash();} template<> inline uint piHash(const PIByteArray & ba) {return ba.hash();}
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Swap contents betwee "f" and "s" //! \~english Swap contents betwee "f" and "s"
//! \~russian Меняет содержимое массивов "f" и "s" //! \~russian Меняет содержимое массивов "f" и "s"
template<> inline void piSwap(PIByteArray & f, PIByteArray & s) {f.swap(s);} template<> inline void piSwap(PIByteArray & f, PIByteArray & s) {f.swap(s);}
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Store "value" to bytearray and returns it //! \~english Store "value" to bytearray and returns it
//! \~russian Сохраняет "value" в байтовый массив и возвращает его //! \~russian Сохраняет "value" в байтовый массив и возвращает его
template <typename T> PIByteArray piSerialize(const T & value) { template <typename T> PIByteArray piSerialize(const T & value) {
PIByteArray ret; PIByteArray ret;
ret << value; ret << value;
return ret; return ret;
} }
//! \relatesalso PIByteArray //! \relatesalso PIByteArray
//! \~english Restore type "T" from bytearray "data" and returns it //! \~english Restore type "T" from bytearray "data" and returns it
//! \~russian Извлекает тип "T" из байтового массива "data" и возвращает его //! \~russian Извлекает тип "T" из байтового массива "data" и возвращает его
template <typename T> T piDeserialize(const PIByteArray & data) { template <typename T> T piDeserialize(const PIByteArray & data) {
T ret; T ret;
if (!data.isEmpty()) { if (!data.isEmpty()) {
PIByteArray ba(data); PIByteArray ba(data);
ba >> ret; ba >> ret;
} }
return ret; return ret;
} }
#endif // PIBYTEARRAY_H #endif // PIBYTEARRAY_H

View File

@@ -33,7 +33,7 @@
# include <sys/time.h> # include <sys/time.h>
#endif #endif
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! //!
//! \~\class PITime pidatetime.h //! \~\class PITime pidatetime.h

View File

@@ -1,5 +1,5 @@
/*! \file pidatetime.h /*! \file pidatetime.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english Time and date structs * \~english Time and date structs
* \~russian Типы времени и даты * \~russian Типы времени и даты
@@ -30,7 +30,7 @@
#include "pisystemtime.h" #include "pisystemtime.h"
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english Calendar time. //! \~english Calendar time.
//! \~russian Календарное время. //! \~russian Календарное время.
@@ -106,7 +106,7 @@ PIP_EXPORT PICout operator <<(PICout s, const PITime & v);
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english Calendar date. //! \~english Calendar date.
//! \~russian Календарная дата. //! \~russian Календарная дата.
@@ -170,7 +170,7 @@ PIP_EXPORT PICout operator <<(PICout s, const PIDate & v);
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english Calendar date and time. //! \~english Calendar date and time.
//! \~russian Календарное дата и время. //! \~russian Календарное дата и время.

View File

@@ -1,5 +1,5 @@
/*! \file piflags.h /*! \file piflags.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english General flags class * \~english General flags class
* \~russian Универсальные флаги * \~russian Универсальные флаги
@@ -28,7 +28,7 @@
#include "pip_export.h" #include "pip_export.h"
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\class PIFlags piflags.h //! \~\class PIFlags piflags.h
//! \~\brief //! \~\brief

View File

@@ -1,5 +1,5 @@
/*! \file pipropertystorage.h /*! \file pipropertystorage.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english Properties array * \~english Properties array
* \~russian Массив свойств * \~russian Массив свойств
@@ -29,7 +29,7 @@
#include "pivariant.h" #include "pivariant.h"
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english This class provides key-value properties storage. //! \~english This class provides key-value properties storage.
//! \~russian Этот класс предоставляет ключ-значение хранение свойств. //! \~russian Этот класс предоставляет ключ-значение хранение свойств.
@@ -40,7 +40,7 @@ public:
//! \~russian Создает пустой %PIPropertyStorage //! \~russian Создает пустой %PIPropertyStorage
PIPropertyStorage() {} PIPropertyStorage() {}
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english PIPropertyStorage element. //! \~english PIPropertyStorage element.
//! \~russian Элемент PIPropertyStorage. //! \~russian Элемент PIPropertyStorage.

View File

@@ -1,5 +1,5 @@
/*! \file pisystemtime.h /*! \file pisystemtime.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english System time structs and methods * \~english System time structs and methods
* \~russian Типы и методы системного времени * \~russian Типы и методы системного времени
@@ -30,7 +30,7 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english System time with nanosecond precision. //! \~english System time with nanosecond precision.
//! \~russian Системное время с точностью до наносекунд. //! \~russian Системное время с точностью до наносекунд.
@@ -191,7 +191,7 @@ inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.saveAn
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english Time measurements. //! \~english Time measurements.
//! \~russian Измерение времени. //! \~russian Измерение времени.

View File

@@ -1,5 +1,5 @@
/*! \file pitime.h /*! \file pitime.h
* \ingroup Core * \ingroup Types
* \~\brief * \~\brief
* \~english System time, time and date * \~english System time, time and date
* \~russian Системное время, время и дата * \~russian Системное время, время и дата
@@ -27,12 +27,12 @@
#include "pidatetime.h" #include "pidatetime.h"
//! \ingroup Core //! \ingroup Types
//! \~english Precise sleep for "usecs" microseconds //! \~english Precise sleep for "usecs" microseconds
//! \~russian Точно ожидает "usecs" микросекунд //! \~russian Точно ожидает "usecs" микросекунд
PIP_EXPORT void piUSleep(int usecs); // on !Windows consider constant "usleep" offset PIP_EXPORT void piUSleep(int usecs); // on !Windows consider constant "usleep" offset
//! \ingroup Core //! \ingroup Types
//! \brief //! \brief
//! \~english Precise sleep for "msecs" milliseconds //! \~english Precise sleep for "msecs" milliseconds
//! \~russian Точно ожидает "msecs" миллисекунд //! \~russian Точно ожидает "msecs" миллисекунд
@@ -41,7 +41,7 @@ PIP_EXPORT void piUSleep(int usecs); // on !Windows consider constant "usleep" o
//! \~russian Этот метод вызывает \a piUSleep (msecs * 1000) //! \~russian Этот метод вызывает \a piUSleep (msecs * 1000)
inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Windows consider constant "usleep" offset inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Windows consider constant "usleep" offset
//! \ingroup Core //! \ingroup Types
//! \brief //! \brief
//! \~english Precise sleep for "secs" seconds //! \~english Precise sleep for "secs" seconds
//! \~russian Точно ожидает "secs" секунд //! \~russian Точно ожидает "secs" секунд
@@ -50,7 +50,7 @@ inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Window
//! \~russian Этот метод вызывает \a piUSleep (msecs * 1000000) //! \~russian Этот метод вызывает \a piUSleep (msecs * 1000000)
inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset
//! \ingroup Core //! \ingroup Types
//! \~english Shortest available on current system sleep //! \~english Shortest available on current system sleep
//! \~russian Наименее возможное для данной системы по длительности ожидание //! \~russian Наименее возможное для данной системы по длительности ожидание
inline void piMinSleep() {piMSleep(PIP_MIN_MSLEEP);} inline void piMinSleep() {piMSleep(PIP_MIN_MSLEEP);}

View File

@@ -1,5 +1,5 @@
/*! \file pitime_win.h /*! \file pitime_win.h
* \ingroup Core * \ingroup Types
* \brief * \brief
* \~english PITime conversions for Windows * \~english PITime conversions for Windows
* \~russian Преобразования PITime для Windows * \~russian Преобразования PITime для Windows

View File

@@ -0,0 +1,61 @@
/*
PIP - Platform Independent Primitives
Module includes
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//! \defgroup Types Types
//! \~\brief
//! \~english Basic types.
//! \~russian Базовые типы.
//!
//! \~\details
//! \~english \section cmake_module_Types Building with CMake
//! \~russian \section cmake_module_Types Сборка с использованием CMake
//!
//! \~\code
//! find_package(PIP REQUIRED)
//! target_link_libraries([target] PIP)
//! \endcode
//!
//! \~english \par Common
//! \~russian \par Общее
//!
//! \~english
//!
//!
//! \~russian
//!
//!
//! \~\authors
//! \~english
//! Ivan Pelipenko peri4ko@yandex.ru;
//! Andrey Bychkov work.a.b@yandex.ru;
//! \~russian
//! Иван Пелипенко peri4ko@yandex.ru;
//! Андрей Бычков work.a.b@yandex.ru;
//!
#ifndef PITYPESMODULE_H
#define PITYPESMODULE_H
#include "pibitarray.h"
#include "pibytearray.h"
#include "piflags.h"
#include "pitime.h"
#include "pipropertystorage.h"
#include "pivariantsimple.h"
#endif // PITYPESMODULE_H

View File

@@ -1,5 +1,5 @@
/*! \file pivariant.h /*! \file pivariant.h
* \ingroup Core * \ingroup Types
* \brief * \brief
* \~english Variant type * \~english Variant type
* \~russian Вариативный тип * \~russian Вариативный тип
@@ -218,7 +218,7 @@ classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(c
#endif #endif
//! \ingroup Core //! \ingroup Types
//! \~\brief //! \~\brief
//! \~english Variant type. //! \~english Variant type.
//! \~russian Вариантный тип. //! \~russian Вариантный тип.

View File

@@ -1,5 +1,5 @@
/*! \file pivariantsimple.h /*! \file pivariantsimple.h
* \ingroup Core * \ingroup Types
* \brief * \brief
* \~english Simple variant type * \~english Simple variant type
* \~russian Простой вариативный тип * \~russian Простой вариативный тип
@@ -62,7 +62,7 @@ public:
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\class PIVariantSimple pivariantsimple.h //! \~\class PIVariantSimple pivariantsimple.h
//! \~\brief //! \~\brief

View File

@@ -1,5 +1,5 @@
/*! \file pivarianttypes.h /*! \file pivarianttypes.h
* \ingroup Core * \ingroup Types
* \brief * \brief
* \~english Types for PIVariant * \~english Types for PIVariant
* \~russian Типы для PIVariant * \~russian Типы для PIVariant
@@ -32,14 +32,14 @@
class PIPropertyStorage; class PIPropertyStorage;
//! \ingroup Core //! \ingroup Types
//! \relatesalso PIVariant //! \relatesalso PIVariant
//! \~english Namespace contains several types for PIVariant //! \~english Namespace contains several types for PIVariant
//! \~russian Пространство имен содержит некоторые типы для PIVariant //! \~russian Пространство имен содержит некоторые типы для PIVariant
namespace PIVariantTypes { namespace PIVariantTypes {
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct Enumerator pivarianttypes.h //! \~\struct Enumerator pivarianttypes.h
//! \~\brief //! \~\brief
@@ -59,7 +59,7 @@ struct PIP_EXPORT Enumerator {
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct Enum pivarianttypes.h //! \~\struct Enum pivarianttypes.h
//! \~\brief //! \~\brief
@@ -165,7 +165,7 @@ struct PIP_EXPORT Enum {
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct File pivarianttypes.h //! \~\struct File pivarianttypes.h
//! \~\brief //! \~\brief
@@ -198,7 +198,7 @@ struct PIP_EXPORT File {
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct Dir pivarianttypes.h //! \~\struct Dir pivarianttypes.h
//! \~\brief //! \~\brief
@@ -223,7 +223,7 @@ struct PIP_EXPORT Dir {
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct Color pivarianttypes.h //! \~\struct Color pivarianttypes.h
//! \~\brief //! \~\brief
@@ -239,7 +239,7 @@ struct PIP_EXPORT Color {
}; };
//! \addtogroup Core //! \addtogroup Types
//! \{ //! \{
//! \~\struct IODevice pivarianttypes.h //! \~\struct IODevice pivarianttypes.h
//! \~\brief //! \~\brief