1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/**
* An Error is a data structure that inherets from BaseObject.
*
* An Error represents an error that can occur.
*/
#ifndef __H_ERROR__
#define __H_ERROR__
#include "baseobject.h"
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct _SErrorPrivate SErrorPrivate;
typedef struct _SError {
SBaseObjectInstance parent;
SErrorPrivate * priv; //Pimple pointer to the private data.
} SError;
/**
* The error class is not changed, no extra methods are needed.
*/
typedef struct _SErrorClass {
SBaseObjectClass parent_class;
} SErrorClass;
typedef enum {
S_ERROR_NONE = 0,
S_ERROR_INPUT_OUTPUT,
S_ERROR_OVERFLOW,
S_ERROR_OTHER = INT_MAX - 1,
S_ERROR_NULL = INT_MAX
} SErrorType;
/**
* the constructor for the
*/
SError * s_error_new (SErrorType error, char * message);
void s_error_free (SError * self);
SErrorType s_error_get_error_type (SError * self);
void s_error_print_error (SError * self);
#endif
|