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

@@ -1,8 +1,8 @@
/*! \file pisysteminfo.h
* \ingroup System
* \~\brief
* \~english System information
* \~russian Информация о системе
* \~english System information
* \~russian Информация о системе
*/
/*
PIP - Platform Independent Primitives
@@ -28,35 +28,121 @@
#include "pitime.h"
//! \ingroup System
//! \~\brief
//! \~english Information about system.
//! \~russian Информация о системе.
class PIP_EXPORT PISystemInfo {
public:
PISystemInfo();
//! \ingroup System
//! \~\brief
//! \~english Mount point information.
//! \~russian Информация о точке монтирования.
struct PIP_EXPORT MountInfo {
MountInfo();
//! \~english Absolute path to mount point
//! \~russian Абсолютный путь к точке монтирования
PIString mount_point;
//! \~english Device description
//! \~russian Описание устройства
PIString device;
//! \~english Filesystem name
//! \~russian Имя файловой системы
PIString filesystem;
//! \~english Mount point label
//! \~russian Метка точки монтирования
PIString label;
ullong space_all;
ullong space_used;
ullong space_free;
bool removable;
//! \~english Total space in bytes
//! \~russian Полный объем в байтах
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
//! \~russian Абсолютный путь к утилите "ifconfig"
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;
int processorsCount;
//! \~english System logical processors count
//! \~russian Количество логических процессоров системы
int processorsCount = 1;
//! \~english Returns all mount points absolute pathes
//! \~russian Возвращает абсолютные пути всех точек монтирования
static PIStringList mountRoots();
//! \~english Returns information of all mount points
//! \~russian Возвращает информацию о всех точках монтирования
static PIVector<MountInfo> mountInfo(bool ignore_cache = false);
//! \~english Returns system unique key
//! \~russian Возвращает уникальный ключ системы
static PIString machineKey();
//! \~english Returns system unique key hash
//! \~russian Возвращает хэш уникального ключа системы
static uint machineID();
//! \~english Returns singleton of %PISystemInfo
//! \~russian Возвращает синглтон %PISystemInfo
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) {
s.setControl(0, true);
s << "MountInfo(" << v.device << " mounted on \"" << v.mount_point << "\", type " << v.filesystem