squareball  0.2.0.43-8b14
A general-purpose library for C99
sb-error.h
Go to the documentation of this file.
1 /*
2  * squareball: A general-purpose library for C99.
3  * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
4  *
5  * This program can be distributed under the terms of the BSD License.
6  * See the file LICENSE.
7  */
8 
9 #ifndef _SQUAREBALL_ERROR_H
10 #define _SQUAREBALL_ERROR_H
11 
12 #include <stdarg.h>
13 #include <stdlib.h>
14 #include "sb-mem.h"
15 
42 typedef char* (*sb_error_to_string_func_t) (void *data);
43 
49 typedef struct {
50 
54  const char *name;
55 
60 
65 
67 
71 typedef struct _sb_error_t sb_error_t;
72 
81 
88 const char* sb_error_get_type_name(sb_error_t *err);
89 
96 const void* sb_error_get_data(sb_error_t *err);
97 
105 const char* sb_error_to_string(sb_error_t *err);
106 
112 void sb_error_free(sb_error_t *err);
113 
116 #endif /* _SQUAREBALL_ERROR_H */
void(* sb_free_func_t)(void *ptr)
Definition: sb-mem.h:29
const void * sb_error_get_data(sb_error_t *err)
sb_free_func_t free_func
Definition: sb-error.h:64
const char * name
Definition: sb-error.h:54
const char * sb_error_get_type_name(sb_error_t *err)
char *(* sb_error_to_string_func_t)(void *data)
Definition: sb-error.h:42
void sb_error_free(sb_error_t *err)
Memory allocation related helpers.
Definition: sb-error.h:49
const char * sb_error_to_string(sb_error_t *err)
sb_error_to_string_func_t to_string_func
Definition: sb-error.h:59
sb_error_t * sb_error_new_from_type(sb_error_type_t *type, void *data)
struct _sb_error_t sb_error_t
Definition: sb-error.h:71