bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
1 |
/*
|
2 |
(C) Gustav Hartvigsson, 2013.
|
|
3 |
|
|
4 |
This program is free software: you can redistribute it and/or modify
|
|
5 |
it under the terms of the GNU Lesser General Public License as
|
|
6 |
published by the Free Software Foundation, either version 3 of the
|
|
7 |
License.
|
|
8 |
||
9 |
This program is distributed in the hope that it will be useful,
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
GNU General Public License for more details.
|
|
13 |
||
14 |
You should have received a copy of the GNU General Public License
|
|
15 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16 |
*/
|
|
17 |
||
18 |
/** @file */
|
|
19 |
||
|
3
by Gustav Hartvigsson
Fixed a few things... |
20 |
#ifndef __H_ERROR__
|
21 |
#define __H_ERROR__
|
|
22 |
||
23 |
#include "baseobject.h" |
|
24 |
#include <limits.h> |
|
25 |
#include <stdlib.h> |
|
26 |
#include <stdio.h> |
|
27 |
#include <string.h> |
|
28 |
||
29 |
/**
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
30 |
* An opaque datastructure that holds the SError's private data.
|
31 |
*/
|
|
32 |
typedef struct _SErrorPrivate SErrorPrivate; |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
33 |
|
34 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
35 |
/**
|
36 |
* An SError is a data structure that inherits from SBaseObjectInstance.
|
|
|
19
by Gustav Hartvigsson
* Woops |
37 |
*
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
38 |
* An SError represents an error that can occur.
|
39 |
*/
|
|
40 |
typedef struct _SError { |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
41 |
SBaseObjectInstance parent; |
42 |
SErrorPrivate * priv; /** Pimple pointer to the private data. */ |
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
43 |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
44 |
} SError; |
45 |
||
46 |
/**
|
|
47 |
* The error class is not changed, no extra methods are needed.
|
|
48 |
*/
|
|
49 |
typedef struct _SErrorClass { |
|
50 |
SBaseObjectClass parent_class; |
|
51 |
|
|
52 |
} SErrorClass; |
|
53 |
||
54 |
/** @brief
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
55 |
* The different error types.
|
56 |
*/
|
|
57 |
typedef enum { |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
58 |
S_ERROR_NONE = 0, /**< Not on error */ |
|
8
by Gustav Hartvigsson
* Fixed a DoxyGen error documentation error of an enum. |
59 |
S_ERROR_INPUT_OUTPUT, /**< An I/O error */ |
60 |
S_ERROR_OVERFLOW, /**< An Overflow error */ |
|
61 |
S_ERROR_OTHER = INT_MAX - 1, /**< Some unknowned error */ |
|
62 |
S_ERROR_NULL = INT_MAX /**< An NULL error */ |
|
63 |
} SErrorType; |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
64 |
|
65 |
||
66 |
/**
|
|
67 |
* the constructor for the an SError
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
68 |
*/
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
69 |
SError * s_error_new (SErrorType error, char * message); |
70 |
||
71 |
/**
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
72 |
* This function calles the deinitize method of the object.
|
73 |
*/
|
|
74 |
void s_error_free (SError * self); |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
75 |
|
76 |
/**
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
77 |
* This function returns the ErrorType of on object.
|
78 |
*/
|
|
79 |
SErrorType s_error_get_error_type (SError * self); |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
80 |
|
81 |
/**
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
82 |
* This function prints the current error to stdout.
|
83 |
*/
|
|
84 |
void s_error_print_error (SError * self); |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
85 |
|
86 |
#endif
|
|
87 |