#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "kp_error.h"
#include "kp_errors_define_decl.txt"
Data Structures | |
struct | kp_error_s |
KP error structure. More... | |
Defines | |
#define | KP_ERRORS_LIST_END_CODE -666 |
Using with kp_errors_list (. | |
#define | KP_ERROR_DECLARATION(enum_code_decl, code_value, error_text) { enum_code_decl, error_text }, |
#define | KP_ERROR_DECLARATION_LAST(enum_code_decl, code_value, error_text) { enum_code_decl, error_text }, |
Typedefs | |
typedef struct kp_error_s | kp_error_t |
KP error structure. | |
Functions | |
int | set_error (int error_code) |
Sets code of error. | |
int | get_error_code () |
Return code of error. | |
int | get_error_code_and_reset () |
Return code of error and reset error. | |
const char * | get_error_text () |
Return error message. | |
char * | get_error_text_and_reset () |
Return error message and reset error. | |
const char * | get_error_text_by_code (int error_code) |
Gets error message by error code. | |
int | reset_error () |
Sets code of error equals 0 (no errors) and message equals empty string. |
#define KP_ERROR_DECLARATION | ( | enum_code_decl, | |||
code_value, | |||||
error_text | ) | { enum_code_decl, error_text }, |
#define KP_ERROR_DECLARATION_LAST | ( | enum_code_decl, | |||
code_value, | |||||
error_text | ) | { enum_code_decl, error_text }, |
#define KP_ERRORS_LIST_END_CODE -666 |
Using with kp_errors_list (.
typedef struct kp_error_s kp_error_t |
KP error structure.
int get_error_code | ( | ) |
Return code of error.
int get_error_code_and_reset | ( | ) |
Return code of error and reset error.
const char* get_error_text | ( | ) |
Return error message.
char* get_error_text_and_reset | ( | ) |
Return error message and reset error.
Return error message and reset error. You need free message text after using.
const char* get_error_text_by_code | ( | int | error_code | ) |
Gets error message by error code.
error_code | code of error. |
int reset_error | ( | ) |
Sets code of error equals 0 (no errors) and message equals empty string.
int set_error | ( | int | error_code | ) |
Sets code of error.
error_code | code of error. |