14 #ifndef __PTPMGMT_ERR_H
15 #define __PTPMGMT_ERR_H
20 __PTPMGMT_NAMESPACE_BEGIN
39 Error() : m_line(0) {}
40 void doError(
bool use_errno,
const char *file,
int line,
const char *func,
41 const std::string &msg);
42 const std::string &fetch();
43 static Error &getCur();
48 static void perror(
const char *file,
int line,
const char *func,
49 const std::string &msg)
50 { getCur().doError(
true, file, line, func, msg); }
51 static void error(
const char *file,
int line,
const char *func,
52 const std::string &msg)
53 { getCur().doError(
false, file, line, func, msg); }
54 static std::string doFormat(
const char *format, ...);
55 static void clear() { getCur().m_line = 0; }
63 static bool isError() {
return getCur().m_line > 0; }
68 static const std::string &
getError() {
return getCur().fetch(); }
73 static const std::string &
getFile() {
return getCur().m_file; }
83 static const std::string &
getFunc() {
return getCur().m_func; }
88 static int getErrno() {
return getCur().m_errno; }
94 static const std::string &
getMsg() {
return getCur().m_msg; }
103 __PTPMGMT_NAMESPACE_END
Get Last Error happend in library, C API.
Keep last error.
Definition: err.h:29
static const std::string & getError()
Definition: err.h:68
static const std::string & getErrnoMsg()
static const std::string & getMsg()
Definition: err.h:94
static bool isError()
Definition: err.h:63
static int getFileLine()
Definition: err.h:78
static const std::string & getFunc()
Definition: err.h:83
static int getErrno()
Definition: err.h:88
static const std::string & getFile()
Definition: err.h:73