Console Library 4.7.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
35{
40 inline std::string license()
41 {
42 return R"(Copyright (c) 2026 MrXie1109
43
44Permission is hereby granted, free of charge, to any person obtaining a copy
45of this software and associated documentation files (the "Software"), to deal
46in the Software without restriction, including without limitation the rights
47to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48copies of the Software, and to permit persons to whom the Software is
49furnished to do so, subject to the following conditions:
51The above copyright notice and this permission notice shall be included in all
52copies or substantial portions of the Software.
53
54THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60SOFTWARE.)";
61 }
62
68 inline std::string platform()
69 {
70#ifdef _WIN32
71 return "Windows";
72#elif defined(__linux__)
73 return "Linux";
74#elif defined(__APPLE__)
75 return "macOS";
76#else
77 return "Unknown";
78#endif
79 }
80
83
86 inline std::string compiler()
87 {
88#ifdef __GNUC__
89 return "GCC " +
90 std::to_string(__GNUC__) +
91 "." +
92 std::to_string(__GNUC_MINOR__);
93#elif defined(_MSC_VER)
94 return "MSVC " + std::to_string(_MSC_VER);
95#elif defined(__clang__)
96 return "Clang";
97#else
98 return "Unknown";
99#endif
100 }
101
106 inline std::string version()
107 {
108 return "console version 4.7.0 (2026-05-04) -- \"Better Random.\"";
109 }
110
115 inline std::string author()
116 {
117 return "MrXie1109";
118 }
119}
本库所有组件所在的顶层命名空间。
std::string license()
返回 MIT 许可证全文。
Definition info.h:40
std::string author()
返回库的作者。
Definition info.h:97
std::string version()
返回库的版本字符串。
Definition info.h:88
std::string platform()
返回当前操作系统平台名称。
Definition info.h:50
std::string compiler()
返回当前使用的编译器名称和版本。
Definition info.h:68