irccd  3.0.3
system.hpp
1 /*
2  * system.hpp -- platform dependent functions for system inspection
3  *
4  * Copyright (c) 2013-2019 David Demelier <markand@malikania.fr>
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef IRCCD_SYSTEM_HPP
20 #define IRCCD_SYSTEM_HPP
21 
27 #include "sysconfig.hpp"
28 
29 #include <cstdint>
30 #include <string>
31 #include <string_view>
32 #include <vector>
33 
34 #include <boost/filesystem.hpp>
35 
39 namespace irccd::sys {
40 
46 void set_program_name(std::string name) noexcept;
47 
53 auto name() -> std::string;
54 
60 auto version() -> std::string;
61 
67 auto uptime() -> std::uint64_t;
68 
75 auto ticks() -> std::uint64_t;
76 
83 auto env(const std::string& var) -> std::string;
84 
90 auto home() -> std::string;
91 
103 auto cachedir() -> boost::filesystem::path;
104 
112 auto datadir() -> boost::filesystem::path;
113 
122 auto sysconfdir() -> boost::filesystem::path;
123 
131 auto plugindir() -> boost::filesystem::path;
132 
138 auto username() -> std::string;
139 
151 auto config_filenames(std::string_view file) -> std::vector<std::string>;
152 
160 auto plugin_filenames(const std::string& name,
161  const std::vector<std::string>& extensions) -> std::vector<std::string>;
162 
163 } // !irccd::sys
164 
165 #endif // !IRCCD_SYSTEM_HPP
irccd::sys::uptime
auto uptime() -> std::uint64_t
irccd::sys::env
auto env(const std::string &var) -> std::string
irccd::sys::sysconfdir
auto sysconfdir() -> boost::filesystem::path
irccd::sys::plugindir
auto plugindir() -> boost::filesystem::path
irccd::sys::config_filenames
auto config_filenames(std::string_view file) -> std::vector< std::string >
irccd::sys::home
auto home() -> std::string
irccd::sys::cachedir
auto cachedir() -> boost::filesystem::path
irccd::sys::plugin_filenames
auto plugin_filenames(const std::string &name, const std::vector< std::string > &extensions) -> std::vector< std::string >
irccd::sys::username
auto username() -> std::string
irccd::sys::ticks
auto ticks() -> std::uint64_t
irccd::sys
Namespace for system functions.
Definition: system.hpp:39
irccd::sys::name
auto name() -> std::string
irccd::sys::set_program_name
void set_program_name(std::string name) noexcept
irccd::sys::version
auto version() -> std::string
irccd::sys::datadir
auto datadir() -> boost::filesystem::path