acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
c_error_number.h
1
#pragma once
2
3
4
CLASS_DECL_ACME ::e_status get_last_status();
5
CLASS_DECL_ACME
void
set_last_status(const ::e_status & estatus);
6
7
9
//class c_errno
10
//{
11
//public:
12
//
13
//
14
// ::i32 m_iErrorNumber;
15
//
16
// inline static ::u32 get_last_error()
17
// {
18
//
19
// return errno;
20
//
21
// }
22
//
23
// inline static string GetErrorDescription(::i32 iErrorCode = get_last_error())
24
// {
25
//
26
// return strerror(iErrorCode);
27
//
28
// }
29
//
30
//};
31
32
33
#ifdef __WIN32
35
class
CLASS_DECL_ACME
sys_error
36
{
37
public
:
38
39
static ::u32 get_last_error() { return ::get_last_status(); }
40
41
static
string
GetErrorDescription(::i32 iErrorCode = get_last_error())
42
{
43
LPVOID pMsgBuf =
nullptr
;
44
45
format_message(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
46
nullptr
, iErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
// Default language
47
reinterpret_cast<
char_pointer
>
(&pMsgBuf), 0,
nullptr
);
48
49
string
strErrorDescription;
50
if
(pMsgBuf)
51
52
{
53
strErrorDescription =
reinterpret_cast<
char_pointer
>
(pMsgBuf);
54
55
LocalFree(pMsgBuf);
56
57
}
58
return
strErrorDescription;
59
}
60
};
61
#else
62
63
class
CLASS_DECL_ACME
sys_error
:
public
c_error
64
{
65
public
:
66
67
};
68
69
#endif
70
71
c_error
Class with static functions to get information about an error.
Definition
aaa_error.h:10
sys_error
Definition
aaa_error.h:61
platform
c_error_number.h
Generated by
1.17.0