/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-04 15:05:39 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130904150539-7xfgt38hv5q3ycl2
Fixed a few things...
And added an error type...

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
 
 
7
 
 
8
#ifndef __H_ERROR__
 
9
#define __H_ERROR__
 
10
 
 
11
#include "baseobject.h"
 
12
#include <limits.h>
 
13
#include <stdlib.h>
 
14
#include <stdio.h>
 
15
#include <string.h>
 
16
 
 
17
typedef struct _SErrorPrivate SErrorPrivate;
 
18
 
 
19
typedef struct _SError {
 
20
  SBaseObjectInstance parent;
 
21
  SErrorPrivate * priv; //Pimple pointer to the private data.
 
22
  
 
23
} SError;
 
24
 
 
25
/**
 
26
 * The error class is not changed, no extra methods are needed.
 
27
 */
 
28
typedef struct _SErrorClass {
 
29
  SBaseObjectClass parent_class;
 
30
  
 
31
} SErrorClass;
 
32
 
 
33
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
 
39
} SErrorType;
 
40
 
 
41
 
 
42
/**
 
43
 * the constructor for the 
 
44
 */
 
45
SError * s_error_new (SErrorType error, char * message);
 
46
 
 
47
void s_error_free (SError * self);
 
48
 
 
49
SErrorType s_error_get_error_type (SError * self);
 
50
 
 
51
void s_error_print_error (SError * self);
 
52
 
 
53
#endif