|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
MSTL异常处理类与工具 更多...
专题 | |
| 异常类集 | |
| MSTL异常类集 | |
类 | |
| class | exception_wrapper |
| 异常包装器基类 更多... | |
| class | typed_exception_wrapper< Ex > |
| 类型化异常包装器模板类 更多... | |
| class | exception_ptr |
| 异常指针类 更多... | |
| struct | exception_ptr::ecb |
| 异常控制块 更多... | |
宏定义 | |
| #define | MSTL_ERROR_BUILD_DERIVED_CLASS(THIS, BASE, INFO) |
| 构建可派生的异常类宏 | |
| #define | MSTL_ERROR_BUILD_FINAL_CLASS(THIS, BASE, INFO) |
| 构建最终异常类宏 | |
函数 | |
| void MSTL_API | throw_with_stack (const exception &err) |
| 抛出异常并打印堆栈信息 | |
| virtual void | exception_wrapper::rethrow () const =0 |
| 重新抛出异常 | |
| virtual const std::type_info & | exception_wrapper::type () const noexcept=0 |
| 获取异常类型信息 | |
| virtual unique_ptr< exception_wrapper > | exception_wrapper::clone () const =0 |
| 克隆异常包装器 | |
| typed_exception_wrapper< Ex >::typed_exception_wrapper (const Ex &ex) | |
| 拷贝构造函数 | |
| typed_exception_wrapper< Ex >::typed_exception_wrapper (Ex &&ex) noexcept | |
| 移动构造函数 | |
| MSTL_ALWAYS_INLINE void | typed_exception_wrapper< Ex >::rethrow () const override |
| 重新抛出异常 | |
| MSTL_ALWAYS_INLINE const std::type_info & | typed_exception_wrapper< Ex >::type () const noexcept override |
| 获取异常类型信息 | |
| MSTL_ALWAYS_INLINE unique_ptr< exception_wrapper > | typed_exception_wrapper< Ex >::clone () const override |
| 克隆异常包装器 | |
| exception_ptr::ecb::ecb (unique_ptr< exception_wrapper > wrapper) | |
| 构造函数 | |
| MSTL_ALWAYS_INLINE void | exception_ptr::ecb::add_ref () noexcept |
| 增加引用计数 | |
| MSTL_ALWAYS_INLINE void | exception_ptr::ecb::release () noexcept |
| 减少引用计数 | |
| exception_ptr::exception_ptr (nullptr_t np=nullptr) noexcept | |
| 默认构造函数 | |
| exception_ptr::exception_ptr (const exception_ptr &other) noexcept | |
| 拷贝构造函数 | |
| exception_ptr::exception_ptr (exception_ptr &&other) noexcept | |
| 移动构造函数 | |
| exception_ptr::~exception_ptr () noexcept | |
| 析构函数 | |
| exception_ptr & | exception_ptr::operator= (const exception_ptr &other) noexcept |
| 拷贝赋值运算符 | |
| exception_ptr & | exception_ptr::operator= (exception_ptr &&other) noexcept |
| 移动赋值运算符 | |
| void | exception_ptr::swap (exception_ptr &other) noexcept |
| 交换两个异常指针 | |
| exception_ptr::operator bool () const noexcept | |
| 布尔转换运算符 | |
| bool | exception_ptr::operator== (const exception_ptr &rhs) const noexcept |
| 相等比较运算符 | |
| bool | exception_ptr::operator!= (const exception_ptr &rhs) const noexcept |
| 不等比较运算符 | |
| bool | exception_ptr::operator== (nullptr_t) const noexcept |
| 与空指针比较相等 | |
| bool | exception_ptr::operator!= (nullptr_t) const noexcept |
| 与空指针比较不等 | |
| MSTL_NODISCARD const std::type_info & | exception_ptr::exception_type () const noexcept |
| 获取异常类型信息 | |
| template<typename Ex> | |
| exception_ptr | make_exception_ptr (Ex ex) |
| 创建异常指针 | |
| exception_ptr MSTL_API | current_exception () |
| 获取当前异常 | |
| void MSTL_API | rethrow_exception (const exception_ptr &p) |
| 重新抛出异常 | |
变量 | |
| unique_ptr< exception_wrapper > | exception_ptr::ecb::wrapper |
| 异常包装器 | |
| atomic_int | exception_ptr::ecb::ref_count {1} |
| 引用计数 | |
MSTL异常处理类与工具
| #define MSTL_ERROR_BUILD_DERIVED_CLASS | ( | THIS, | |
| BASE, | |||
| INFO ) |
构建可派生的异常类宏
| THIS | 当前类名 |
| BASE | 基类名 |
| INFO | 默认错误信息 |
快速定义可进一步派生的异常类。
在文件 exception.hpp 第 44 行定义.
| #define MSTL_ERROR_BUILD_FINAL_CLASS | ( | THIS, | |
| BASE, | |||
| INFO ) |
构建最终异常类宏
| THIS | 当前类名 |
| BASE | 基类名 |
| INFO | 默认错误信息 |
快速定义不可派生的异常类。
在文件 exception.hpp 第 60 行定义.
|
pure virtual |
克隆异常包装器
创建当前异常包装器的深拷贝。
在 typed_exception_wrapper< Ex > 内被实现.
引用了 clone().
被这些函数引用 clone().
|
inlineoverridevirtual |
克隆异常包装器
实现了 exception_wrapper.
在文件 exception_ptr.hpp 第 101 行定义.
引用了 _MSTL , 以及 make_unique().
|
noexcept |
获取当前异常
捕获当前异常并创建异常指针。 如果当前没有异常被捕获,返回空的异常指针。
|
inlineexplicit |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
创建异常指针
| Ex | 异常类型 |
| ex | 异常对象 |
创建引用指定异常的异常指针。 如果内存分配失败,返回空的异常指针。
在文件 exception_ptr.hpp 第 332 行定义.
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
减少引用计数
在文件 exception_ptr.hpp 第 143 行定义.
引用了 memory_order_acq_rel, memory_order_acquire , 以及 ref_count.
被这些函数引用 exception_ptr::make_exception_ptr.
|
pure virtual |
|
inlineoverridevirtual |
| void MSTL_API rethrow_exception | ( | const exception_ptr & | p | ) |
重新抛出异常
| p | 异常指针 |
重新抛出异常指针引用的异常。
引用了 MSTL_END_NAMESPACE__ , 以及 rethrow_exception().
被这些函数引用 rethrow_exception().
|
inlinenoexcept |
| void MSTL_API throw_with_stack | ( | const exception & | err | ) |
抛出异常并打印堆栈信息
| err | 要抛出的异常对象 |
引用了 MSTL_END_NAMESPACE__ , 以及 throw_with_stack().
被这些函数引用 throw_with_stack().
|
pure virtualnoexcept |
|
inlineoverridevirtualnoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |