UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
systeminfo.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Ingemar Hedvall
3 * SPDX-License-Identifier: MIT
4 */
5
12#pragma once
13
14#include <filesystem>
15#include <string>
16#include <algorithm>
17
18namespace util::supervise {
19
27 public:
34 SystemInfo() = default;
35
45 explicit SystemInfo(std::string program_name);
46
54 void ProgramName(std::string name) { program_name_ = std::move(name); }
55
60 [[nodiscard]] std::string ProgramName() const { return program_name_; }
61
66 [[nodiscard]] std::string DataPath() const;
67
72 [[nodiscard]] std::string ConfigPath() const;
73
78 [[nodiscard]] std::string CachePath() const;
79
84 [[nodiscard]] std::string StatePath() const;
85
90 [[nodiscard]] std::string ProgramDataPath() const;
91
92 private:
93 std::string program_name_;
94};
95
96} // util
97
98
SystemInfo()=default
Default constructor.
std::string DataPath() const
Returns the default data path.
void ProgramName(std::string name)
Sets the system or program name.
Definition systeminfo.h:54
std::string ConfigPath() const
Returns the default configuration path.
std::string ProgramName() const
Returns the program or system name.
Definition systeminfo.h:60
std::string CachePath() const
Returns the default cache path.
SystemInfo(std::string program_name)
Constructor with its program or system name.
std::string StatePath() const
Returns the default state path.
std::string ProgramDataPath() const
Returns the default program data path.