The file provides support of basic error code processing mechanism. More...
Classes | |
union | CHSV_ERROR_CODE |
Definition of a chsvlib error code as a composition of bit fields. The structure is composed to match The Microsoft's definition of the HRESULT. More... | |
struct | CHSV_ERROR_CODE::bitsfields |
Bit fields corresponding to components of the error code. More... | |
struct | CHSV_ERROR_INFO |
The contents of the chsvlib last error state. More... | |
struct | IErrorInfo |
An interface that must be implemented by any class implementing an object to hold error information processed by the SetLastChsvErrorInformation and GetLastChsvErrorInfo. More... | |
class | chsvlib_general_category_t |
A class of general chsvlib error category, which is introduced to conform std::system_error requirements. More... | |
struct | is_error_code_enum< ::Chusov::chsvlib_error > |
struct | is_error_condition_enum< ::Chusov::chsvlib_error > |
Namespaces | |
Chusov | |
Basic chsvlib namespace. | |
Macros | |
#define | ChsvCode(sev, fac, speccode) |
A macro generating a chsvlib error code by the specified severity, facility and error code. More... | |
#define | ChsvCode_Severity(nCode) |
Tests if the severity bit of the nCode is set to an error. | |
#define | ChsvCode_Facility(nCode) |
Returns eleven facility bits of the nCode. | |
#define | ChsvCode_Specific(nCode) |
Returns the specific error code of the code nCode. | |
#define | ChsvSucceeded(nCode) |
Tests if the severity bit of the nCode indicates an error. | |
#define | ChsvFailed(nCode) |
Tests if the severity bit of the nCode indicates success. | |
#define | MAKE_CHSV_ERROR(nSpecCode) |
Macro for defining constant integer general chsvlib error codes. More... | |
#define | verify(expression) implementation |
Verifies that a parametrically specified predicate expression is satisfied and calls std::abort, if that is not the case. More... | |
#define | verify_security_constraint(cond) ((cond)?true:(RESOLVE_NAMESPACE(Chusov) apply_security_constraint_verification_proc(__FILE__, __LINE__, __func__), false)) |
Assertion alias used in functions implementing secure C extensions as defined in ISO-IEC TR 24731-1. Such assertions are generated when a caller violates runtime constraints defined in the specification. The macro is given to allow disabling the assertion during debug. If the assertion succeeds, the returned evaluated predicate is true . More... | |
Typedefs | |
typedef std::int32_t | chsverror_t |
A type alias for chsvlib error codes. | |
typedef unsigned long | chsv_syserror_t |
A type alias resolving to a platform-defined integral type of system errors. | |
typedef void(* | security_constraint_violation_procedure) (const char *file, unsigned line, const char *func) |
A type alias for a pointer to a procedure used to react upon a runtime constraint violation as defined in the ISO-IEC TR 24731-1 specification. More... | |
Enumerations | |
enum | OnErrorInfoFailture { ERROR_INFO_INIT_FAILED } |
The constant ERROR_INFO_INIT_FAILED is used as a marker for constructors of the CErrorInfoImpl template class parameter of the SetLastChsvErrorInformation function. More... | |
enum class | chsvlib_error { out_of_memory = (signed int) CHSVERROR_OUTOFMEMORY , invalid_parameter = (signed int) CHSVERROR_INVALID_PARAMETER , insufficient_buffer = (signed int) CHSVERROR_INSUFFICIENT_BUFFER , out_of_range = (signed int) CHSVERROR_OUT_OF_RANGE , initialization_failure = (signed int) CHSVERROR_INITIALIZATION_FAILURE , not_initialized = (signed int) CHSVERROR_NOT_INITIALIZED , already_initialized = (signed int) CHSVERROR_ALREADY_INITIALIZED , invalid_version = (signed int) CHSVERROR_INVALID_VERSION , entity_not_found = (signed int) CHSVERROR_NOT_FOUND , entity_already_exists = (signed int) CHSVERROR_ALREADY_EXISTS , invalid_resource = (signed int) CHSVERROR_INVALID_RESOURCE , access_denied = (signed int) CHSVERROR_ACCESS_DENIED , storage_is_full = (signed int) CHSVERROR_STORAGE_FULL , invalid_char_sequence = (signed int) CHSVERROR_INVALID_CHAR_SEQUENCE , operation_cancelled = (signed int) CHSVERROR_OPERATION_CANCELLED , name_too_long = (signed int) CHSVERROR_NAME_TOO_LONG , deadlock = (signed int) CHSVERROR_DEADLOCK , timeout = (signed int) CHSVERROR_TIMEOUT , owner_dead = (signed int) CHSVERROR_OWNER_IS_DEAD , operation_not_supported = (signed int) CHSVERROR_NOT_SUPPORTED , arithmetic_overflow = (signed int) CHSVERROR_ARITHMETIC_OVERFLOW , stack_overflow = (signed int) CHSVERROR_STACK_OVERFLOW , underlying_platform_error = (signed int) CHSVERROR_PLATFORM_ERROR , program_logic_error = (signed int) CHSVERROR_LOGIC_ERROR } |
A strongly typed enumeration with values equal to existing chsvlib error codes. . More... | |
Functions | |
errno_t | Win32ErrorToPosixError (unsigned long nError) noexcept |
Translates a Windows system error code to a POSIX error code. . More... | |
chsverror_t | Win32ErrorToChsvError (unsigned long nError) noexcept |
Translates a Windows system error code to the corresponding chsvlib error code. More... | |
chsverror_t | PosixErrorToChsvError (errno_t nError) noexcept |
Translates a POSIX error code to the corresponding chsvlib error code. More... | |
chsverror_t | SystemErrorToChsvError (chsv_syserror_t err) |
Delegates a call to a platform-dependent function which translates a system error to a corresponding chsvlib error code in a portable way. More... | |
chsv_syserror_t | GetLastSystemError () |
Returns a platform-specific last-error code, i.e. Windows error on Windows (delegates a call to GetLastError) and POSIX error on Linux (see errno). . More... | |
errno_t | GetLastSystemErrorAsPosixCode () |
Returns a platform-specific last-error code represented in POSIX error code space. More... | |
chsverror_t | CHSV_MAKE_CHSV_ERROR (unsigned short nSpecCode) |
The function creating chsvlib error code from the general facility. More... | |
const wchar_t * | ChsvErrorDescriptionW (chsverror_t nErrorCode, unsigned long nReserved) noexcept |
Returns a wide string description on the specified chsvlib error code. More... | |
const char * | ChsvErrorDescriptionA (chsverror_t nErrorCode, unsigned long nReserved) noexcept |
Returns an multi-byte string description on the specified chsvlib error code. More... | |
template<class char_type > | |
const char_type * | ChsvErrorDescription (chsverror_t nErrorCode, unsigned long nReserved=0) noexcept |
Returns an string description on the specified chsvlib error code. More... | |
void | SetLastChsvError (chsverror_t nError) noexcept |
Sets the specified chsvlib code as a thread specific last error code. More... | |
chsverror_t | GetLastChsvError () noexcept |
Returns the last thread specific chsvlib error code. More... | |
void | SetLastChsvErrorInfo (chsverror_t nError, const void *pExtraInfo, std::size_t cbExtraInfo) noexcept |
Sets the a thread specific last error code along with additional data that is supposed to provide extra information about the error. More... | |
const CHSV_ERROR_INFO * | GetLastChsvErrorInfo () noexcept |
Returns a pointer to the CHSV_ERROR_INFO structure containing definition of the last chsvlib error code. More... | |
void | security_constraint_assertion_proc (const char *file, unsigned line, const char *func) noexcept |
Upon a call, if NDEBUG macro is not defined, prints out a message composed from two strings, and an integer, and calls std::abort. If NDEBUG is defined, the function does nothing. More... | |
void | security_constraint_verification_proc (const char *file, unsigned line, const char *func) noexcept |
Upon a call prints out a message composed from two strings, and an integer, and calls std::abort. More... | |
security_constraint_violation_procedure | set_thread_security_constraint_violation_procedure (security_constraint_violation_procedure proc) noexcept |
Sets a procedure called when a security violation defined by ISO-IEC TR 24731-1 is detected via verify_security_constraint. More... | |
template<class CErrorInfoImpl > | |
void | SetLastChsvErrorInformation (unsigned long nError, const CErrorInfoImpl &refErrorInfo) noexcept |
The function setting the last chsvlib error code and its description. More... | |
template<class CErrorInfoImpl > | |
CErrorInfoImpl | GetLastChsvErrorInformation () |
Returns the last extra error description as specified by a call to SetLastChsvErrorInfo(unsigned long nError, const CErrorInfoImpl& refErrorInfo) NOTHROW. More... | |
void | SetLastChsvErrorWC (chsverror_t nChsvError) noexcept |
Sets last chsvlib error code together with win32 error code and C error code. The last two codes are set to ERROR_SUCCESS and 0 respectively. More... | |
void | SetLastChsvErrorInfoWC (chsverror_t nChsvError, unsigned long nWin32Error, errno_t nCError) noexcept |
Sets last chsvlib error code together with win32 error code and C error code. More... | |
unsigned long | GetLastChsvErrorWin32 () noexcept |
Returns last Windows error code. More... | |
errno_t | GetLastChsvErrorC () noexcept |
Returns last C error code. More... | |
const std::error_category & | chsvlib_general_category () noexcept |
Returns a reference to a general error category to generate std::system_error exceptions based on chsvlib error codes. | |
std::error_condition | make_error_condition (chsvlib_error err) |
Creates and returns a new std::error_condition based on a value of chsvlib_error enumeration type. . More... | |
std::error_code | make_error_code (chsvlib_error err) |
Creates and returns an error code object in the form of the standard std::error_code class based on the specified value of the chsvlib_error enumeration type. . More... | |
The file provides support of basic error code processing mechanism.