mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
39 lines
746 B
C++
39 lines
746 B
C++
|
|
#include "libimp/system.h"
|
|
#include "libimp/fmt.h"
|
|
#include "libimp/detect_plat.h"
|
|
#if defined(LIBIMP_OS_WIN)
|
|
# include "libimp/platform/win/system.h"
|
|
#else
|
|
# include "libimp/platform/posix/system.h"
|
|
#endif
|
|
|
|
namespace {
|
|
|
|
class system_error_category : public ::LIBIMP::error_category {
|
|
public:
|
|
std::string name() const {
|
|
return "system";
|
|
}
|
|
std::string message(::LIBIMP::error_code_t const &r) const {
|
|
return ::LIBIMP::fmt(r, ::LIBIMP::sys::error_str(r));
|
|
}
|
|
};
|
|
|
|
} // namespace
|
|
|
|
LIBIMP_NAMESPACE_BEG_
|
|
namespace sys {
|
|
|
|
error_category const &category() noexcept {
|
|
static system_error_category ec;
|
|
return ec;
|
|
}
|
|
|
|
error_code error() noexcept {
|
|
return error_code{error_no(), category()};
|
|
}
|
|
|
|
} // namespace sys
|
|
LIBIMP_NAMESPACE_END_
|