|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Abstract base class for error code categories. More...
#include <error_category.h>


Public Member Functions | |
| virtual | ~error_category ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual std::string_view | name () const noexcept=0 |
| Returns the unique name of this error category. | |
| virtual std::string | message (int code) const =0 |
| Returns a human-readable message for the given error code. | |
| virtual bool | equivalent (int code, const error_category &other_category, int other_code) const noexcept |
| Checks if an error code in this category is equivalent to another. | |
| bool | operator== (const error_category &other) const noexcept |
| Equality comparison between categories. | |
| bool | operator!= (const error_category &other) const noexcept |
| Inequality comparison between categories. | |
| bool | operator< (const error_category &other) const noexcept |
| Less-than comparison for use in ordered containers. | |
Protected Member Functions | |
| error_category ()=default | |
| Protected default constructor. | |
| error_category (const error_category &)=delete | |
| error_category & | operator= (const error_category &)=delete |
| error_category (error_category &&)=delete | |
| error_category & | operator= (error_category &&)=delete |
Abstract base class for error code categories.
Each system can define its own error category by inheriting from this class. Categories provide:
Example implementation:
Definition at line 74 of file error_category.h.
|
virtualdefault |
Virtual destructor for proper cleanup of derived classes.
|
protecteddefault |
Protected default constructor.
Categories should be accessed through their singleton instance(), not constructed directly.
|
protecteddelete |
|
protecteddelete |
|
inlinevirtualnoexcept |
Checks if an error code in this category is equivalent to another.
The default implementation checks for exact category and code match. Derived classes can override this to provide semantic equivalence (e.g., "timeout" errors from different systems may be equivalent).
| code | Error code in this category |
| other_category | Category of the other error code |
| other_code | The other error code value |
Definition at line 111 of file error_category.h.
|
pure virtual |
Returns a human-readable message for the given error code.
| code | The error code value |
Implemented in kcenon::common::common_error_category.
Referenced by kcenon::common::typed_error_code::message().

|
pure virtualnoexcept |
Returns the unique name of this error category.
The name should be a short, descriptive identifier for the category. Examples: "common", "network", "database", "logger"
Implemented in kcenon::common::common_error_category.
Referenced by kcenon::common::typed_error_code::category_name().

|
inlinenoexcept |
Inequality comparison between categories.
Definition at line 134 of file error_category.h.
|
inlinenoexcept |
Less-than comparison for use in ordered containers.
Definition at line 141 of file error_category.h.
|
protecteddelete |
|
protecteddelete |
|
inlinenoexcept |
Equality comparison between categories.
Categories are compared by identity (address), not by name. This ensures that two different categories with the same name are not considered equal.
| other | Category to compare with |
Definition at line 127 of file error_category.h.