Defines | |
#define | cpl_error_set_where(function) |
Set function name, source file and line number where a CPL error occurred. | |
#define | cpl_error_set(function, code) |
Set CPL error code, function name, source file and line number where an error occurred. | |
Typedefs | |
typedef enum _cpl_error_code_ | cpl_error_code |
The cpl_error_code type definition. | |
Enumerations | |
enum | _cpl_error_code_ { CPL_ERROR_NONE = 0, CPL_ERROR_UNSPECIFIED = 1, CPL_ERROR_DUPLICATING_STREAM, CPL_ERROR_ASSIGNING_STREAM, CPL_ERROR_FILE_IO, CPL_ERROR_BAD_FILE_FORMAT, CPL_ERROR_FILE_ALREADY_OPEN, CPL_ERROR_FILE_NOT_CREATED, CPL_ERROR_FILE_NOT_FOUND, CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_NULL_INPUT, CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_ILLEGAL_OUTPUT, CPL_ERROR_UNSUPPORTED_MODE, CPL_ERROR_SINGULAR_MATRIX, CPL_ERROR_DIVISION_BY_ZERO, CPL_ERROR_TYPE_MISMATCH, CPL_ERROR_INVALID_TYPE, CPL_ERROR_CONTINUE, CPL_ERROR_EOL } |
Available error codes. More... | |
Functions | |
void | cpl_error_reset (void) |
Reset the cpl_error_code. | |
cpl_error_code | cpl_error_set_code (cpl_error_code code) |
Set the cpl_error_code to the specified value. | |
cpl_error_code | cpl_error_get_code (void) |
Get the last cpl_error_code set. | |
const char * | cpl_error_get_message (void) |
Get standard message of last occurred CPL error. | |
const char * | cpl_error_get_function (void) |
Get the function name where the last CPL error occurred. | |
const char * | cpl_error_get_where (void) |
Get function name, source file and line number where the last CPL error occurred. | |
const char * | cpl_error_get_file (void) |
Get the source code file name where the last CPL error occurred. | |
unsigned | cpl_error_get_line (void) |
Get the line number where the last CPL error occurred. |
A cpl_error_code equal to the enumeration constant CPL_ERROR_NONE
would indicate no error condition. Note, however, that the cpl_error_code is only set when an error occurs, and it is not reset by successful function calls. For this reason it may be appropriate in some cases to reset the cpl_error_code using the function cpl_error_reset()
. The cpl_error_code set by a CPL function can be obtained by calling the function cpl_error_get_code()
, but functions of type cpl_error_code would not only return this code directly, but would also return CPL_ERROR_NONE
in case of success. Other CPL functions return zero on success, or a non-zero value to indicate a change of the cpl_error_code, while CPL functions returning a pointer would flag an error by returning a NULL
.
To each cpl_error_code is associated a standard error message, that can be obtained by calling the function cpl_error_get_message()
. Conventionally, no CPL function will ever display any error message, leaving to the caller the decision of how to handle a given error condition. A call to the function cpl_error_get_function()
would return the name of the function where the error occurred, and the functions cpl_error_get_file()
and cpl_error_get_line()
would also return the name of the source file containing the function code, and the line number where the error occurred. The function cpl_error_get_where()
would gather all this items together, in a colon-separated string.
#include <cpl_error.h>
|
Set CPL error code, function name, source file and line number where an error occurred.
|
|
Set function name, source file and line number where a CPL error occurred.
|
|
The cpl_error_code type definition.
|
|
|
Get the last cpl_error_code set.
|
|
Get the source code file name where the last CPL error occurred.
__FILE__ is undefined an empty string is returned. |
|
Get the function name where the last CPL error occurred.
|
|
Get the line number where the last CPL error occurred.
__LINE__ is undefined 0 is returned. |
|
Get standard message of last occurred CPL error.
CPL_ERROR_NONE , an empty string is returned. |
|
Get function name, source file and line number where the last CPL error occurred.
function_name:source_file:line_number |
|
Reset the cpl_error_code.
CPL_ERROR_NONE . |
|
Set the cpl_error_code to the specified value.
|