This commit is contained in:
2022-05-05 22:31:59 +03:00
parent d1f7065c8a
commit 0b3ee4bb6a
38 changed files with 378 additions and 211 deletions

View File

@@ -21,14 +21,7 @@
#include "pistringlist.h" #include "pistringlist.h"
#include <iostream> #include <iostream>
//! \addtogroup Core
//! \{
//! \class PIByteArray pibytearray.h //! \class PIByteArray pibytearray.h
//!
//! \~\brief
//! \~english The %PIByteArray class provides an array of bytes
//! \~russian Класс %PIByteArray представляет собой массив байтов
//!
//! \~\details //! \~\details
//! \~english //! \~english
//! %PIByteArray used to store raw bytes. //! %PIByteArray used to store raw bytes.
@@ -98,7 +91,6 @@
//! метов \a append(). //! метов \a append().
//! \~\snippet pibytearray.cpp 3 //! \~\snippet pibytearray.cpp 3
//! //!
//! \}
static const uchar base64Table[64] = { static const uchar base64Table[64] = {

View File

@@ -36,6 +36,10 @@ class PIString;
class PIByteArray; class PIByteArray;
//! \ingroup Core
//! \~\brief
//! \~english The %PIByteArray class provides an array of bytes.
//! \~russian Класс %PIByteArray представляет собой массив байтов.
class PIP_EXPORT PIByteArray: public PIDeque<uchar> class PIP_EXPORT PIByteArray: public PIDeque<uchar>
{ {
public: public:

View File

@@ -36,14 +36,7 @@ char * __utf8name__ = 0;
#endif #endif
#include <wchar.h> #include <wchar.h>
//! \addtogroup Core
//! \{
//! \class PIChar pichar.h //! \class PIChar pichar.h
//!
//! \~\brief
//! \~english %PIChar represents a single character
//! \~russian %PIChar представляет собой один символ строки
//!
//! \~\details //! \~\details
//! \~english //! \~english
//! This class is wrapper around UTF16. //! This class is wrapper around UTF16.
@@ -53,7 +46,6 @@ char * __utf8name__ = 0;
//! %PIChar хранит один сивол в UTF16. Имеет много контрукторов, геттеров в различные //! %PIChar хранит один сивол в UTF16. Имеет много контрукторов, геттеров в различные
//! кодировки (системную, консольную, UTF8) и информационных функций. //! кодировки (системную, консольную, UTF8) и информационных функций.
//! //!
//! \}
ushort charFromCodepage(const char * c, int size, const char * codepage, int * taken = 0) { ushort charFromCodepage(const char * c, int size, const char * codepage, int * taken = 0) {

View File

@@ -32,6 +32,10 @@ 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
//! \~\brief
//! \~english %PIChar represents a single character.
//! \~russian %PIChar представляет собой один символ строки.
class PIP_EXPORT PIChar class PIP_EXPORT PIChar
{ {
friend class PIString; friend class PIString;

View File

@@ -19,13 +19,8 @@
#include "pichunkstream.h" #include "pichunkstream.h"
//! \addtogroup Core
//! \{
//! \class PIChunkStream pichunkstream.h //! \class PIChunkStream pichunkstream.h
//! \brief //! \details
//! \~english Class for binary de/serialization
//! \~russian Класс для бинарной де/сериализации
//!
//! \~english \section PIChunkStream_sec0 Synopsis //! \~english \section PIChunkStream_sec0 Synopsis
//! \~russian \section PIChunkStream_sec0 Краткий обзор //! \~russian \section PIChunkStream_sec0 Краткий обзор
//! \~english //! \~english
@@ -89,7 +84,6 @@
//! \~russian ... и десериализовать: //! \~russian ... и десериализовать:
//! \~\snippet pichunkstream.cpp read_new //! \~\snippet pichunkstream.cpp read_new
//! //!
//! \}
void PIChunkStream::setSource(const PIByteArray & data) { void PIChunkStream::setSource(const PIByteArray & data) {

View File

@@ -29,6 +29,10 @@
#include "pibytearray.h" #include "pibytearray.h"
//! \ingroup Core
//! \~\brief
//! \~english Class for binary de/serialization.
//! \~russian Класс для бинарной де/сериализации.
class PIP_EXPORT PIChunkStream class PIP_EXPORT PIChunkStream
{ {
public: public:

View File

@@ -21,13 +21,8 @@
#include "pisysteminfo.h" #include "pisysteminfo.h"
//! \addtogroup Core
//! \{
//! \class PICLI picli.h //! \class PICLI picli.h
//! \~\brief //! \details
//! \~english Command-Line parser
//! \~russian Парсер командной строки
//!
//! \~english \section PICLI_sec0 Synopsis //! \~english \section PICLI_sec0 Synopsis
//! \~russian \section PICLI_sec0 Краткий обзор //! \~russian \section PICLI_sec0 Краткий обзор
//! \~english //! \~english
@@ -66,7 +61,6 @@
//! a.out --debug -c --value 10 //! a.out --debug -c --value 10
//! \endcode //! \endcode
//! //!
//! \}
PICLI::PICLI(int argc, char * argv[]) { PICLI::PICLI(int argc, char * argv[]) {

View File

@@ -28,6 +28,10 @@
#include "piobject.h" #include "piobject.h"
//! \ingroup Core
//! \~\brief
//! \~english Command-Line parser.
//! \~russian Парсер командной строки.
class PIP_EXPORT PICLI: public PIObject class PIP_EXPORT PICLI: public PIObject
{ {
PIOBJECT_SUBCLASS(PICLI, PIObject) PIOBJECT_SUBCLASS(PICLI, PIObject)

View File

@@ -20,13 +20,7 @@
#include "picollection.h" #include "picollection.h"
//! \addtogroup Core
//! \{
//! \~\class PICollection picollection.h //! \~\class PICollection picollection.h
//! \~\brief
//! \~english Helper to collect and retrieve classes to groups
//! \~russian Помощник для создания и получения классов в группы
//!
//! \~\details //! \~\details
//! \~english \section PICollection_sec0 Synopsis //! \~english \section PICollection_sec0 Synopsis
//! \~russian \section PICollection_sec0 Краткий обзор //! \~russian \section PICollection_sec0 Краткий обзор
@@ -41,7 +35,6 @@
//! объектов в глобальные группы. Затем можно получить их список в любом месте программы. //! объектов в глобальные группы. Затем можно получить их список в любом месте программы.
//! \~\snippet picollection.cpp main //! \~\snippet picollection.cpp main
//! //!
//! \}
PIStringList PICollection::groups() { PIStringList PICollection::groups() {

View File

@@ -100,6 +100,10 @@
#endif #endif
//! \ingroup Core
//! \~\brief
//! \~english Helper to collect and retrieve classes to groups.
//! \~russian Помощник для создания и получения классов в группы.
class PIP_EXPORT PICollection class PIP_EXPORT PICollection
{ {
friend class __PICollectionInitializer; friend class __PICollectionInitializer;

View File

@@ -20,8 +20,6 @@
#include "pistring.h" #include "pistring.h"
//! \addtogroup Core
//! \{
//! \~\class PIConstChars piconstchars.h //! \~\class PIConstChars piconstchars.h
//! \~\details //! \~\details
//! \~english \section PICout_sec0 Synopsis //! \~english \section PICout_sec0 Synopsis
@@ -42,7 +40,6 @@
//! //!
//! Используется для более удобной работы с обычными C-строками. //! Используется для более удобной работы с обычными C-строками.
//! //!
//! \}
bool PIConstChars::startsWith(const PIConstChars & str) const { bool PIConstChars::startsWith(const PIConstChars & str) const {

View File

@@ -31,8 +31,8 @@
//! \ingroup Core //! \ingroup Core
//! \~\brief //! \~\brief
//! \~english C-String class //! \~english C-String class.
//! \~russian Класс C-строки //! \~russian Класс C-строки.
class PIP_EXPORT PIConstChars { class PIP_EXPORT PIConstChars {
public: public:

View File

@@ -34,13 +34,8 @@
#endif #endif
//! \addtogroup Core
//! \{
//! \~\class PICout picout.h //! \~\class PICout picout.h
//! \~\brief //! \~\details
//! \~english Universal output to console class
//! \~russian Универсальный вывод в консоль
//!
//! \~english \section PICout_sec0 Synopsis //! \~english \section PICout_sec0 Synopsis
//! \~russian \section PICout_sec0 Краткий обзор //! \~russian \section PICout_sec0 Краткий обзор
//! \~english //! \~english
@@ -79,7 +74,6 @@
//! \~russian \section PICout_ex1 Создание своего оператора вывода //! \~russian \section PICout_ex1 Создание своего оператора вывода
//! \~\snippet picout.cpp own //! \~\snippet picout.cpp own
//! //!
//! \}
//! \addtogroup Core //! \addtogroup Core

View File

@@ -125,6 +125,10 @@ namespace PICoutManipulators {
//! \ingroup Core
//! \~\brief
//! \~english Universal output to console class.
//! \~russian Универсальный вывод в консоль.
class PIP_EXPORT PICout { class PIP_EXPORT PICout {
public: public:

View File

@@ -35,20 +35,12 @@
//! \addtogroup Core //! \addtogroup Core
//! \{ //! \{
//!
//! \~\class PITime pidatetime.h //! \~\class PITime pidatetime.h
//! \brief
//! \~english Calendar time
//! \~russian Календарное время
//! //!
//! \~\class PIDate pidatetime.h //! \~\class PIDate pidatetime.h
//! \brief
//! \~english Calendar date
//! \~russian Календарная дата
//! //!
//! \~\class PIDateTime pidatetime.h //! \~\class PIDateTime pidatetime.h
//! \brief
//! \~english Calendar date and time
//! \~russian Календарное дата и время
//! //!
//! \} //! \}

View File

@@ -30,6 +30,10 @@
#include "pisystemtime.h" #include "pisystemtime.h"
//! \ingroup Core
//! \~\brief
//! \~english Calendar time.
//! \~russian Календарное время.
class PIP_EXPORT PITime { class PIP_EXPORT PITime {
public: public:
//! \~english Construct %PITime from hours, minutes, seconds and milliseconds //! \~english Construct %PITime from hours, minutes, seconds and milliseconds
@@ -102,6 +106,10 @@ PIP_EXPORT PICout operator <<(PICout s, const PITime & v);
//! \ingroup Core
//! \~\brief
//! \~english Calendar date.
//! \~russian Календарная дата.
class PIP_EXPORT PIDate { class PIP_EXPORT PIDate {
public: public:
//! \~english Construct %PIDate from year, month and day //! \~english Construct %PIDate from year, month and day
@@ -162,6 +170,10 @@ PIP_EXPORT PICout operator <<(PICout s, const PIDate & v);
//! \ingroup Core
//! \~\brief
//! \~english Calendar date and time.
//! \~russian Календарное дата и время.
class PIP_EXPORT PIDateTime { class PIP_EXPORT PIDateTime {
public: public:
//! \~english Construct null %PIDateTime //! \~english Construct null %PIDateTime

View File

@@ -26,13 +26,7 @@
#endif #endif
//! \addtogroup Core
//! \{
//! \~\class PIObject piobject.h //! \~\class PIObject piobject.h
//! \~\brief
//! \~english This is base class for any classes which use events -> handlers mechanism
//! \~russian Этот класс является базовым для использования механизма события -> обработчики
//!
//! \~\details //! \~\details
//! \~english \section PIObject_sec0 Events and Event handlers //! \~english \section PIObject_sec0 Events and Event handlers
//! \~russian \section PIObject_sec0 События и Обработчики событий //! \~russian \section PIObject_sec0 События и Обработчики событий
@@ -98,16 +92,12 @@
//! handler A: event to event //! handler A: event to event
//! event to lambda //! event to lambda
//! \endcode //! \endcode
//! \} //!
//! \addtogroup Core
//! \{
//! \~\class PIObject::Connection piobject.h //! \~\class PIObject::Connection piobject.h
//! \~\brief //! \~\details
//! \~english Helper class for obtain info about if connection successful and disconnect single connection //!
//! \~russian Вспомогательный класс для получения информации об успешности соединения и возможности его разрыва
//! \}
PIObject::__MetaFunc::__MetaFunc() { PIObject::__MetaFunc::__MetaFunc() {

View File

@@ -36,6 +36,10 @@
typedef void (*Handler)(void * ); typedef void (*Handler)(void * );
//! \ingroup Core
//! \~\brief
//! \~english This is base class for any classes which use events -> handlers mechanism.
//! \~russian Этот класс является базовым для использования механизма события -> обработчики.
class PIP_EXPORT PIObject { class PIP_EXPORT PIObject {
#ifndef MICRO_PIP #ifndef MICRO_PIP
friend class PIObjectManager; friend class PIObjectManager;
@@ -53,6 +57,10 @@ public:
virtual ~PIObject(); virtual ~PIObject();
//! \ingroup Core
//! \~\brief
//! \~english Helper class for obtain info about if connection successful and disconnect single connection.
//! \~russian Вспомогательный класс для получения информации об успешности соединения и возможности его разрыва.
class PIP_EXPORT Connection { class PIP_EXPORT Connection {
friend class PIObject; friend class PIObject;
Connection(void * sl, void * si, const PIString & e = PIString(), Connection(void * sl, void * si, const PIString & e = PIString(),

View File

@@ -20,13 +20,7 @@
#include "pipropertystorage.h" #include "pipropertystorage.h"
//! \addtogroup Core
//! \{
//! \~\class PIPropertyStorage pipropertystorage.h //! \~\class PIPropertyStorage pipropertystorage.h
//! \~\brief
//! \~english This class provides key-value properties storage
//! \~russian Этот класс предоставляет ключ-значение хранение свойств
//!
//! \~\details //! \~\details
//! \~english \section PIPropertyStorage_sec0 Synopsis //! \~english \section PIPropertyStorage_sec0 Synopsis
//! \~russian \section PIPropertyStorage_sec0 Краткий обзор //! \~russian \section PIPropertyStorage_sec0 Краткий обзор
@@ -45,35 +39,12 @@
//! \~russian Пример: //! \~russian Пример:
//! \~\code{.cpp} //! \~\code{.cpp}
//! \endcode //! \endcode
//! \} //!
//! \addtogroup Core
//! \{
//! \~\class PIPropertyStorage::Property pipropertystorage.h //! \~\class PIPropertyStorage::Property pipropertystorage.h
//! \~\brief
//! \~english PIPropertyStorage element
//! \~russian Элемент PIPropertyStorage
//!
//! \~\details //! \~\details
//! \~english \section PIPropertyStorage_sec1 Synopsis
//! \~russian \section PIPropertyStorage_sec1 Краткий обзор
//! //!
//! \~english
//! Key-value storage, based on PIVector with PIPropertyStorage::Property elements. Each element in vector
//! contains unique name. You can access property by name with \a propertyValueByName() or \a propertyByName().
//! You can add or replace property by \a addProperty(const Property&) or \a addProperty(const PIString&, const PIVariant&, const PIString&, int).
//!
//! \~russian
//! Хранилище свойств ключ-значние, основанный на PIVector с элементами PIPropertyStorage::Property.
//! Каждый элемент имеет уникальное имя. Доступ к свойствам через \a propertyValueByName() или \a propertyByName().
//! Добавление и перезапись свойств через \a addProperty(const Property&) или \a addProperty(const PIString&, const PIVariant&, const PIString&, int).
//!
//! \~english Example:
//! \~russian Пример:
//! \~\code{.cpp}
//! \endcode
//! \}
bool PIPropertyStorage::isPropertyExists(const PIString & _name) const { bool PIPropertyStorage::isPropertyExists(const PIString & _name) const {

View File

@@ -29,6 +29,10 @@
#include "pivariant.h" #include "pivariant.h"
//! \ingroup Core
//! \~\brief
//! \~english This class provides key-value properties storage.
//! \~russian Этот класс предоставляет ключ-значение хранение свойств.
class PIP_EXPORT PIPropertyStorage { class PIP_EXPORT PIPropertyStorage {
public: public:
@@ -36,6 +40,10 @@ public:
//! \~russian Создает пустой %PIPropertyStorage //! \~russian Создает пустой %PIPropertyStorage
PIPropertyStorage() {} PIPropertyStorage() {}
//! \ingroup Core
//! \~\brief
//! \~english PIPropertyStorage element.
//! \~russian Элемент PIPropertyStorage.
struct PIP_EXPORT Property { struct PIP_EXPORT Property {
//! \~english Contructs %PIPropertyStorage::Property with name "n", comment "c", value "v" and flags "f" //! \~english Contructs %PIPropertyStorage::Property with name "n", comment "c", value "v" and flags "f"

View File

@@ -31,13 +31,7 @@
#include <locale> #include <locale>
#include <codecvt> #include <codecvt>
//! \addtogroup Core
//! \{
//! \class PIString pistring.h //! \class PIString pistring.h
//! \brief
//! \~english String class
//! \~russian Класс строки
//!
//! \~\details //! \~\details
//! \~english \section PIString_sec0 Synopsis //! \~english \section PIString_sec0 Synopsis
//! \~russian \section PIString_sec0 Краткий обзор //! \~russian \section PIString_sec0 Краткий обзор
@@ -54,7 +48,6 @@
//! создана из множества типов и преобразована в несколько типов. //! создана из множества типов и преобразована в несколько типов.
//! Имеет множество методов для манипуляций. //! Имеет множество методов для манипуляций.
//! //!
//! \}

View File

@@ -34,6 +34,10 @@
class PIStringList; class PIStringList;
//! \ingroup Core
//! \~\brief
//! \~english String class.
//! \~russian Класс строки.
class PIP_EXPORT PIString class PIP_EXPORT PIString
{ {
friend PIByteArray & operator >>(PIByteArray & s, PIString & v); friend PIByteArray & operator >>(PIByteArray & s, PIString & v);

View File

@@ -20,16 +20,9 @@
#include "pistringlist.h" #include "pistringlist.h"
//! \addtogroup Core
//! \{
//! \~\class PIStringList pistringlist.h //! \~\class PIStringList pistringlist.h
//! \~\brief
//! \~english Based on \a PIDeque<PIString> strings list
//! \~russian Основанный на \a PIDeque<PIString> массив строк
//!
//! \~\details //! \~\details
//! //!
//! \}
//! \details //! \details

View File

@@ -29,6 +29,10 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup Core
//! \~\brief
//! \~english Based on \a PIDeque<PIString> strings list.
//! \~russian Основанный на \a PIDeque<PIString> массив строк.
class PIP_EXPORT PIStringList: public PIDeque<PIString> class PIP_EXPORT PIStringList: public PIDeque<PIString>
{ {
public: public:

View File

@@ -45,13 +45,8 @@
#endif #endif
//! \addtogroup Core
//! \{
//! \class PISystemTime pisystemtime.h //! \class PISystemTime pisystemtime.h
//! \brief //! \details
//! \~english System time with nanosecond precision
//! \~russian Системное время с точностью до наносекунд
//!
//! \~english \section PISystemTime_sec0 Synopsis //! \~english \section PISystemTime_sec0 Synopsis
//! \~russian \section PISystemTime_sec0 Краткий обзор //! \~russian \section PISystemTime_sec0 Краткий обзор
//! \~english //! \~english
@@ -72,16 +67,10 @@
//! \~russian \section PISystemTime_sec1 Пример //! \~russian \section PISystemTime_sec1 Пример
//! \~\snippet pitimer.cpp system_time //! \~\snippet pitimer.cpp system_time
//! //!
//! \}
//! \addtogroup Core
//! \{
//! \class PITimeMeasurer pisystemtime.h //! \class PITimeMeasurer pisystemtime.h
//! \brief //! \details
//! \~english Time measurements
//! \~russian Измерение времени
//!
//! \~english \section PITimeMeasurer_sec0 Usage //! \~english \section PITimeMeasurer_sec0 Usage
//! \~russian \section PITimeMeasurer_sec0 Использование //! \~russian \section PITimeMeasurer_sec0 Использование
//! \~english //! \~english
@@ -96,7 +85,6 @@
//! Эти методы возвращают нано, микро, милли и секунды с приставками //! Эти методы возвращают нано, микро, милли и секунды с приставками
//! "n", "u", "m" и "s". //! "n", "u", "m" и "s".
//! //!
//! \}

View File

@@ -30,6 +30,10 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup Core
//! \~\brief
//! \~english System time with nanosecond precision.
//! \~russian Системное время с точностью до наносекунд.
class PIP_EXPORT PISystemTime { class PIP_EXPORT PISystemTime {
public: public:
@@ -187,6 +191,10 @@ inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setCon
//! \ingroup Core
//! \~\brief
//! \~english Time measurements.
//! \~russian Измерение времени.
class PIP_EXPORT PITimeMeasurer { class PIP_EXPORT PITimeMeasurer {
public: public:
PITimeMeasurer(); PITimeMeasurer();

View File

@@ -21,7 +21,6 @@
/** \class PIVariant /** \class PIVariant
* \brief Variant type
* \details * \details
* \section PIVariant_sec0 Synopsis * \section PIVariant_sec0 Synopsis
* This class provides general type that can contains all standard types, some * This class provides general type that can contains all standard types, some

View File

@@ -201,6 +201,9 @@ classname_to __PIVariantFunctions__<classname_from>::castVariant<classname_to>(c
#endif #endif
//! \ingroup Core
//! \~\brief
//! \~english Variant type.
class PIP_EXPORT PIVariant { class PIP_EXPORT PIVariant {
friend PICout operator <<(PICout s, const PIVariant & v); friend PICout operator <<(PICout s, const PIVariant & v);
friend PIByteArray & operator <<(PIByteArray & s, const PIVariant & v); friend PIByteArray & operator <<(PIByteArray & s, const PIVariant & v);

View File

@@ -26,14 +26,7 @@
#endif #endif
//! \addtogroup System
//! \{
//! \class PILibrary pilibrary.h //! \class PILibrary pilibrary.h
//!
//! \~\brief
//! \~english Run-time library
//! \~russian Run-time библиотека
//!
//! \~\details //! \~\details
//! \~english \section _sec0 Synopsis //! \~english \section _sec0 Synopsis
//! \~russian \section _sec0 Краткий обзор //! \~russian \section _sec0 Краткий обзор
@@ -126,7 +119,6 @@
//! // mul = 30 //! // mul = 30
//! \endcode //! \endcode
//! //!
//! \}
PRIVATE_DEFINITION_START(PILibrary) PRIVATE_DEFINITION_START(PILibrary)

View File

@@ -30,6 +30,10 @@
#include "pistring.h" #include "pistring.h"
//! \ingroup System
//! \~\brief
//! \~english Run-time library.
//! \~russian Run-time библиотека.
class PIP_EXPORT PILibrary { class PIP_EXPORT PILibrary {
public: public:

View File

@@ -24,14 +24,7 @@
#include "pidir.h" #include "pidir.h"
#include "piincludes_p.h" #include "piincludes_p.h"
//! \addtogroup System
//! \{
//! \class PIPluginLoader piplugin.h //! \class PIPluginLoader piplugin.h
//!
//! \brief
//! \~english Plugin loader
//! \~russian Загрузчик плагина
//!
//! \~\details //! \~\details
//! \~english \section PIPluginLoader_sec0 Synopsis //! \~english \section PIPluginLoader_sec0 Synopsis
//! \~russian \section PIPluginLoader_sec0 Краткий обзор //! \~russian \section PIPluginLoader_sec0 Краткий обзор
@@ -238,7 +231,6 @@
//! } //! }
//! \endcode //! \endcode
//! //!
//! \}
#define STR_WF(s) #s #define STR_WF(s) #s
#define STR(s) STR_WF(s) #define STR(s) STR_WF(s)

View File

@@ -156,6 +156,10 @@ private:
//! \ingroup System
//! \~\brief
//! \~english Plugin loader.
//! \~russian Загрузчик плагина.
class PIP_EXPORT PIPluginLoader { class PIP_EXPORT PIPluginLoader {
public: public:
typedef int(*FunctionLoaderVersion)(); typedef int(*FunctionLoaderVersion)();

View File

@@ -30,14 +30,7 @@
#endif #endif
//! \addtogroup System
//! \{
//! \class PIProcess piprocess.h //! \class PIProcess piprocess.h
//!
//! \~\brief
//! \~english External process
//! \~russian Внешний процесс
//!
//! \~\details //! \~\details
//! \~english //! \~english
//! This class able to start external executables, watch for them, //! This class able to start external executables, watch for them,
@@ -65,7 +58,6 @@
//! //!
//! \~russian //! \~russian
//! //!
//! \}
PRIVATE_DEFINITION_START(PIProcess) PRIVATE_DEFINITION_START(PIProcess)

View File

@@ -32,6 +32,10 @@
#include "pifile.h" #include "pifile.h"
//! \ingroup System
//! \~\brief
//! \~english External process.
//! \~russian Внешний процесс.
class PIP_EXPORT PIProcess: public PIThread class PIP_EXPORT PIProcess: public PIThread
{ {
PIOBJECT_SUBCLASS(PIProcess, PIThread) PIOBJECT_SUBCLASS(PIProcess, PIThread)

View File

@@ -30,17 +30,6 @@
#define SALT_SIZE 8 #define SALT_SIZE 8
PISystemInfo::MountInfo::MountInfo() {
space_all = space_used = space_free = 0;
removable = false;
}
PISystemInfo::PISystemInfo() {
processorsCount = 1;
}
PISystemInfo * PISystemInfo::instance() { PISystemInfo * PISystemInfo::instance() {

View File

@@ -28,35 +28,121 @@
#include "pitime.h" #include "pitime.h"
//! \ingroup System
//! \~\brief
//! \~english Information about system.
//! \~russian Информация о системе.
class PIP_EXPORT PISystemInfo { class PIP_EXPORT PISystemInfo {
public: public:
PISystemInfo();
//! \ingroup System
//! \~\brief
//! \~english Mount point information.
//! \~russian Информация о точке монтирования.
struct PIP_EXPORT MountInfo { struct PIP_EXPORT MountInfo {
MountInfo();
//! \~english Absolute path to mount point
//! \~russian Абсолютный путь к точке монтирования
PIString mount_point; PIString mount_point;
//! \~english Device description
//! \~russian Описание устройства
PIString device; PIString device;
//! \~english Filesystem name
//! \~russian Имя файловой системы
PIString filesystem; PIString filesystem;
//! \~english Mount point label
//! \~russian Метка точки монтирования
PIString label; PIString label;
ullong space_all;
ullong space_used; //! \~english Total space in bytes
ullong space_free; //! \~russian Полный объем в байтах
bool removable; ullong space_all = 0;
//! \~english Used space in bytes
//! \~russian Занятый объем в байтах
ullong space_used = 0;
//! \~english Free space in bytes
//! \~russian Свободный объем в байтах
ullong space_free = 0;
//! \~english Is this device is removable
//! \~russian Является ли устройство съёмным
bool removable = false;
}; };
PIString ifconfigPath, execCommand, hostname, user, OS_name, OS_version, architecture; //! \~english Absolute path to "ifconfig" utility
PIDateTime execDateTime; //! \~russian Абсолютный путь к утилите "ifconfig"
int processorsCount; PIString ifconfigPath;
//! \~english Application execution path (\c argv[0])
//! \~russian Путь вызова приложения (\c argv[0])
PIString execCommand;
//! \~english System hostname
//! \~russian Hostname системы
PIString hostname;
//! \~english Username that starts application
//! \~russian Имя пользователя, запустившего приложение
PIString user;
//! \~english System name (Windows, MacOS, ...)
//! \~russian Имя системы (Windows, MacOS, ...)
PIString OS_name;
//! \~english System version
//! \~russian Версия системы
PIString OS_version;
//! \~english System architecture (x86, x86_64, ...)
//! \~russian Архитектура системы (x86, x86_64, ...)
PIString architecture;
//! \~english Application start date and time
//! \~russian Дата и время запуска приложения
PIDateTime execDateTime;
//! \~english System logical processors count
//! \~russian Количество логических процессоров системы
int processorsCount = 1;
//! \~english Returns all mount points absolute pathes
//! \~russian Возвращает абсолютные пути всех точек монтирования
static PIStringList mountRoots(); static PIStringList mountRoots();
//! \~english Returns information of all mount points
//! \~russian Возвращает информацию о всех точках монтирования
static PIVector<MountInfo> mountInfo(bool ignore_cache = false); static PIVector<MountInfo> mountInfo(bool ignore_cache = false);
//! \~english Returns system unique key
//! \~russian Возвращает уникальный ключ системы
static PIString machineKey(); static PIString machineKey();
//! \~english Returns system unique key hash
//! \~russian Возвращает хэш уникального ключа системы
static uint machineID(); static uint machineID();
//! \~english Returns singleton of %PISystemInfo
//! \~russian Возвращает синглтон %PISystemInfo
static PISystemInfo * instance(); static PISystemInfo * instance();
private:
PISystemInfo() {}
NO_COPY_CLASS(PISystemInfo)
}; };
//! \relatesalso PICout
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PISystemInfo::MountInfo & v) { inline PICout operator <<(PICout s, const PISystemInfo::MountInfo & v) {
s.setControl(0, true); s.setControl(0, true);
s << "MountInfo(" << v.device << " mounted on \"" << v.mount_point << "\", type " << v.filesystem s << "MountInfo(" << v.device << " mounted on \"" << v.mount_point << "\", type " << v.filesystem

View File

@@ -37,13 +37,6 @@
#endif #endif
PISystemMonitor::ProcessStatsFixed::ProcessStatsFixed() {
ID = parent_ID = group_ID = session_ID = priority = threads = 0;
physical_memsize = resident_memsize = share_memsize = virtual_memsize = data_memsize = 0;
cpu_load_user = cpu_load_system = 0.f;
}
void PISystemMonitor::ProcessStats::makeStrings() { void PISystemMonitor::ProcessStats::makeStrings() {
physical_memsize_readable.setReadableSize(physical_memsize); physical_memsize_readable.setReadableSize(physical_memsize);
resident_memsize_readable.setReadableSize(resident_memsize); resident_memsize_readable.setReadableSize(resident_memsize);
@@ -53,12 +46,6 @@ void PISystemMonitor::ProcessStats::makeStrings() {
} }
PISystemMonitor::ThreadStatsFixed::ThreadStatsFixed() {
id = 0;
cpu_load_kernel = cpu_load_user = -1.f;
}
#ifndef MICRO_PIP #ifndef MICRO_PIP
PRIVATE_DEFINITION_START(PISystemMonitor) PRIVATE_DEFINITION_START(PISystemMonitor)
#ifndef WINDOWS #ifndef WINDOWS

View File

@@ -29,75 +29,220 @@
#include "pithread.h" #include "pithread.h"
#include "pifile.h" #include "pifile.h"
class PIP_EXPORT PISystemMonitor: public PIThread
{ //! \ingroup System
//! \~\brief
//! \~english Process monitoring.
//! \~russian Мониторинг процесса.
class PIP_EXPORT PISystemMonitor: public PIThread {
PIOBJECT_SUBCLASS(PISystemMonitor, PIThread) PIOBJECT_SUBCLASS(PISystemMonitor, PIThread)
friend class PIIntrospectionServer; friend class PIIntrospectionServer;
public: public:
//! \~english Constructs unassigned %PISystemMonitor
//! \~russian Создает непривязанный %PISystemMonitor
PISystemMonitor(); PISystemMonitor();
~PISystemMonitor(); ~PISystemMonitor();
#pragma pack(push, 1) #pragma pack(push, 1)
//! \ingroup System
//! \~\brief
//! \~english Process statistics (fixed-size fields).
//! \~russian Статистика процесса (фиксированные поля).
struct PIP_EXPORT ProcessStatsFixed { struct PIP_EXPORT ProcessStatsFixed {
ProcessStatsFixed();
int ID; //! \~english PID
int parent_ID; //! \~russian PID
int group_ID; int ID = 0;
int session_ID;
int priority; //! \~english Parent PID
int threads; //! \~russian PID родителя
ullong physical_memsize; int parent_ID = 0;
ullong resident_memsize;
ullong share_memsize; //! \~english Group ID
ullong virtual_memsize; //! \~russian ID группы
ullong data_memsize; int group_ID = 0;
ullong ram_total;
ullong ram_free; //! \~english Session ID
ullong ram_used; //! \~russian ID сессии
float cpu_load_system; int session_ID = 0;
float cpu_load_user;
//! \~english Priority
//! \~russian Приоритет
int priority = 0;
//! \~english Threads count
//! \~russian Количество потоков
int threads = 0;
//! \~english Physical memory in bytes
//! \~russian Физическая память в байтах
ullong physical_memsize = 0;
//! \~english Resident memory in bytes
//! \~russian Резидентная память в байтах
ullong resident_memsize = 0;
//! \~english Share memory in bytes
//! \~russian Разделяемая память в байтах
ullong share_memsize = 0;
//! \~english Virtual memory in bytes
//! \~russian Виртуальная память в байтах
ullong virtual_memsize = 0;
//! \~english Data memory in bytes
//! \~russian Память данных в байтах
ullong data_memsize = 0;
//! \~english
//! \~russian
ullong ram_total = 0;
//! \~english
//! \~russian
ullong ram_free = 0;
//! \~english
//! \~russian
ullong ram_used = 0;
//! \~english CPU load in kernel space
//! \~russian Загрузка CPU в пространстве ядра
float cpu_load_system = 0.f;
//! \~english CPU load in user space
//! \~russian Загрузка CPU в пространстве пользователя
float cpu_load_user = 0.f;
}; };
//! \ingroup System
//! \~\brief
//! \~english Thread statistics (fixed-size fields).
//! \~russian Статистика потока (фиксированные поля).
struct PIP_EXPORT ThreadStatsFixed { struct PIP_EXPORT ThreadStatsFixed {
ThreadStatsFixed();
llong id; //! \~english TID
//! \~russian TID
llong id = 0;
//! \~english Overall live time
//! \~russian Полное время жизни
PISystemTime work_time; PISystemTime work_time;
//! \~english Busy time in kernel space
//! \~russian Время работы в пространстве ядра
PISystemTime kernel_time; PISystemTime kernel_time;
//! \~english Busy time in user space
//! \~russian Время работы в пространстве пользователя
PISystemTime user_time; PISystemTime user_time;
float cpu_load_kernel;
float cpu_load_user; //! \~english CPU load in kernel space
//! \~russian Загрузка CPU в пространстве ядра
float cpu_load_kernel = -1.f;
//! \~english CPU load in user space
//! \~russian Загрузка CPU в пространстве пользователя
float cpu_load_user = -1.f;
//! \~english Date and time of creation
//! \~russian Дата и время создания
PIDateTime created; PIDateTime created;
}; };
#pragma pack(pop) #pragma pack(pop)
//! \ingroup System
//! \~\brief
//! \~english Process statistics.
//! \~russian Статистика процесса.
struct PIP_EXPORT ProcessStats: ProcessStatsFixed { struct PIP_EXPORT ProcessStats: ProcessStatsFixed {
//! \~english Fill human-readable fields
//! \~russian Заполнить читаемые поля
void makeStrings(); void makeStrings();
//! \~english Execution command
//! \~russian Команда запуска
PIString exec_name; PIString exec_name;
//! \~english State
//! \~russian Состояние
PIString state; PIString state;
//! \~english Human-readable physical memory
//! \~russian Физическая память в читаемом виде
PIString physical_memsize_readable; PIString physical_memsize_readable;
//! \~english Human-readable resident memory
//! \~russian Резидентная память в читаемом виде
PIString resident_memsize_readable; PIString resident_memsize_readable;
//! \~english Human-readable share memory
//! \~russian Разделяемая память в читаемом виде
PIString share_memsize_readable; PIString share_memsize_readable;
//! \~english Human-readable virtual memory
//! \~russian Виртуальная память в читаемом виде
PIString virtual_memsize_readable; PIString virtual_memsize_readable;
//! \~english Human-readable data memory
//! \~russian Память данных в читаемом виде
PIString data_memsize_readable; PIString data_memsize_readable;
}; };
//! \ingroup System
//! \~\brief
//! \~english Thread statistics.
//! \~russian Статистика потока.
struct PIP_EXPORT ThreadStats: ThreadStatsFixed { struct PIP_EXPORT ThreadStats: ThreadStatsFixed {
//! \~english Name
//! \~russian Имя
PIString name; PIString name;
}; };
#ifndef MICRO_PIP #ifndef MICRO_PIP
//! \~english Starts monitoring of process with PID "pID" and update interval "interval_ms" milliseconds
//! \~russian Начинает мониторинг процесса с PID "pID" и интервалом обновления "interval_ms" миллисекунд
bool startOnProcess(int pID, int interval_ms = 1000); bool startOnProcess(int pID, int interval_ms = 1000);
#endif #endif
//! \~english Starts monitoring of application process with update interval "interval_ms" milliseconds
//! \~russian Начинает мониторинг процесса приложения с интервалом обновления "interval_ms" миллисекунд
bool startOnSelf(int interval_ms = 1000); bool startOnSelf(int interval_ms = 1000);
//! \~english Stop monitoring
//! \~russian Останавливает мониторинг
void stop(); void stop();
//! \~english Returns monitoring process PID
//! \~russian Возвращает PID наблюдаемого процесса
int pID() const {return pID_;} int pID() const {return pID_;}
//! \~english Returns monitoring process statistics
//! \~russian Возвращает статистику наблюдаемого процесса
ProcessStats statistic() const; ProcessStats statistic() const;
//! \~english Returns monitoring process threads statistics
//! \~russian Возвращает статистику потоков наблюдаемого процесса
PIVector<ThreadStats> threadsStatistic() const; PIVector<ThreadStats> threadsStatistic() const;
void setStatistic(const ProcessStats & s); void setStatistic(const ProcessStats & s);
//! \~english
//! \~russian
static ullong totalRAM(); static ullong totalRAM();
//! \~english
//! \~russian
static ullong freeRAM(); static ullong freeRAM();
//! \~english
//! \~russian
static ullong usedRAM(); static ullong usedRAM();
@@ -131,6 +276,9 @@ private:
}; };
//! \relatesalso PICout
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PISystemMonitor::ThreadStats & v) { inline PICout operator <<(PICout s, const PISystemMonitor::ThreadStats & v) {
s.setControl(0, true); s.setControl(0, true);
s << "ThreadInfo(\"" << v.name << "\", created " << v.created s << "ThreadInfo(\"" << v.name << "\", created " << v.created
@@ -142,9 +290,25 @@ inline PICout operator <<(PICout s, const PISystemMonitor::ThreadStats & v) {
return s; return s;
} }
//! \relatesalso PIByteArray
//! \~english Store operator
//! \~russian Оператор сохранения
PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ProcessStats & v); PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ProcessStats & v);
//! \relatesalso PIByteArray
//! \~english Restore operator
//! \~russian Оператор извлечения
PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ProcessStats & v); PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ProcessStats & v);
//! \relatesalso PIByteArray
//! \~english Store operator
//! \~russian Оператор сохранения
PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ThreadStats & v); PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ThreadStats & v);
//! \relatesalso PIByteArray
//! \~english Restore operator
//! \~russian Оператор извлечения
PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ThreadStats & v); PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ThreadStats & v);
#endif // PISYSTEMMONITOR_H #endif // PISYSTEMMONITOR_H