00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00022 #ifndef OPGP_ERROR_H
00023 #define OPGP_ERROR_H
00024
00025 #ifdef __cplusplus
00026 extern "C"
00027 {
00028 #endif
00029
00030 #include "unicode.h"
00031
00032 #ifdef _WIN32
00033 #define OPGP_ERROR_STATUS_SUCCESS ERROR_SUCCESS //!< No error occured.
00034 #else
00035 #define OPGP_ERROR_STATUS_SUCCESS 0 //!< No error occured.
00036 #endif
00037
00038 #define OPGP_ERROR_STATUS_FAILURE 1 //!< An error occurred.
00039
00040 #define ERROR_MESSAGE_LENGTH 256
00041
00045 typedef struct {
00046 LONG errorStatus;
00047 LONG errorCode;
00048 TCHAR errorMessage[ERROR_MESSAGE_LENGTH+1];
00049 } OPGP_ERROR_STATUS;
00050
00055 #define OPGP_ERROR_CHECK(status) status.errorStatus
00056
00063 #define OPGP_ERROR_CREATE_ERROR(status, code, message) status.errorStatus = OPGP_ERROR_STATUS_FAILURE; \
00064 status.errorCode = code; \
00065 _tcsncpy(status.errorMessage, message, ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')
00066
00071 #define OPGP_ERROR_CREATE_NO_ERROR(status) status.errorStatus = OPGP_ERROR_STATUS_SUCCESS; status.errorCode = 0; \
00072 _tcsncpy(status.errorMessage, _T("Success"), ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')
00073
00080 #define OPGP_ERROR_CREATE_NO_ERROR_WITH_CODE(status, code, message) status.errorStatus = OPGP_ERROR_STATUS_SUCCESS; \
00081 status.errorCode = code; \
00082 _tcsncpy(status.errorMessage, message, ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')
00083
00084 #endif