Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
info.h
Go to the documentation of this file.
1
8
9/*
10Copyright (c) 2026 MrXie1109
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files (the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions:
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29*/
30
31#pragma once
32#include <string>
33
34namespace console {
39 inline std::string license() {
40 return R"(Copyright (c) 2026 MrXie1109
41
42Permission is hereby granted, free of charge, to any person obtaining a copy
43of this software and associated documentation files (the "Software"), to deal
44in the Software without restriction, including without limitation the rights
45to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46copies of the Software, and to permit persons to whom the Software is
47furnished to do so, subject to the following conditions:
49The above copyright notice and this permission notice shall be included in all
50copies or substantial portions of the Software.
51
52THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58SOFTWARE.)";
59 }
60
65 */
66 inline std::string platform() {
67#ifdef _WIN32
68 return "Windows";
69#elif defined(__linux__)
70 return "Linux";
71#elif defined(__APPLE__)
72 return "macOS";
73#else
74 return "Unknown";
75#endif
76 }
77
83 inline std::string compiler() {
84#ifdef __GNUC__
85 return "GCC " + std::to_string(__GNUC__) + "."
86 + std::to_string(__GNUC_MINOR__);
87#elif defined(_MSC_VER)
88 return "MSVC " + std::to_string(_MSC_VER);
89#elif defined(__clang__)
90 return "Clang";
91#else
92 return "Unknown";
93#endif
94 }
95
101 inline std::string version() {
102 return //
103 R"(console version 8.0.0 (2026-09-06) -- "One, Two, Three, Four.")";
104 }
105
110 inline std::string author() {
111 return "MrXie1109";
112 }
113}
本库所有组件所在的顶层命名空间。
std::string license()
返回 MIT 许可证全文。
Definition info.h:39
std::string author()
返回库的作者。
Definition info.h:92
std::string version()
返回库的版本字符串。
Definition info.h:83
std::string platform()
返回当前操作系统平台名称。
Definition info.h:48
std::string compiler()
返回当前使用的编译器名称和版本。
Definition info.h:65