/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/Error.h

  • Committer: Gustav Hartvigsson
  • Date: 2013-09-05 22:40:17 UTC
  • mto: (5.2.3 simple_type_system_SMap)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: gustav.hartvigsson@gmail.com-20130905224017-garcgl5h866egppw
* Started work on making the code more prasable by DoxyGen.
* Fixed spelling errors in documentation

Show diffs side-by-side

added added

removed removed

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