meta: add c++ wrapper of core module
This commit is contained in:
62
core-mm/include/blue/core/status.hpp
Normal file
62
core-mm/include/blue/core/status.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef BLUE_CORE_STATUS_HPP_
|
||||
#define BLUE_CORE_STATUS_HPP_
|
||||
|
||||
#include <blue/core/status.h>
|
||||
|
||||
namespace blue
|
||||
{
|
||||
class status
|
||||
{
|
||||
public:
|
||||
#define __MM_STATUS_ENUM(name) name = B_ERR_##name
|
||||
enum _status : int {
|
||||
SUCCESS = B_SUCCESS,
|
||||
__MM_STATUS_ENUM(NO_MEMORY),
|
||||
__MM_STATUS_ENUM(OUT_OF_BOUNDS),
|
||||
__MM_STATUS_ENUM(INVALID_ARGUMENT),
|
||||
__MM_STATUS_ENUM(NAME_EXISTS),
|
||||
__MM_STATUS_ENUM(NOT_SUPPORTED),
|
||||
__MM_STATUS_ENUM(BAD_STATE),
|
||||
__MM_STATUS_ENUM(NO_ENTRY),
|
||||
__MM_STATUS_ENUM(NO_DATA),
|
||||
__MM_STATUS_ENUM(NO_SPACE),
|
||||
__MM_STATUS_ENUM(UNKNOWN_FUNCTION),
|
||||
__MM_STATUS_ENUM(BAD_FORMAT),
|
||||
__MM_STATUS_ENUM(IO_FAILURE),
|
||||
__MM_STATUS_ENUM(IS_DIRECTORY),
|
||||
__MM_STATUS_ENUM(NOT_DIRECTORY),
|
||||
__MM_STATUS_ENUM(PERMISSION_DENIED),
|
||||
__MM_STATUS_ENUM(BUSY),
|
||||
__MM_STATUS_ENUM(COMPRESSION_FAILURE),
|
||||
__MM_STATUS_ENUM(TYPE_REGISTRATION_FAILURE),
|
||||
__MM_STATUS_ENUM(CLASS_INIT_FAILURE),
|
||||
};
|
||||
|
||||
status() = default;
|
||||
status(_status v)
|
||||
: v_(static_cast<b_status>(v))
|
||||
{
|
||||
}
|
||||
status(b_status v)
|
||||
: v_(v)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator!() const
|
||||
{
|
||||
return v_ != B_SUCCESS;
|
||||
}
|
||||
|
||||
operator b_status() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
const char *to_string(void);
|
||||
const char *description(void);
|
||||
|
||||
private:
|
||||
b_status v_ = B_SUCCESS;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user