#include <status.h>
Classes | |
| class | ErrorRecord |
Public Member Functions | |
| ActionStatus () | |
| CommonErrorType | GetErrorCode () |
| bool | Successful () |
| bool | operator== (CommonErrorType error) |
| bool | operator!= (CommonErrorType error) |
| String | GetErrorText () |
| String | ProduceDebugDump () |
| String | GetMostInformativeText () |
Private Member Functions | |
| void | AttachError (CommonErrorType Result, const String::value_type *file, unsigned line, const String::value_type *Function, bool SubStatus) |
| ActionStatus (CommonErrorType Result, const String::value_type *file, unsigned line, const String::value_type *Function) | |
Static Private Member Functions | |
| static String | FormatErrorCode (CommonErrorType code) |
Private Attributes | |
| CommonErrorType | m_Result |
| std::list< ErrorRecord > | m_ErrorRecords |
Friends | |
| static friend ActionStatus | _MAKE_STATUS (CommonErrorType ErrorType, const String::value_type *pszFile, unsigned Line, const String::value_type *pszFunction) |
| static friend void | _ASSIGN_STATUS (ActionStatus *pStatus, CommonErrorType Error, const String::value_type *pszFile, unsigned Line, const String::value_type *pszFunction) |
| static friend void | _ASSIGN_SUBSTATUS (ActionStatus *pStatus, ActionStatus &Source, CommonErrorType Error, const String::value_type *pszFile, unsigned Line, const String::value_type *pszFunction) |
This class is an abstraction for such things as HRESULT in Win32, NTSTATUS in DDK and errno in Unix. If a method wants to return the status of its call, it can do it in two ways:
ActionStatus Test1() { ... return MAKE_STATUS(UnknownError); }
void *Test2(ActionStatus *pStatus = NULL) { if (...) { ASSIGN_STATUS(pStatus, FileNotFound); return NULL; } ActionStatus status = Test1(); if (!Test1()) { ASSIGN_STATUS(pStatus, status); --- OR --- ASSIGN_SUBSTATUS(pStatus, status, SomeDetailedErrorCode); return NULL; } ASSIGN_STATUS(pStatus, Success); return ...; }As a result, you may simply call the ActionStatus::ProduceDebugDump() method to get a dump like this:
The parameter is incorrect. in: CreateSomething (at e:\projects\cvsed\bzslib\tests\filetest\filetest.cpp, line 104) Invalid pointer in: SomeOtherFunction (at e:\projects\cvsed\bzslib\tests\filetest\filetest.cpp, line 111)Simply include such output in your error messages in the debug version and save plenty of time in finding errors.
| BazisLib::ActionStatus::ActionStatus | ( | CommonErrorType | Result, | |
| const String::value_type * | file, | |||
| unsigned | line, | |||
| const String::value_type * | Function | |||
| ) | [inline, private] |

| BazisLib::ActionStatus::ActionStatus | ( | ) | [inline] |
| void BazisLib::ActionStatus::AttachError | ( | CommonErrorType | Result, | |
| const String::value_type * | file, | |||
| unsigned | line, | |||
| const String::value_type * | Function, | |||
| bool | SubStatus | |||
| ) | [inline, private] |
| static String BazisLib::ActionStatus::FormatErrorCode | ( | CommonErrorType | code | ) | [static, private] |
| CommonErrorType BazisLib::ActionStatus::GetErrorCode | ( | ) | [inline] |
| String BazisLib::ActionStatus::GetErrorText | ( | ) | [inline] |

| String BazisLib::ActionStatus::GetMostInformativeText | ( | ) | [inline] |

| bool BazisLib::ActionStatus::operator!= | ( | CommonErrorType | error | ) | [inline] |
| bool BazisLib::ActionStatus::operator== | ( | CommonErrorType | error | ) | [inline] |
| String BazisLib::ActionStatus::ProduceDebugDump | ( | ) | [inline] |

| bool BazisLib::ActionStatus::Successful | ( | ) | [inline] |
| static friend void _ASSIGN_STATUS | ( | ActionStatus * | pStatus, | |
| CommonErrorType | Error, | |||
| const String::value_type * | pszFile, | |||
| unsigned | Line, | |||
| const String::value_type * | pszFunction | |||
| ) | [friend] |
| static friend void _ASSIGN_SUBSTATUS | ( | ActionStatus * | pStatus, | |
| ActionStatus & | Source, | |||
| CommonErrorType | Error, | |||
| const String::value_type * | pszFile, | |||
| unsigned | Line, | |||
| const String::value_type * | pszFunction | |||
| ) | [friend] |
| static friend ActionStatus _MAKE_STATUS | ( | CommonErrorType | ErrorType, | |
| const String::value_type * | pszFile, | |||
| unsigned | Line, | |||
| const String::value_type * | pszFunction | |||
| ) | [friend] |
std::list<ErrorRecord> BazisLib::ActionStatus::m_ErrorRecords [private] |