merged AI doc, some new pages
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/*! \file pibitarray.h
|
||||
* \~\brief
|
||||
* \~english Bit array
|
||||
* \~russian Битовый массив
|
||||
*/
|
||||
//! \~\file pibitarray.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Packed bit array
|
||||
//! \~russian Упакованный массив битов
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Bit array
|
||||
Packed bit array
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -28,9 +28,9 @@
|
||||
#include "pivector.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english The %PIBitArray class provides an space-efficient array of bits.
|
||||
//! \~english The %PIBitArray class provides a space-efficient array of bits.
|
||||
//! \~russian Класс %PIBitArray представляет собой компактный массив битов.
|
||||
class PIP_EXPORT PIBitArray {
|
||||
template<typename P>
|
||||
@@ -39,40 +39,40 @@ class PIP_EXPORT PIBitArray {
|
||||
friend PIBinaryStream<P> & operator<<(PIBinaryStream<P> & s, const PIBitArray & v);
|
||||
|
||||
public:
|
||||
//! \~english Constructs bit array with "size" size.
|
||||
//! \~russian Создает битовый массив с размером "size".
|
||||
//! \~english Constructs a bit array with `size` bits.
|
||||
//! \~russian Создает битовый массив размером `size` бит.
|
||||
PIBitArray(const int & size = 0) { resize(size); }
|
||||
|
||||
//! \~english Constructs bit array with size 8 and values from "val".
|
||||
//! \~russian Создает битовый массив с размером 8 и значениями из "val".
|
||||
//! \~english Constructs an 8-bit array initialized from `val`.
|
||||
//! \~russian Создает 8-битный массив, инициализированный из `val`.
|
||||
PIBitArray(uchar val) {
|
||||
resize(sizeof(val) * 8);
|
||||
data_[0] = val;
|
||||
}
|
||||
|
||||
//! \~english Constructs bit array with size 16 and values from "val".
|
||||
//! \~russian Создает битовый массив с размером 16 и значениями из "val".
|
||||
//! \~english Constructs a 16-bit array initialized from `val`.
|
||||
//! \~russian Создает 16-битный массив, инициализированный из `val`.
|
||||
PIBitArray(ushort val) {
|
||||
resize(sizeof(val) * 8);
|
||||
memcpy(data(), &val, sizeof(val));
|
||||
}
|
||||
|
||||
//! \~english Constructs bit array with size 32 and values from "val".
|
||||
//! \~russian Создает битовый массив с размером 32 и значениями из "val".
|
||||
//! \~english Constructs a 32-bit array initialized from `val`.
|
||||
//! \~russian Создает 32-битный массив, инициализированный из `val`.
|
||||
PIBitArray(uint val) {
|
||||
resize(sizeof(val) * 8);
|
||||
memcpy(data(), &val, sizeof(val));
|
||||
}
|
||||
|
||||
//! \~english Constructs bit array with size 64 and values from "val".
|
||||
//! \~russian Создает битовый массив с размером 64 и значениями из "val".
|
||||
//! \~english Constructs a 64-bit array initialized from `val`.
|
||||
//! \~russian Создает 64-битный массив, инициализированный из `val`.
|
||||
PIBitArray(ullong val) {
|
||||
resize(sizeof(val) * 8);
|
||||
memcpy(data(), &val, sizeof(val));
|
||||
}
|
||||
|
||||
//! \~english Constructs bit array with size "bytes * 8" and values from "data".
|
||||
//! \~russian Создает битовый массив с размером "bytes * 8" и значениями из "data".
|
||||
//! \~english Constructs a bit array from `bytes` bytes of raw data.
|
||||
//! \~russian Создает битовый массив из `bytes` байт исходных данных.
|
||||
PIBitArray(const uchar * data, uint bytes) {
|
||||
resize(bytes * 8);
|
||||
memcpy(this->data(), data, bytes);
|
||||
@@ -301,7 +301,7 @@ private:
|
||||
// std::ostream & operator <<(std::ostream & s, const PIBitArray & ba);
|
||||
#endif
|
||||
|
||||
//! \relatesalso PIByteArray
|
||||
//! \relatesalso PICout
|
||||
//! \~english Output operator to \a PICout
|
||||
//! \~russian Оператор вывода в \a PICout
|
||||
PIP_EXPORT PICout operator<<(PICout s, const PIBitArray & ba);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*! \file pibytearray.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english Byte array
|
||||
* \~russian Байтовый массив
|
||||
*/
|
||||
//! \~\addtogroup Types
|
||||
//! \~\{
|
||||
//! \~\file pibytearray.h
|
||||
//! \~\brief
|
||||
//! \~english Byte array
|
||||
//! \~russian Байтовый массив
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Byte array
|
||||
@@ -35,42 +35,44 @@ class PIString;
|
||||
class PIByteArray;
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english The %PIByteArray class provides an array of bytes.
|
||||
//! \~russian Класс %PIByteArray представляет собой массив байтов.
|
||||
//! \~english The %PIByteArray class provides an array of bytes with efficient memory management and various manipulation operations.
|
||||
//! \~russian Класс %PIByteArray предоставляет массив байтов с эффективным управлением памятью и различными операциями манипулирования.
|
||||
class PIP_EXPORT PIByteArray: public PIBinaryStream<PIByteArray> {
|
||||
public:
|
||||
typedef ::PIMemoryBlock RawData DEPRECATEDM("use PIMemoryBlock instead");
|
||||
|
||||
//! \~english Constructs an empty byte array
|
||||
//! \~russian Создает пустой байтовый массив
|
||||
//! \~english Constructs an empty byte array.
|
||||
//! \~russian Создает пустой байтовый массив.
|
||||
PIByteArray() {}
|
||||
|
||||
//! \~english Constructs copy of byte array "o"
|
||||
//! \~russian Создает копию байтового массива "o"
|
||||
//! \~english Constructs copy of byte array "o".
|
||||
//! \~russian Создает копию байтового массива "o".
|
||||
PIByteArray(const PIByteArray & o): d(o.d) {}
|
||||
|
||||
//! \~english Constructs copy of byte array "o"
|
||||
//! \~russian Создает копию байтового массива "o"
|
||||
//! \~english Constructs copy of byte array "o".
|
||||
//! \~russian Создает копию байтового массива "o".
|
||||
explicit PIByteArray(const PIDeque<uchar> & o): d(o) {}
|
||||
|
||||
//! \~english Move constructor.
|
||||
//! \~russian Конструктор перемещения.
|
||||
PIByteArray(PIByteArray && o): d(std::move(o.d)) {}
|
||||
PIByteArray(PIDeque<uchar> && o): d(std::move(o)) {}
|
||||
|
||||
//! \~english Constructs 0-filled byte array with size "size"
|
||||
//! \~russian Создает заполненный "0" байтовый массив размером "size"
|
||||
//! \~english Constructs 0-filled byte array with size "size".
|
||||
//! \~russian Создает заполненный "0" байтовый массив размером "size".
|
||||
explicit PIByteArray(const uint size) { resize(size); }
|
||||
|
||||
//! \~english Constructs byte array from data "data" and size "size"
|
||||
//! \~russian Создает байтовый массив из данных по указателю "data" размером "size"
|
||||
//! \~english Constructs byte array from data "data" and size "size".
|
||||
//! \~russian Создает байтовый массив из данных по указателю "data" размером "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"
|
||||
//! \~russian Создает заполненный "t" байтовый массив размером "size"
|
||||
//! \~english Constructs byte array with size "size" filled by "t".
|
||||
//! \~russian Создает заполненный "t" байтовый массив размером "size".
|
||||
PIByteArray(const uint size, uchar t): d(size, t) {}
|
||||
|
||||
//! \~english Contructs array from
|
||||
//! \~english Constructs array from
|
||||
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
|
||||
//! \~russian Создает массив из
|
||||
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pidatetime.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english Time and date structs
|
||||
* \~russian Типы времени и даты
|
||||
*/
|
||||
//! \~\file pidatetime.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Time and date structs
|
||||
//! \~russian Типы времени и даты
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Time and date structs
|
||||
@@ -30,7 +29,7 @@
|
||||
#include "pisystemtime.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Calendar time.
|
||||
//! \~russian Календарное время.
|
||||
@@ -120,7 +119,7 @@ inline bool operator>=(const PITime & t0, const PITime & t1) {
|
||||
PIP_EXPORT PICout operator<<(PICout s, const PITime & v);
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Calendar date.
|
||||
//! \~russian Календарная дата.
|
||||
@@ -192,7 +191,7 @@ inline bool operator>=(const PIDate & t0, const PIDate & t1) {
|
||||
PIP_EXPORT PICout operator<<(PICout s, const PIDate & v);
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Calendar date and time.
|
||||
//! \~russian Календарное дата и время.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*! \file piflags.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english General flags class
|
||||
* \~russian Универсальные флаги
|
||||
*/
|
||||
//! \~\addtogroup Types
|
||||
//! \~\{
|
||||
//! \~\file piflags.h
|
||||
//! \~\brief
|
||||
//! \~english General flags class
|
||||
//! \~russian Универсальные флаги
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
General flags class
|
||||
@@ -32,19 +32,18 @@
|
||||
//! \{
|
||||
//! \~\class PIFlags piflags.h
|
||||
//! \~\brief
|
||||
//! \~english Container for bit flags
|
||||
//! \~russian Контейнер для битовых полей (флагов)
|
||||
//!
|
||||
//! \~english The %PIFlags class is a template container for bit flags with various bitwise operations and comparison operators.
|
||||
//! \~russian Класс %PIFlags является шаблонным контейнером для битовых флагов с различными побитовыми операциями и операторами сравнения.
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! %PIFlags is wrapper around \c "int". One can use it as native \c "int".
|
||||
//! There are manybit-wise operators,
|
||||
//! There are many bit-wise operators,
|
||||
//! native conversion to "int" and function
|
||||
//! to test flag. \n Example:
|
||||
//!
|
||||
//! \~russian
|
||||
//! %PIFlags по сути обертка вокруг \c "int". Можно использовать его как обычный \c "int".
|
||||
//! Имеет много битовых операторов,
|
||||
//! Имеет много побитовых операторов,
|
||||
//! неявное преобразование в "int" и методы для проверки
|
||||
//! флагов. \n Пример:
|
||||
//!
|
||||
@@ -54,16 +53,16 @@
|
||||
template<typename Enum>
|
||||
class PIFlags {
|
||||
public:
|
||||
//! \~english Constructor with flags = 0
|
||||
//! \~russian Создает нулевые флаги
|
||||
//! \~english Constructor with flags = 0.
|
||||
//! \~russian Создает нулевые флаги.
|
||||
PIFlags(): flags(0) { ; }
|
||||
|
||||
//! \~english Constructor with flags = Enum "e"
|
||||
//! \~russian Создает флаги со значением = Enum "e"
|
||||
//! \~english Constructor with flags = Enum "e".
|
||||
//! \~russian Создает флаги со значением = Enum "e".
|
||||
PIFlags(Enum e): flags((int)e) { ; }
|
||||
|
||||
//! \~english Constructor with flags = int "i"
|
||||
//! \~russian Создает флаги со значением = int "i"
|
||||
//! \~english Constructor with flags = int "i".
|
||||
//! \~russian Создает флаги со значением = int "i".
|
||||
PIFlags(const int i): flags(i) { ; }
|
||||
|
||||
//! \~english Set flags on positions "f" to value "on"
|
||||
@@ -279,8 +278,8 @@ public:
|
||||
//! \~russian Оператор проверки флага
|
||||
bool operator[](Enum e) const { return (flags & (int)e) == (int)e; }
|
||||
|
||||
//! \~english Implicity conversion to \c int
|
||||
//! \~russian Оператор неявного преобразования в \c int
|
||||
//! \~english Implicity conversion to \c int.
|
||||
//! \~russian Оператор неявного преобразования в \c int.
|
||||
operator int() const { return flags; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
/*! \file pinetworkaddress.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english Network address
|
||||
* \~russian Сетевой адрес
|
||||
*/
|
||||
//! \~\file pinetworkaddress.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Network address
|
||||
//! \~russian Сетевой адрес
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Network address
|
||||
Network address
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -30,7 +29,7 @@
|
||||
#include "pistring.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Network address, IP and port.
|
||||
//! \~russian Класс для работы с сетевым адресом, IP и портом.
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pipropertystorage.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english Properties array
|
||||
* \~russian Массив свойств
|
||||
*/
|
||||
//! \~\file pipropertystorage.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Properties array
|
||||
//! \~russian Массив свойств
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Storage of properties for GUI usage
|
||||
@@ -29,17 +28,21 @@
|
||||
#include "pivariant.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english This class provides key-value properties storage.
|
||||
//! \~russian Этот класс предоставляет ключ-значение хранение свойств.
|
||||
//! \~\details
|
||||
//! \~english %PIPropertyStorage is a container for storing properties as key-value pairs with additional metadata like comments and flags.
|
||||
//! \~russian %PIPropertyStorage - контейнер для хранения свойств в виде пар "ключ-значение" с дополнительными метаданными, такими как
|
||||
//! комментарии и флаги.
|
||||
class PIP_EXPORT PIPropertyStorage {
|
||||
public:
|
||||
//! \~english Contructs an empty %PIPropertyStorage
|
||||
//! \~russian Создает пустой %PIPropertyStorage
|
||||
PIPropertyStorage() {}
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english PIPropertyStorage element.
|
||||
//! \~russian Элемент PIPropertyStorage.
|
||||
@@ -102,18 +105,30 @@ public:
|
||||
|
||||
//! \~english Property name (uniqueue for %PIPropertyStorage)
|
||||
//! \~russian Имя свойства (уникальное для %PIPropertyStorage)
|
||||
//! \~\details
|
||||
//! \~english Unique identifier for the property within a %PIPropertyStorage instance.
|
||||
//! \~russian Уникальный идентификатор свойства в экземпляре %PIPropertyStorage.
|
||||
PIString name;
|
||||
|
||||
//! \~english Optional description of property
|
||||
//! \~russian Опциональный комментарий свойства
|
||||
//! \~\details
|
||||
//! \~english Additional descriptive text providing information about the property's purpose or usage.
|
||||
//! \~russian Дополнительный описывающий текст, предоставляющий информацию о назначении или использовании свойства.
|
||||
PIString comment;
|
||||
|
||||
//! \~english Property value
|
||||
//! \~russian Значение свойства
|
||||
//! \~\details
|
||||
//! \~english The value stored in the property, which can be of any type supported by %PIVariant.
|
||||
//! \~russian Значение, хранящееся в свойстве, которое может быть любого типа, поддерживаемого %PIVariant.
|
||||
PIVariant value;
|
||||
|
||||
//! \~english Abstract flags which may be used for user needs
|
||||
//! \~russian Абстрактные флаги, могут быть использованы для своих нужд
|
||||
//! \~\details
|
||||
//! \~english User-defined flags for application-specific property management.
|
||||
//! \~russian Флаги, определяемые пользователем, для управления свойствами, специфичными для приложения.
|
||||
int flags;
|
||||
};
|
||||
|
||||
@@ -220,6 +235,9 @@ public:
|
||||
|
||||
//! \~english Merge other "properties" into this
|
||||
//! \~russian Объединяет "properties" с текущим контейнером
|
||||
//! \~\details
|
||||
//! \~english Merges the specified properties vector into this container, updating existing properties and adding new ones.
|
||||
//! \~russian Объединяет указанный вектор свойств с текущим контейнером, обновляя существующие свойства и добавляя новые.
|
||||
void updateProperties(const PIVector<Property> & properties, int flag_ignore = 0);
|
||||
|
||||
//! \~english Returns property with name "name" or default-constructed %PIPropertyStorage::Property
|
||||
@@ -258,6 +276,9 @@ public:
|
||||
|
||||
//! \~english Add properties "p"
|
||||
//! \~russian Добавляет свойства "p"
|
||||
//! \~\details
|
||||
//! \~english Appends multiple properties from another %PIPropertyStorage to this container using the << operator.
|
||||
//! \~russian Добавляет несколько свойств из другого %PIPropertyStorage в этот контейнер с использованием оператора <<.
|
||||
PIPropertyStorage & operator<<(const PIPropertyStorage & p) {
|
||||
props << p.props;
|
||||
return *this;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pisystemtime.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english System time structs and methods
|
||||
* \~russian Типы и методы системного времени
|
||||
*/
|
||||
//! \~\file pisystemtime.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english System time structs and methods
|
||||
//! \~russian Типы и методы системного времени
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Time structs
|
||||
@@ -30,7 +29,7 @@
|
||||
#include "pistring.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english System time with nanosecond precision.
|
||||
//! \~russian Системное время с точностью до наносекунд.
|
||||
@@ -57,7 +56,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Frequency type.
|
||||
//! \~russian Тип частоты.
|
||||
@@ -450,7 +449,7 @@ inline PICout operator<<(PICout s, const PISystemTime::Frequency & f) {
|
||||
}
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Time measurements.
|
||||
//! \~russian Измерение времени.
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pitime.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english System time, time and date
|
||||
* \~russian Системное время, время и дата
|
||||
*/
|
||||
//! \~\file pitime.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english System time, time and date
|
||||
//! \~russian Системное время, время и дата
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
@@ -27,12 +26,12 @@
|
||||
|
||||
#include "pidatetime.h"
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~english Precise sleep for "usecs" microseconds
|
||||
//! \~russian Точно ожидает "usecs" микросекунд
|
||||
PIP_EXPORT void piUSleep(int usecs); // on !Windows consider constant "usleep" offset
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \brief
|
||||
//! \~english Precise sleep for "msecs" milliseconds
|
||||
//! \~russian Точно ожидает "msecs" миллисекунд
|
||||
@@ -43,7 +42,7 @@ inline void piMSleep(double msecs) {
|
||||
piUSleep(int(msecs * 1000.));
|
||||
} // on !Windows consider constant "usleep" offset
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \brief
|
||||
//! \~english Precise sleep for "secs" seconds
|
||||
//! \~russian Точно ожидает "secs" секунд
|
||||
@@ -54,7 +53,7 @@ inline void piSleep(double secs) {
|
||||
piUSleep(int(secs * 1000000.));
|
||||
} // on !Windows consider constant "usleep" offset
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \brief
|
||||
//! \~english Precise sleep for "t" time
|
||||
//! \~russian Точно ожидает время "t"
|
||||
@@ -62,7 +61,7 @@ inline void piSleep(PISystemTime t) {
|
||||
t.sleep();
|
||||
}
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~english Shortest available on current system sleep
|
||||
//! \~russian Наименее возможное для данной системы по длительности ожидание
|
||||
inline void piMinSleep() {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
/*! \file pitime_win.h
|
||||
* \ingroup Types
|
||||
* \brief
|
||||
* \~english PITime conversions for Windows
|
||||
* \~russian Преобразования PITime для Windows
|
||||
*/
|
||||
//! \~\file pitime_win.h
|
||||
//! \~\ingroup Types
|
||||
//! \brief
|
||||
//! \~english PITime conversions for Windows
|
||||
//! \~russian Преобразования PITime для Windows
|
||||
//! \details
|
||||
//! \~english This file provides conversion functions between Windows time structures (FILETIME, SYSTEMTIME) and PIP time structures
|
||||
//! (PISystemTime, PIDateTime).
|
||||
//! \~russian Этот файл предоставляет функции преобразования между структурами времени Windows (FILETIME, SYSTEMTIME) и структурами времени
|
||||
//! PIP (PISystemTime, PIDateTime).
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
PITime conversions for Windows
|
||||
@@ -32,7 +36,14 @@
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
|
||||
//! \~\ingroup Types
|
||||
//! \~english Converts FILETIME to PISystemTime.
|
||||
//! \~russian Преобразует FILETIME в PISystemTime.
|
||||
//! \details
|
||||
//! \~english Converts Windows FILETIME structure to PISystemTime. FILETIME is a 64-bit value representing the number of 100-nanosecond
|
||||
//! intervals since January 1, 1601 (UTC).
|
||||
//! \~russian Преобразует структуру Windows FILETIME в PISystemTime. FILETIME - это 64-битное значение, представляющее количество интервалов
|
||||
//! по 100 наносекунд с 1 января 1601 года (UTC).
|
||||
inline PISystemTime FILETIME2PISystemTime(const FILETIME & t) {
|
||||
PISystemTime st;
|
||||
ullong lt = ullong(t.dwHighDateTime) * 0x100000000U + ullong(t.dwLowDateTime);
|
||||
@@ -42,6 +53,14 @@ inline PISystemTime FILETIME2PISystemTime(const FILETIME & t) {
|
||||
}
|
||||
|
||||
|
||||
//! \~\ingroup Types
|
||||
//! \~english Converts SYSTEMTIME to PIDateTime.
|
||||
//! \~russian Преобразует SYSTEMTIME в PIDateTime.
|
||||
//! \details
|
||||
//! \~english Converts Windows SYSTEMTIME structure to PIDateTime. SYSTEMTIME represents a date and time using individual members for month,
|
||||
//! day, year, etc.
|
||||
//! \~russian Преобразует структуру Windows SYSTEMTIME в PIDateTime. SYSTEMTIME представляет дату и время с помощью отдельных членов для
|
||||
//! месяца, дня, года и т.д.
|
||||
inline PIDateTime SYSTEMTIME2PIDateTime(const SYSTEMTIME & t) {
|
||||
PIDateTime dt;
|
||||
dt.year = t.wYear;
|
||||
@@ -54,6 +73,14 @@ inline PIDateTime SYSTEMTIME2PIDateTime(const SYSTEMTIME & t) {
|
||||
return dt;
|
||||
}
|
||||
|
||||
//! \~\ingroup Types
|
||||
//! \~english Converts FILETIME to PIDateTime.
|
||||
//! \~russian Преобразует FILETIME в PIDateTime.
|
||||
//! \details
|
||||
//! \~english Converts Windows FILETIME to PIDateTime. The FILETIME is first converted to local time, then to SYSTEMTIME, and finally to
|
||||
//! PIDateTime.
|
||||
//! \~russian Преобразует Windows FILETIME в PIDateTime. Сначала FILETIME преобразуется в местное время, затем в SYSTEMTIME и наконец в
|
||||
//! PIDateTime.
|
||||
inline PIDateTime FILETIME2PIDateTime(const FILETIME & t) {
|
||||
FILETIME lt;
|
||||
SYSTEMTIME st;
|
||||
@@ -62,6 +89,12 @@ inline PIDateTime FILETIME2PIDateTime(const FILETIME & t) {
|
||||
return SYSTEMTIME2PIDateTime(st);
|
||||
}
|
||||
|
||||
//! \~\ingroup Types
|
||||
//! \~english Converts PIDateTime to SYSTEMTIME.
|
||||
//! \~russian Преобразует PIDateTime в SYSTEMTIME.
|
||||
//! \details
|
||||
//! \~english Converts PIDateTime to Windows SYSTEMTIME structure.
|
||||
//! \~russian Преобразует PIDateTime в структуру Windows SYSTEMTIME.
|
||||
inline SYSTEMTIME PIDateTime2SYSTEMTIME(const PIDateTime & dt) {
|
||||
SYSTEMTIME st;
|
||||
st.wYear = dt.year;
|
||||
@@ -74,6 +107,14 @@ inline SYSTEMTIME PIDateTime2SYSTEMTIME(const PIDateTime & dt) {
|
||||
return st;
|
||||
}
|
||||
|
||||
//! \~\ingroup Types
|
||||
//! \~english Converts PIDateTime to FILETIME.
|
||||
//! \~russian Преобразует PIDateTime в FILETIME.
|
||||
//! \details
|
||||
//! \~english Converts PIDateTime to Windows FILETIME. The PIDateTime is first converted to SYSTEMTIME, then to local FILETIME, and finally
|
||||
//! to UTC FILETIME.
|
||||
//! \~russian Преобразует PIDateTime в Windows FILETIME. Сначала PIDateTime преобразуется в SYSTEMTIME, затем в местное FILETIME и наконец в
|
||||
//! UTC FILETIME.
|
||||
inline FILETIME PIDateTime2FILETIME(const PIDateTime & dt) {
|
||||
FILETIME lt, ret;
|
||||
SYSTEMTIME st = PIDateTime2SYSTEMTIME(dt);
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*! \file pitypesmodule.h
|
||||
* \ingroup Types
|
||||
* \~\brief
|
||||
* \~english Convenience includes for the Types module
|
||||
* \~russian Подключение основных заголовков модуля Types
|
||||
*
|
||||
* \~\details
|
||||
* \~english Includes the main public headers for bit arrays, byte arrays, flags, addresses, time, and variant values.
|
||||
* \~russian Подключает основные публичные заголовки для битовых массивов, байтовых массивов, флагов, адресов, времени и variant-значений.
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Module includes
|
||||
@@ -18,35 +28,18 @@
|
||||
*/
|
||||
//! \defgroup Types Types
|
||||
//! \~\brief
|
||||
//! \~english Basic types.
|
||||
//! \~russian Базовые типы.
|
||||
//! \~english Basic types, value containers and time utilities.
|
||||
//! \~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
|
||||
//!
|
||||
//! This module collects public headers for commonly used value types, variant containers,
|
||||
//! property helpers, network-address types and time/date utilities.
|
||||
//!
|
||||
//! \~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
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pivaluetree.h
|
||||
* \ingroup Types
|
||||
* \brief
|
||||
* \~english Attributed values tree
|
||||
* \~russian Дерево атрибутированных значений
|
||||
*/
|
||||
//! \~\file pivaluetree.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Attributed values tree
|
||||
//! \~russian Дерево атрибутированных значений
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Attributed values tree
|
||||
@@ -30,7 +29,7 @@
|
||||
#include "pivariant.h"
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english The %PIValueTree class represents a tree structure of PIVariant values with attributes.
|
||||
//! \~russian Класс %PIValueTree представляет собой древовидную структуру значений PIVariant с атрибутами.
|
||||
@@ -159,6 +158,9 @@ public:
|
||||
//! \~\brief
|
||||
//! \~english Merges a set of attributes into the current set of attributes for the %PIValueTree object.
|
||||
//! \~russian Объединяет набор атрибутов в текущий набор атрибутов объекта %PIValueTree.
|
||||
//! \~\details
|
||||
//! \~english Merges the provided attributes map into the current attributes, overwriting any existing attributes with the same name.
|
||||
//! \~russian Объединяет предоставленный набор атрибутов в текущие атрибуты, перезаписывая существующие атрибуты с тем же именем.
|
||||
void mergeAttributes(const PIVariantMap & a);
|
||||
|
||||
//! \~\brief
|
||||
@@ -234,22 +236,22 @@ public:
|
||||
int childIndex(const PIString & name) const;
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Returns a const reference to the child node with a given name, or null node if it doesn`t exists.
|
||||
//! \~english Returns a const reference to the child node with a given name, or null node if it doesn't exists.
|
||||
//! \~russian Возвращает константную ссылку на дочерний узел с заданным именем или пустой узел, если его нет.
|
||||
const PIValueTree & child(const PIString & name) const;
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Returns a const reference to the child node with a given path, or null node if it doesn`t exists.
|
||||
//! \~english Returns a const reference to the child node with a given path, or null node if it doesn't exists.
|
||||
//! \~russian Возвращает константную ссылку на дочерний узел с заданным путем или пустой узел, если его нет.
|
||||
const PIValueTree & child(const PIStringList & path) const;
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Returns a reference to the child node with a given name, or null node if it doesn`t exists.
|
||||
//! \~english Returns a reference to the child node with a given name, or null node if it doesn't exists.
|
||||
//! \~russian Возвращает ссылку на дочерний узел с заданным именем или пустой узел, если его нет.
|
||||
PIValueTree & child(const PIString & name);
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Returns a reference to the child node with a given path, or null node if it doesn`t exists.
|
||||
//! \~english Returns a reference to the child node with a given path, or null node if it doesn't exists.
|
||||
//! \~russian Возвращает ссылку на дочерний узел с заданным путем или пустой узел, если его нет.
|
||||
PIValueTree & child(const PIStringList & path);
|
||||
|
||||
@@ -291,6 +293,11 @@ public:
|
||||
//! \~\brief
|
||||
//! \~english Recursive call "func" for every child. "path" is a name with path, joined with ".".
|
||||
//! \~russian Рекурсивно выполняет "func" для каждого узла. "path" - это имя с путём, соединены ".".
|
||||
//! \~\details
|
||||
//! \~english Recursively calls the provided function for every node in the tree. The path parameter contains the full path to the node,
|
||||
//! with ancestor names joined by dots.
|
||||
//! \~russian Рекурсивно вызывает предоставленную функцию для каждого узла в дереве. Параметр path содержит полный путь к узлу, при этом
|
||||
//! имена предков соединены точками.
|
||||
void forEachRecursive(std::function<void(const PIValueTree & item, const PIString & path)> func);
|
||||
|
||||
//! \~\brief
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pivariant.h
|
||||
* \ingroup Types
|
||||
* \brief
|
||||
* \~english Variant type
|
||||
* \~russian Вариативный тип
|
||||
*/
|
||||
//! \~\file pivariant.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Variant type
|
||||
//! \~russian Вариативный тип
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Variant type
|
||||
@@ -102,21 +101,21 @@ struct __PIVariantTypeInfo__ {
|
||||
typedef const T & ConstReferenceType;
|
||||
};
|
||||
|
||||
# define __TYPEINFO_SINGLE(PT, T) \
|
||||
template<> \
|
||||
struct __PIVariantTypeInfo__<T> { \
|
||||
typedef PT PureType; \
|
||||
typedef const PT ConstPureType; \
|
||||
typedef PT * PointerType; \
|
||||
typedef const PT * ConstPointerType; \
|
||||
typedef PT & ReferenceType; \
|
||||
typedef const PT & ConstReferenceType; \
|
||||
};
|
||||
# define __TYPEINFO_SINGLE(PT, T) \
|
||||
template<> \
|
||||
struct __PIVariantTypeInfo__<T> { \
|
||||
typedef PT PureType; \
|
||||
typedef const PT ConstPureType; \
|
||||
typedef PT * PointerType; \
|
||||
typedef const PT * ConstPointerType; \
|
||||
typedef PT & ReferenceType; \
|
||||
typedef const PT & ConstReferenceType; \
|
||||
};
|
||||
|
||||
# define REGISTER_VARIANT_TYPEINFO(T) \
|
||||
__TYPEINFO_SINGLE(T, T &) \
|
||||
__TYPEINFO_SINGLE(T, const T) \
|
||||
__TYPEINFO_SINGLE(T, const T &)
|
||||
__TYPEINFO_SINGLE(T, T &) \
|
||||
__TYPEINFO_SINGLE(T, const T) \
|
||||
__TYPEINFO_SINGLE(T, const T &)
|
||||
|
||||
|
||||
class PIP_EXPORT __PIVariantInfoStorage__ {
|
||||
@@ -125,72 +124,67 @@ public:
|
||||
};
|
||||
|
||||
|
||||
# define REGISTER_VARIANT(classname) \
|
||||
template<> \
|
||||
inline PIString __PIVariantFunctions__<classname>::typeNameHelper() { \
|
||||
static PIString tn = PIStringAscii(#classname); \
|
||||
return tn; \
|
||||
} \
|
||||
template<> \
|
||||
inline uint __PIVariantFunctions__<classname>::typeIDHelper() { \
|
||||
static uint ret = PIStringAscii(#classname).hash(); \
|
||||
return ret; \
|
||||
} \
|
||||
REGISTER_VARIANT_TYPEINFO(classname) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
uint type_id = __PIVariantFunctions__<classname>::typeIDHelper(); \
|
||||
PIString type_name = __PIVariantFunctions__<classname>::typeNameHelper(); \
|
||||
if (__PIVariantInfoStorage__::get().contains(type_id)) return; \
|
||||
PIByteArray empty; \
|
||||
empty << classname(); \
|
||||
__PIVariantInfoStorage__::get()[type_id] = new __PIVariantInfo__(type_name, empty); \
|
||||
STATIC_INITIALIZER_END
|
||||
# define REGISTER_VARIANT(classname) \
|
||||
template<> \
|
||||
inline PIString __PIVariantFunctions__<classname>::typeNameHelper() { \
|
||||
static PIString tn = PIStringAscii(#classname); \
|
||||
return tn; \
|
||||
} \
|
||||
template<> \
|
||||
inline uint __PIVariantFunctions__<classname>::typeIDHelper() { \
|
||||
static uint ret = PIStringAscii(#classname).hash(); \
|
||||
return ret; \
|
||||
} \
|
||||
REGISTER_VARIANT_TYPEINFO(classname) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
uint type_id = __PIVariantFunctions__<classname>::typeIDHelper(); \
|
||||
PIString type_name = __PIVariantFunctions__<classname>::typeNameHelper(); \
|
||||
if (__PIVariantInfoStorage__::get().contains(type_id)) return; \
|
||||
PIByteArray empty; \
|
||||
empty << classname(); \
|
||||
__PIVariantInfoStorage__::get()[type_id] = new __PIVariantInfo__(type_name, empty); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
|
||||
# define REGISTER_VARIANT_CAST_H(classname_from, classname_to) \
|
||||
template<> \
|
||||
template<> \
|
||||
inline classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(const classname_from & v);
|
||||
template<> \
|
||||
template<> \
|
||||
inline classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(const classname_from & v);
|
||||
|
||||
# define REGISTER_VARIANT_CAST_CPP(classname_from, classname_to) \
|
||||
template<> \
|
||||
template<> \
|
||||
inline PIByteArray __PIVariantFunctions__<classname_from>::castHelper<classname_to>(PIByteArray v) { \
|
||||
classname_from f; \
|
||||
v >> f; \
|
||||
classname_to t = __PIVariantFunctions__<classname_from>::castVariant<classname_to>(f); \
|
||||
PIByteArray ret; \
|
||||
ret << t; \
|
||||
return ret; \
|
||||
template<> \
|
||||
template<> \
|
||||
inline PIByteArray __PIVariantFunctions__<classname_from>::castHelper<classname_to>(PIByteArray v) { \
|
||||
classname_from f; \
|
||||
v >> f; \
|
||||
classname_to t = __PIVariantFunctions__<classname_from>::castVariant<classname_to>(f); \
|
||||
PIByteArray ret; \
|
||||
ret << t; \
|
||||
return ret; \
|
||||
} \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
__PIVariantInfo__ * vi(__PIVariantInfoStorage__::get().value(__PIVariantFunctions__<classname_from>::typeIDHelper(), nullptr)); \
|
||||
if (!vi) { \
|
||||
piCout << "Warning! Using REGISTER_VARIANT_CAST(" #classname_from ", " #classname_to ") before REGISTER_VARIANT(" #classname_from \
|
||||
"), ignore."; \
|
||||
return; \
|
||||
} \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
__PIVariantInfo__ * vi(__PIVariantInfoStorage__::get().value(__PIVariantFunctions__<classname_from>::typeIDHelper(), nullptr)); \
|
||||
if (!vi) { \
|
||||
piCout << "Warning! Using REGISTER_VARIANT_CAST(" #classname_from ", " #classname_to \
|
||||
") before REGISTER_VARIANT(" #classname_from "), ignore."; \
|
||||
return; \
|
||||
} \
|
||||
vi->cast[__PIVariantFunctions__<classname_to>::typeIDHelper()] = \
|
||||
__PIVariantFunctions__<classname_from>::castHelper<classname_to>; \
|
||||
STATIC_INITIALIZER_END \
|
||||
template<> \
|
||||
template<> \
|
||||
classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(const classname_from & v)
|
||||
vi->cast[__PIVariantFunctions__<classname_to>::typeIDHelper()] = __PIVariantFunctions__<classname_from>::castHelper<classname_to>; \
|
||||
STATIC_INITIALIZER_END \
|
||||
template<> \
|
||||
template<> \
|
||||
classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(const classname_from & v)
|
||||
|
||||
# define REGISTER_VARIANT_CAST(classname_from, classname_to) \
|
||||
REGISTER_VARIANT_CAST_H(classname_from, classname_to) \
|
||||
REGISTER_VARIANT_CAST_CPP(classname_from, classname_to)
|
||||
REGISTER_VARIANT_CAST_H(classname_from, classname_to) \
|
||||
REGISTER_VARIANT_CAST_CPP(classname_from, classname_to)
|
||||
|
||||
|
||||
# define REGISTER_VARIANT_CAST_SIMPLE(classname_from, classname_to) \
|
||||
REGISTER_VARIANT_CAST(classname_from, classname_to) { \
|
||||
return classname_to(v); \
|
||||
}
|
||||
REGISTER_VARIANT_CAST(classname_from, classname_to) { return classname_to(v); }
|
||||
# define REGISTER_VARIANT_CAST_SIMPLE_H(classname_from, classname_to) REGISTER_VARIANT_CAST_H(classname_from, classname_to)
|
||||
# define REGISTER_VARIANT_CAST_SIMPLE_CPP(classname_from, classname_to) \
|
||||
REGISTER_VARIANT_CAST_CPP(classname_from, classname_to) { \
|
||||
return classname_to(v); \
|
||||
}
|
||||
REGISTER_VARIANT_CAST_CPP(classname_from, classname_to) { return classname_to(v); }
|
||||
|
||||
#else
|
||||
|
||||
@@ -212,10 +206,13 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Variant type.
|
||||
//! \~russian Вариантный тип.
|
||||
//! \~\details
|
||||
//! \~english The %PIVariant class provides a variant type that can store values of various types.
|
||||
//! \~russian Класс %PIVariant предоставляет вариативный тип, который может хранить значения различных типов.
|
||||
class PIP_EXPORT PIVariant {
|
||||
friend PICout operator<<(PICout s, const PIVariant & v);
|
||||
BINARY_STREAM_FRIEND(PIVariant);
|
||||
@@ -224,7 +221,7 @@ public:
|
||||
//! \~english Type of %PIVariant content
|
||||
//! \~russian Тип содержимого %PIVariant
|
||||
enum Type {
|
||||
pivInvalid /** \~english Invalid type, default type of empty contructor \~russian Недействительный тип, также конструированный по
|
||||
pivInvalid /** \~english Invalid type, default type of empty constructor \~russian Недействительный тип, также конструированный по
|
||||
умолчанию */
|
||||
= 0,
|
||||
pivBool /** bool */,
|
||||
@@ -422,7 +419,7 @@ public:
|
||||
void setValue(const char * v) { setValue(PIString(v)); }
|
||||
|
||||
//! \~english Set variant content and type to boolean
|
||||
//! \~russian Устанавливает значение и тип из
|
||||
//! \~russian Устанавливает значение и тип из логического значения
|
||||
void setValue(const bool v) { initType(v); }
|
||||
|
||||
//! \~english Set variant content and type to char
|
||||
@@ -564,33 +561,116 @@ public:
|
||||
void setValueFromString(const PIString & v);
|
||||
|
||||
|
||||
//! \~english Returns value as boolean.
|
||||
//! \~russian Возвращает значение как логическое значение.
|
||||
bool toBool() const;
|
||||
|
||||
//! \~english Returns value as integer.
|
||||
//! \~russian Возвращает значение как целое число.
|
||||
int toInt() const;
|
||||
|
||||
//! \~english Returns value as long long integer.
|
||||
//! \~russian Возвращает значение как длинное длинное целое число.
|
||||
llong toLLong() const;
|
||||
|
||||
//! \~english Returns value as float.
|
||||
//! \~russian Возвращает значение как float.
|
||||
float toFloat() const;
|
||||
|
||||
//! \~english Returns value as double.
|
||||
//! \~russian Возвращает значение как double.
|
||||
double toDouble() const;
|
||||
|
||||
//! \~english Returns value as long double.
|
||||
//! \~russian Возвращает значение как long double.
|
||||
ldouble toLDouble() const;
|
||||
|
||||
//! \~english Returns value as complex float.
|
||||
//! \~russian Возвращает значение как комплексное float.
|
||||
complexf toComplexF() const;
|
||||
|
||||
//! \~english Returns value as complex double.
|
||||
//! \~russian Возвращает значение как комплексное double.
|
||||
complexd toComplexD() const;
|
||||
|
||||
//! \~english Returns value as complex long double.
|
||||
//! \~russian Возвращает значение как комплексное long double.
|
||||
complexld toComplexLD() const;
|
||||
|
||||
//! \~english Returns value as time.
|
||||
//! \~russian Возвращает значение как время.
|
||||
PITime toTime() const;
|
||||
|
||||
//! \~english Returns value as date.
|
||||
//! \~russian Возвращает значение как дату.
|
||||
PIDate toDate() const;
|
||||
|
||||
//! \~english Returns value as date and time.
|
||||
//! \~russian Возвращает значение как дату и время.
|
||||
PIDateTime toDateTime() const;
|
||||
|
||||
//! \~english Returns value as system time.
|
||||
//! \~russian Возвращает значение как системное время.
|
||||
PISystemTime toSystemTime() const;
|
||||
|
||||
//! \~english Returns value as string.
|
||||
//! \~russian Возвращает значение как строку.
|
||||
PIString toString() const;
|
||||
|
||||
//! \~english Returns value as string list.
|
||||
//! \~russian Возвращает значение как массив строк.
|
||||
PIStringList toStringList() const;
|
||||
|
||||
//! \~english Returns value as bit array.
|
||||
//! \~russian Возвращает значение как массив битов.
|
||||
PIBitArray toBitArray() const;
|
||||
|
||||
//! \~english Returns value as byte array.
|
||||
//! \~russian Возвращает значение как массив байтов.
|
||||
PIByteArray toByteArray() const;
|
||||
|
||||
//! \~english Returns value as enum.
|
||||
//! \~russian Возвращает значение как перечисление.
|
||||
PIVariantTypes::Enum toEnum() const;
|
||||
|
||||
//! \~english Returns value as file.
|
||||
//! \~russian Возвращает значение как файл.
|
||||
PIVariantTypes::File toFile() const;
|
||||
|
||||
//! \~english Returns value as directory.
|
||||
//! \~russian Возвращает значение как директорию.
|
||||
PIVariantTypes::Dir toDir() const;
|
||||
|
||||
//! \~english Returns value as color.
|
||||
//! \~russian Возвращает значение как цвет.
|
||||
PIVariantTypes::Color toColor() const;
|
||||
|
||||
//! \~english Returns value as IO device.
|
||||
//! \~russian Возвращает значение как устройство ввода/вывода.
|
||||
PIVariantTypes::IODevice toIODevice() const;
|
||||
|
||||
//! \~english Returns value as point.
|
||||
//! \~russian Возвращает значение как точку.
|
||||
PIPointd toPoint() const;
|
||||
|
||||
//! \~english Returns value as rect.
|
||||
//! \~russian Возвращает значение как прямоугольник.
|
||||
PIRectd toRect() const;
|
||||
|
||||
//! \~english Returns value as line.
|
||||
//! \~russian Возвращает значение как линию.
|
||||
PILined toLine() const;
|
||||
|
||||
//! \~english Returns value as network address.
|
||||
//! \~russian Возвращает значение как сетевой адрес.
|
||||
PINetworkAddress toNetworkAddress() const;
|
||||
|
||||
//! \~english Returns value as math vector.
|
||||
//! \~russian Возвращает значение как математический вектор.
|
||||
PIMathVectord toMathVector() const;
|
||||
|
||||
//! \~english Returns value as math matrix.
|
||||
//! \~russian Возвращает значение как математическую матрицу.
|
||||
PIMathMatrixd toMathMatrix() const;
|
||||
|
||||
|
||||
@@ -602,7 +682,7 @@ public:
|
||||
//! In case of known types this function equivalent \a to<Type> function. \n
|
||||
//! Otherwise returns content as type T only if this type was set earlier.
|
||||
//! \~russian
|
||||
//! Для стандартных типов эквиваленстно методу \a to<Type>. \n
|
||||
//! Для стандартных типов эквивалентно методу \a to<Type>. \n
|
||||
//! Для других возвращает тип T только если он был установлен ранее.
|
||||
template<typename T>
|
||||
T value() const {
|
||||
@@ -902,7 +982,7 @@ public:
|
||||
//! In case of known types this function equivalent \a PIVariant() constructors. \n
|
||||
//! Otherwise returns variant with content "v" and type \a pivCustom.
|
||||
//! \~russian
|
||||
//! Для стандартных типов эквиваленстно конструктору \a PIVariant(). \n
|
||||
//! Для стандартных типов эквивалентно конструктору \a PIVariant(). \n
|
||||
//! Для других устанавливает содержимое из "v" и тип \a pivCustom.
|
||||
template<typename T>
|
||||
static PIVariant fromValue(const T & v) {
|
||||
@@ -911,7 +991,11 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//! \~english Returns new %PIVariant from byte array with type ID.
|
||||
//! \~russian Возвращает новый %PIVariant из массива байтов с ID типа.
|
||||
static PIVariant fromValue(const PIByteArray & c, uint type_id);
|
||||
//! \~english Returns new %PIVariant from byte array with type name.
|
||||
//! \~russian Возвращает новый %PIVariant из массива байтов с именем типа.
|
||||
static PIVariant fromValue(const PIByteArray & c, const PIString & type);
|
||||
|
||||
//! \~english Returns new %PIVariant from default-constructed type with name "type".
|
||||
@@ -971,6 +1055,8 @@ public:
|
||||
//! \~russian Возвращает все зарегистрированные ID типов.
|
||||
static PIVector<uint> knownTypeIDs();
|
||||
|
||||
//! \~english Returns count of registered types.
|
||||
//! \~russian Возвращает количество зарегистрированных типов.
|
||||
static int knownTypeIDsCount();
|
||||
|
||||
private:
|
||||
@@ -1182,7 +1268,7 @@ REGISTER_VARIANT_CAST(PIGeoPosition, PIString) {
|
||||
g.setEllipsoidModel(PIEllipsoidModel::WGS84Ellipsoid());
|
||||
g.transformTo(PIGeoPosition::Geodetic);
|
||||
return PIString::fromNumber(g.latitudeGeodetic(), 'f', 8) + ", " + PIString::fromNumber(g.longitude(), 'f', 8) + ", " +
|
||||
PIString::fromNumber(g.height(), 'f', 2);
|
||||
PIString::fromNumber(g.height(), 'f', 2);
|
||||
};
|
||||
|
||||
REGISTER_VARIANT_CAST(PIString, PIGeoPosition) {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pivariantsimple.h
|
||||
* \ingroup Types
|
||||
* \brief
|
||||
* \~english Simple variant type
|
||||
* \~russian Простой вариативный тип
|
||||
*/
|
||||
//! \~\file pivariantsimple.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Simple variant type
|
||||
//! \~russian Простой вариативный тип
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Variant simple type
|
||||
@@ -75,39 +74,33 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\class PIVariantSimple pivariantsimple.h
|
||||
//! \~\ingroup Types
|
||||
//! \~\brief
|
||||
//! \~english Simple variant type.
|
||||
//! \~russian Простой вариативный тип.
|
||||
//!
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//!
|
||||
//! \~russian
|
||||
//!
|
||||
//! \}
|
||||
//! \~english Lightweight strongly-typed variant for a single value.
|
||||
//! \~russian Легковесный строго типизированный вариант для одного значения.
|
||||
class PIVariantSimple {
|
||||
public:
|
||||
//! \~english Construct null %PIVariantSimple
|
||||
//! \~russian Создает пустой %PIVariantSimple
|
||||
//! \~english Constructs an empty %PIVariantSimple.
|
||||
//! \~russian Создает пустой %PIVariantSimple.
|
||||
PIVariantSimple() {
|
||||
ptr = 0;
|
||||
f = 0;
|
||||
}
|
||||
|
||||
//! \~english Contructs a copy of %PIVariantSimple.
|
||||
//! \~english Constructs a copy of %PIVariantSimple.
|
||||
//! \~russian Создает копию %PIVariantSimple.
|
||||
PIVariantSimple(const PIVariantSimple & v) {
|
||||
ptr = 0;
|
||||
f = v.f;
|
||||
if (f && v.ptr) f->newT(ptr, v.ptr);
|
||||
}
|
||||
|
||||
//! \~english Destroys the stored value, if any.
|
||||
//! \~russian Удаляет сохраненное значение, если оно есть.
|
||||
~PIVariantSimple() { destroy(); }
|
||||
|
||||
//! \~english Assign operator.
|
||||
//! \~russian Оператор присваивания.
|
||||
//! \~english Replaces this object with a copy of another %PIVariantSimple.
|
||||
//! \~russian Заменяет содержимое копией другого %PIVariantSimple.
|
||||
PIVariantSimple & operator=(const PIVariantSimple & v) {
|
||||
destroy();
|
||||
f = v.f;
|
||||
@@ -115,8 +108,11 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Set value to "v".
|
||||
//! \~russian Устанавливает значение в "v".
|
||||
//! \~english Stores value `v`.
|
||||
//! \~russian Сохраняет значение `v`.
|
||||
//! \~\details
|
||||
//! \~english Reuses the existing storage when the stored type already matches `T`.
|
||||
//! \~russian Переиспользует существующее хранилище, если сохраненный тип уже совпадает с `T`.
|
||||
template<typename T>
|
||||
void setValue(const T & v) {
|
||||
if (f) {
|
||||
@@ -131,16 +127,16 @@ public:
|
||||
}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Returns value as type "T".
|
||||
//! \~russian Возвращает значение как тип "T".
|
||||
//! \~english Returns the stored value as type `T`.
|
||||
//! \~russian Возвращает сохраненное значение как тип `T`.
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! In contrast of PIVariant this class has strong check of type.
|
||||
//! Returns value only if this type was set before.
|
||||
//! Unlike %PIVariant, this class checks the exact stored type.
|
||||
//! Returns the value only when the currently stored type matches `T`.
|
||||
//!
|
||||
//! \~russian
|
||||
//! В отличии от PIVariant этот класс строго проверяет типы.
|
||||
//! Возвращает значение только если этот же тип был установлен ранее.
|
||||
//! В отличие от %PIVariant этот класс строго проверяет точный тип.
|
||||
//! Возвращает значение только если сейчас сохранен именно тип `T`.
|
||||
//!
|
||||
template<typename T>
|
||||
T value() const {
|
||||
@@ -149,8 +145,8 @@ public:
|
||||
return *(T *)(ptr);
|
||||
}
|
||||
|
||||
//! \~english Returns %PIVariantSimple with value "v".
|
||||
//! \~russian Возвращает %PIVariantSimple со значением "v".
|
||||
//! \~english Creates %PIVariantSimple initialized with value `v`.
|
||||
//! \~russian Создает %PIVariantSimple, инициализированный значением `v`.
|
||||
template<typename T>
|
||||
static PIVariantSimple fromValue(const T & v) {
|
||||
PIVariantSimple ret;
|
||||
@@ -178,34 +174,30 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#define REGISTER_PIVARIANTSIMPLE(Type) \
|
||||
template<> \
|
||||
class __VariantFunctions__<Type>: public __VariantFunctionsBase__ { \
|
||||
public: \
|
||||
__VariantFunctionsBase__ * instance() final { \
|
||||
static __VariantFunctions__<Type> ret; \
|
||||
return &ret; \
|
||||
} \
|
||||
PIString typeName() const final { \
|
||||
static PIString ret(#Type); \
|
||||
return ret; \
|
||||
} \
|
||||
uint hash() const final { \
|
||||
static uint ret = typeName().hash(); \
|
||||
return ret; \
|
||||
} \
|
||||
void newT(void *& ptr, const void * value) final { \
|
||||
ptr = (void *)(new Type(*(const Type *)value)); \
|
||||
} \
|
||||
void newNullT(void *& ptr) final { \
|
||||
ptr = (void *)(new Type()); \
|
||||
} \
|
||||
void assignT(void *& ptr, const void * value) final { \
|
||||
*(Type *)ptr = *(const Type *)value; \
|
||||
} \
|
||||
void deleteT(void *& ptr) final { \
|
||||
delete (Type *)(ptr); \
|
||||
} \
|
||||
//! \relatesalso PIVariantSimple
|
||||
//! \~\brief
|
||||
//! \~english Registers a readable type name for %PIVariantSimple.
|
||||
//! \~russian Регистрирует читаемое имя типа для %PIVariantSimple.
|
||||
#define REGISTER_PIVARIANTSIMPLE(Type) \
|
||||
template<> \
|
||||
class __VariantFunctions__<Type>: public __VariantFunctionsBase__ { \
|
||||
public: \
|
||||
__VariantFunctionsBase__ * instance() final { \
|
||||
static __VariantFunctions__<Type> ret; \
|
||||
return &ret; \
|
||||
} \
|
||||
PIString typeName() const final { \
|
||||
static PIString ret(#Type); \
|
||||
return ret; \
|
||||
} \
|
||||
uint hash() const final { \
|
||||
static uint ret = typeName().hash(); \
|
||||
return ret; \
|
||||
} \
|
||||
void newT(void *& ptr, const void * value) final { ptr = (void *)(new Type(*(const Type *)value)); } \
|
||||
void newNullT(void *& ptr) final { ptr = (void *)(new Type()); } \
|
||||
void assignT(void *& ptr, const void * value) final { *(Type *)ptr = *(const Type *)value; } \
|
||||
void deleteT(void *& ptr) final { delete (Type *)(ptr); } \
|
||||
};
|
||||
|
||||
REGISTER_PIVARIANTSIMPLE(std::function<void(void *)>)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*! \file pivarianttypes.h
|
||||
* \ingroup Types
|
||||
* \brief
|
||||
* \~english Types for PIVariant
|
||||
* \~russian Типы для PIVariant
|
||||
*/
|
||||
//! \~\file pivarianttypes.h
|
||||
//! \~\ingroup Types
|
||||
//! \brief
|
||||
//! \~english Types for PIVariant
|
||||
//! \~russian Типы для PIVariant
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Variant types
|
||||
@@ -32,21 +31,21 @@
|
||||
class PIPropertyStorage;
|
||||
|
||||
|
||||
//! \ingroup Types
|
||||
//! \~\ingroup Types
|
||||
//! \relatesalso PIVariant
|
||||
//! \~english Namespace contains several types for PIVariant
|
||||
//! \~russian Пространство имен содержит некоторые типы для PIVariant
|
||||
namespace PIVariantTypes {
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct Enumerator pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english Name-value pair.
|
||||
//! \~russian Пара имя-значение.
|
||||
//! \}
|
||||
struct PIP_EXPORT Enumerator {
|
||||
//! \~english Constructs an enumerator with the specified value and name.
|
||||
//! \~russian Конструирует перечислитель с указанным значением и именем.
|
||||
Enumerator(int v = 0, const PIString & n = PIString()): value(v), name(n) {}
|
||||
|
||||
//! \~english Value.
|
||||
@@ -59,8 +58,7 @@ struct PIP_EXPORT Enumerator {
|
||||
};
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct Enum pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english Collection of PIVariantTypes::Enumerator.
|
||||
@@ -70,14 +68,13 @@ struct PIP_EXPORT Enumerator {
|
||||
//! This class represents classic c-style enum.
|
||||
//! Contains elements with unique names and not uniqueue values, also
|
||||
//! name of enum and selected member.
|
||||
//!
|
||||
//! \~russian
|
||||
//! Этот класс представляет классический c-style enum.
|
||||
//! Содержит элементы с уникальными именами и неуникальными значениями,
|
||||
//! а также имя перечисления и выбранного элемента.
|
||||
//!
|
||||
//! \}
|
||||
struct PIP_EXPORT Enum {
|
||||
//! \~english Constructs an enum with the specified name.
|
||||
//! \~russian Конструирует перечисление с указанным именем.
|
||||
Enum(const PIString & n = PIString()): enum_name(n) {}
|
||||
|
||||
//! \~english Returns selected value, or 0 if there is no name in members.
|
||||
@@ -173,14 +170,14 @@ struct PIP_EXPORT Enum {
|
||||
};
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct File pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english File location description.
|
||||
//! \~russian Описание положения файла.
|
||||
//! \}
|
||||
struct PIP_EXPORT File {
|
||||
//! \~english Constructs a file description with the specified parameters.
|
||||
//! \~russian Конструирует описание файла с указанными параметрами.
|
||||
File(const PIString & p = PIString(), const PIString & f = PIString(), bool abs = false, bool save_mode = false)
|
||||
: file(p)
|
||||
, filter(f)
|
||||
@@ -209,14 +206,14 @@ struct PIP_EXPORT File {
|
||||
};
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct Dir pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english Directory description.
|
||||
//! \~russian Описание директории.
|
||||
//! \}
|
||||
struct PIP_EXPORT Dir {
|
||||
//! \~english Constructs a directory description with the specified parameters.
|
||||
//! \~russian Конструирует описание директории с указанными параметрами.
|
||||
Dir(const PIString & d = PIString(), bool abs = false): dir(d), is_abs(abs) {}
|
||||
|
||||
//! \~english Returns path.
|
||||
@@ -233,14 +230,14 @@ struct PIP_EXPORT Dir {
|
||||
};
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct Color pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english 32-bits color.
|
||||
//! \~russian 32-битный цвет.
|
||||
//! \}
|
||||
struct PIP_EXPORT Color {
|
||||
//! \~english Constructs a color with the specified value.
|
||||
//! \~russian Конструирует цвет с указанным значением.
|
||||
Color(uint v = 0) { rgba = v; }
|
||||
|
||||
//! \~english Returns color from #HEX, 0xHEX or name.
|
||||
@@ -274,40 +271,42 @@ inline bool operator!=(const Color c0, const Color c1) {
|
||||
}
|
||||
|
||||
|
||||
//! \addtogroup Types
|
||||
//! \{
|
||||
//! \~\ingroup Types
|
||||
//! \~\struct IODevice pivarianttypes.h
|
||||
//! \~\brief
|
||||
//! \~english Input/output device description.
|
||||
//! \~russian Описание устройства ввода/вывода.
|
||||
//! \}
|
||||
//! \~english Variant description used to create or configure %PIIODevice.
|
||||
//! \~russian Variant-описание, используемое для создания или настройки %PIIODevice.
|
||||
struct PIP_EXPORT IODevice {
|
||||
//! \~english Constructs an IO device.
|
||||
//! \~russian Конструирует устройство ввода/вывода.
|
||||
IODevice();
|
||||
|
||||
//! \~english Serialize "ps" and set it to "props".
|
||||
//! \~russian Сериализует "ps" и устанавливает "props".
|
||||
//! \~english Serializes device-specific variant properties from "ps" into internal storage.
|
||||
//! \~russian Сериализует специфичные для устройства variant-свойства из "ps" во внутреннее хранилище.
|
||||
void set(const PIPropertyStorage & ps);
|
||||
|
||||
//! \~english Deserialize "props" and returns it.
|
||||
//! \~russian Десериализует "props" и возвращает свойства.
|
||||
//! \~english Restores device-specific variant properties from serialized storage.
|
||||
//! \~russian Восстанавливает специфичные для устройства variant-свойства из сериализованного хранилища.
|
||||
PIPropertyStorage get() const;
|
||||
|
||||
//! \~english Returns string for PICout.
|
||||
//! \~russian Возвращает строку для PICout.
|
||||
//! \~english Returns PICout representation of this device description.
|
||||
//! \~russian Возвращает представление этого описания устройства для PICout.
|
||||
PIString toPICout() const;
|
||||
|
||||
//! \~english PIIODevice prefix, see \ref PIIODevice_sec7.
|
||||
//! \~russian Префикс PIIODevice, см. \ref PIIODevice_sec7.
|
||||
//! \~english Registered device prefix used in full-path notation, see \ref PIIODevice_sec7.
|
||||
//! \~russian Зарегистрированный префикс устройства, используемый в полной строке пути, см. \ref PIIODevice_sec7.
|
||||
PIString prefix;
|
||||
|
||||
//! PIIODevice::DeviceMode.
|
||||
//! \~english Open mode from \a PIIODevice::DeviceMode.
|
||||
//! \~russian Режим открытия из \a PIIODevice::DeviceMode.
|
||||
int mode;
|
||||
|
||||
//! PIIODevice::DeviceOptions.
|
||||
//! \~english Device options bitmask from \a PIIODevice::DeviceOptions.
|
||||
//! \~russian Битовая маска опций из \a PIIODevice::DeviceOptions.
|
||||
int options;
|
||||
|
||||
//! \~english Serialized properties.
|
||||
//! \~russian Сериализованные свойства.
|
||||
//! \~english Serialized device-specific variant properties.
|
||||
//! \~russian Сериализованные variant-свойства, специфичные для устройства.
|
||||
PIByteArray props;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user