-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystemInformation.cpp
More file actions
48 lines (40 loc) · 1.07 KB
/
SystemInformation.cpp
File metadata and controls
48 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
** EPITECH PROJECT, 2022
** cpp_rush3_2018
** File description:
** SystemInformation.cpp, created by herbosa
*/
#include <iostream>
#include <sys/utsname.h>
#include <sstream>
#include "SystemInformation.hpp"
SystemInformation::SystemInformation() :
_content({TEXT, ""}),
_pos({0, 0}),
_title("System Informations")
{
}
void SystemInformation::UpdateContent() {
struct utsname sysinfo;
if (uname(&sysinfo) == -1)
throw std::runtime_error("uname call error");
std::stringstream info;
info << "Operating system :" << sysinfo.sysname << std::endl
<< "Release Kernel Version :" << sysinfo.release << std::endl
<< "Kernel Build Timestamp :" << sysinfo.version << std::endl
<< "Machine Architecture :" << sysinfo.machine << std::endl;
_content.content = info.str();
}
Content SystemInformation::getContent() {
return _content;
}
std::string SystemInformation::getTitle() {
return _title;
}
ModulePosition SystemInformation::getPosititon() {
return _pos;
}
IMonitorModule *SystemInformation::clone()
{
return new SystemInformation();
}