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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*
(C) Gustav Hartvigsson, 2013.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file */
#ifndef __H_ERROR__
#define __H_ERROR__
#include "baseobject.h"
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**
* An opaque datastructure that holds the SError's private data.
*/
typedef struct _SErrorPrivate SErrorPrivate;
/**
* An SError is a data structure that inherets from SBaseObjectInstance.
*
* An SError represents an error that can occur.
*/
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;
/** @brief
* The different error types.
*/
typedef enum {
S_ERROR_NONE = 0, /**< Not on error */
S_ERROR_INPUT_OUTPUT, /**< An I/O error */
S_ERROR_OVERFLOW, /**< An Overflow error */
S_ERROR_OTHER = INT_MAX - 1, /**< Some unknowned error */
S_ERROR_NULL = INT_MAX /**< An NULL error */
} SErrorType;
/**
* the constructor for the an SError
*/
SError * s_error_new (SErrorType error, char * message);
/**
* This function calles the deinitize method of the object.
*/
void s_error_free (SError * self);
/**
* This function returns the ErrorType of on object.
*/
SErrorType s_error_get_error_type (SError * self);
/**
* This function prints the current error to stdout.
*/
void s_error_print_error (SError * self);
#endif
|