NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
neforce::error_category类 参考abstract

错误类别抽象基类 更多...

#include <error_category.hpp>

类 neforce::error_category 继承关系图:
[图例]

Public 成员函数

virtual const char * name () const noexcept=0
 获取错误类别名称
virtual string message (int32_t ev) const =0
 获取错误码对应的可读描述
virtual error_condition default_error_condition (int32_t ev) const noexcept
 获取错误码对应的默认错误条件
virtual bool equivalent (int code, const error_condition &condition) const noexcept
 检查错误码与错误条件是否等价
virtual bool equivalent (const error_code &code, int condition) const noexcept
 检查错误码与错误条件是否等价
Public 成员函数 继承自 neforce::icomparable< error_category >
constexpr bool operator== (const error_category &rhs) const noexcept(noexcept(derived().equal_to(rhs)))
 相等比较运算符
constexpr bool operator!= (const error_category &rhs) const noexcept(noexcept(!(derived().equal_to(rhs))))
 不等比较运算符
constexpr bool operator< (const error_category &rhs) const noexcept(noexcept(derived().less_than(rhs)))
 小于比较运算符
constexpr bool operator> (const error_category &rhs) const noexcept(noexcept(rhs.less_than(derived())))
 大于比较运算符
constexpr bool operator<= (const error_category &rhs) const noexcept(noexcept(!(rhs.less_than(derived()))))
 小于等于比较运算符
constexpr bool operator>= (const error_category &rhs) const noexcept(noexcept(!(derived().less_than(rhs))))
 大于等于比较运算符

静态 Public 成员函数

static const error_category & generic () noexcept
 获取通用错误类别单例
static const error_category & system () noexcept
 获取系统错误类别单例

详细描述

错误类别抽象基类

定义错误类别的核心接口。每个错误类别以单例形式存在, 通过地址比较区分,提供错误码到可读消息的映射能力。

内置两种标准类别:

注解
实例不可复制、不可移动,始终通过引用或指针使用

在文件 error_category.hpp37 行定义.

成员函数说明

◆ default_error_condition()

virtual error_condition neforce::error_category::default_error_condition ( int32_t ev) const
nodiscardvirtualnoexcept

获取错误码对应的默认错误条件

参数
ev错误码值
返回
默认错误条件

将当前类别的错误码映射到跨类别的通用错误条件。

neforce::generic_error_category , 以及 neforce::system_error_category 重载.

引用了 default_error_condition().

被这些函数引用 default_error_condition().

◆ equivalent() [1/2]

virtual bool neforce::error_category::equivalent ( const error_code & code,
int condition ) const
nodiscardvirtualnoexcept

检查错误码与错误条件是否等价

参数
code错误码
condition错误码值
返回
等价返回true

引用了 equivalent().

◆ equivalent() [2/2]

virtual bool neforce::error_category::equivalent ( int code,
const error_condition & condition ) const
nodiscardvirtualnoexcept

检查错误码与错误条件是否等价

参数
code错误码值
condition错误条件
返回
等价返回true

引用了 equivalent().

被这些函数引用 equivalent() , 以及 equivalent().

◆ message()

virtual string neforce::error_category::message ( int32_t ev) const
nodiscardpure virtual

获取错误码对应的可读描述

参数
ev错误码值
返回
错误描述字符串

neforce::generic_error_category, neforce::ssl_error_category , 以及 neforce::system_error_category 内被实现.

引用了 message().

被这些函数引用 message().

◆ name()

virtual const char * neforce::error_category::name ( ) const
nodiscardpure virtualnoexcept

获取错误类别名称

返回
类别名称

neforce::generic_error_category, neforce::ssl_error_category , 以及 neforce::system_error_category 内被实现.


该类的文档由以下文件生成: