Loading...
Searching...
No Matches
platformAPI.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <vector>
5
7
8namespace by {
9 enum consoleColor {
10 CONSOLE_COLOR_START = 0,
11 BLACK = CONSOLE_COLOR_START,
12 BLUE,
13 GREEN,
14 CYAN,
15 RED,
16 MAGENTA,
17 BROWN,
18 LIGHTGRAY,
19 DARKGRAY,
20 LIGHTBLUE,
21 LIGHTGREEN,
22 LIGHTCYAN,
23 LIGHTRED,
24 LIGHTMAGENTA,
25 YELLOW,
26 CONSOLE_COLOR_END,
27 WHITE = CONSOLE_COLOR_END
28 };
29
53 namespace platformAPI {
59 const _nout std::string& foreColor(consoleColor fore);
60
66 const _nout std::string& backColor(consoleColor back);
67
72 _nout std::string createNowTime(const std::string& strftime_format);
73
80 _nout std::vector<std::string> callstack();
81
86 _nout std::string demangle(const nchar* org);
87
92 _nout std::string filterDemangle(const nchar* org);
93
99 _nout std::string getExecPath();
100
106 _nout std::string exec(const std::string& cmd);
107
108 _nout nuint64 getNowMs();
109
115 _nout std::string toAddrId(const void* inst);
116
117 _nout void log(const std::string& msg);
118 _nout void log(const std::string* it);
119
124 _nout std::string format(const nchar* fmt, ...);
125
126 _nout std::string format(const nchar* fmt, va_list args);
127 _nout std::string format(const std::string& fmt, va_list args);
128 _nout std::string format(const std::string* fmt, va_list args);
129
134 _nout void crash(const nchar* msg, ...);
135
136 _nout void crash(const std::string& msg, va_list args);
137 _nout void crash(const std::string* msg, va_list args);
138 _nout void crash(const std::string& msg);
139 _nout void crash(const std::string* msg);
140
147 _nout nbool unlimitCoreDump();
148 }; // namespace platformAPI
149} // namespace by
const string & foreColor(consoleColor fore)
Returns platform-specific string for console foreground color.
Definition platformAPI.cpp:51
string createNowTime(const string &strftime_format)
Creates formatted timestamp using strftime format.
Definition platformAPI.cpp:103
string toAddrId(const void *inst)
Converts pointer to 4-character hexadecimal identifier.
Definition platformAPI.cpp:127
vector< string > callstack()
Captures current call stack for debugging.
Definition platformAPI.cpp:179
string demangle(const nchar *org)
Demangles C++ symbol name to human-readable form.
Definition platformAPI.cpp:208
nbool unlimitCoreDump()
Enables unlimited core dump size for debugging.
Definition platformAPI.cpp:302
string getExecPath()
Retrieves absolute path of currently running executable.
Definition platformAPI.cpp:144
string exec(const string &cmd)
Executes shell command and captures output.
Definition platformAPI.cpp:161
std::string format(const nchar *fmt,...)
Formats string using printf-style specifiers.
Definition platformAPI.cpp:233
string filterDemangle(const nchar *org)
Demangles C++ symbol and extracts only the function name portion.
Definition platformAPI.cpp:222
void crash(const nchar *msg,...)
Terminates program with error message and call stack dump.
Definition platformAPI.cpp:257
const string & backColor(consoleColor back)
Returns platform-specific string for console background color.
Definition platformAPI.cpp:79