Files
pip/libs/main/system/pisysteminfo.h
2022-04-06 20:11:47 +03:00

71 lines
2.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! \file pisysteminfo.h
* \ingroup System
* \~\brief
* \~english System information
* \~russian Информация о системе
*/
/*
PIP - Platform Independent Primitives
System information
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PISYSTEMINFO_H
#define PISYSTEMINFO_H
#include "pitime.h"
class PIP_EXPORT PISystemInfo {
public:
PISystemInfo();
struct PIP_EXPORT MountInfo {
MountInfo();
PIString mount_point;
PIString device;
PIString filesystem;
PIString label;
ullong space_all;
ullong space_used;
ullong space_free;
bool removable;
};
PIString ifconfigPath, execCommand, hostname, user, OS_name, OS_version, architecture;
PIDateTime execDateTime;
int processorsCount;
static PIStringList mountRoots();
static PIVector<MountInfo> mountInfo(bool ignore_cache = false);
static PIString machineKey();
static uint machineID();
static PISystemInfo * instance();
};
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
<< ", label \"" << v.label << "\", all " << PIString::readableSize(v.space_all)
<< ", used " << PIString::readableSize(v.space_used)
<< ", free " << PIString::readableSize(v.space_free) << ")";
s.restoreControl();
return s;
}
#endif // PISYSTEMINFO_H