/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: 2015-04-08 18:25:07 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150408182507-094jw13yhmi3bhfu
* Added "check" target for testing.
* Changed SRC to SSTS_SRC for future proofing.
* Removed a few "_" from before some struct names. It is not needed.
* Re-wrote how s_object_to_string () works on SError's. Should be faster now, but less safe...
  * To make this work I added SErrorTypeName string array. (Need to surpress the errer it creats).
* Re-orderd SErrorType enum.
* Use s_string_new_fmt () the default method for s_object_to_string ().
* Changed to strdup in some functions in utils.c.
* Added s_current_time () function to get an ISO time string.
* Added some more documentation to utils.h
* !DEBUG -> DEBUG in utils.h
* Added more tests to the test suite.
* Re-Wrote test_macros.h to display time, making it a lil' bit nicer to look at.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
/**
40
40
 * An opaque datastructure that holds the SError's private data.
41
41
 */
42
 
typedef struct _SErrorPrivate SErrorPrivate;
 
42
typedef struct SErrorPrivate SErrorPrivate;
43
43
 
44
44
 
45
45
/**
47
47
 * 
48
48
 * An SError represents an error that can occur.
49
49
 */
50
 
typedef struct _SError {
 
50
typedef struct SError {
51
51
  SObject parent;
52
52
  SErrorPrivate * priv; /** Pimple pointer to the private data. */
53
53
  
56
56
/**
57
57
 * The error class is not changed, no extra methods are needed.
58
58
 */
59
 
typedef struct _SErrorClass {
 
59
typedef struct SErrorClass {
60
60
  SObjectClass parent_class;
61
61
  
62
62
} SErrorClass;
66
66
 */
67
67
typedef enum {
68
68
  S_ERROR_NONE = 0, /**< Not on error */
69
 
  S_ERROR_INPUT_OUTPUT, /**< An I/O error */
70
 
  S_ERROR_OVERFLOW, /**< An Overflow error */
71
 
  S_ERROR_OTHER = INT_MAX - 1, /**< Some unknowned error */
72
 
  S_ERROR_NULL = INT_MAX /**< An NULL error */
 
69
  S_ERROR_NULL = 1, /**< An NULL error */
 
70
  S_ERROR_OTHER = 2, /**< Some unknowned error */
 
71
  S_ERROR_INPUT_OUTPUT = 3, /**< An I/O error */
 
72
  S_ERROR_OVERFLOW = 4, /**< An Overflow error */
73
73
} SErrorType;
74
74
 
 
75
/**
 
76
 * Holds the names of the string version of SErrorType.
 
77
 */
 
78
static char * SErrorTypeName[] = {
 
79
  "NONE",
 
80
  "NULL",
 
81
  "OTHER",
 
82
  "INPUT/OUTPUT",
 
83
  "OVERFLOW",
 
84
  NULL,
 
85
  NULL
 
86
};
 
87
 
75
88
 
76
89
/**
77
90
 * the constructor for the an SError