/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
1
#ifndef __H_BOX__
2
#define __H_BOX__
3
#include "defs.h"
4
#include "baseobject.h"
43 by Gustav Hartvigsson
* Code cleanup
5
#include "Func.h"
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
6
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
7
BEGIN_DECLS
8
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
9
/** @file
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
10
 * @defgroup SBox SBox
11
 * @addtogroup SBox
12
 * @{
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
13
 * An SBox is a boxed type.
14
 */
15
16
17
/** @brief
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
18
 * A reference counted box sitting on top of an SObject.
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
19
 */
43 by Gustav Hartvigsson
* Code cleanup
20
typedef struct SBox SBox;
21
22
typedef struct SBoxClass SBoxClass;
23
24
typedef struct SBoxPrivate SBoxPrivate;
25
26
struct SBox {
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
27
  SObject parent;
28
  SBoxPrivate * priv;
43 by Gustav Hartvigsson
* Code cleanup
29
};
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
30
43 by Gustav Hartvigsson
* Code cleanup
31
struct SBoxClass {
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
32
  SObjectClass parent_class;
49 by Gustav Hartvigsson
* started work SBox (Untested).
33
  FreeFunc free_func;
43 by Gustav Hartvigsson
* Code cleanup
34
};
35
49 by Gustav Hartvigsson
* started work SBox (Untested).
36
#define S_BOX(o) (SBox *)(o);
37
#define S_BOX_CLASS(k) (SBoxClass *)(k);
38
43 by Gustav Hartvigsson
* Code cleanup
39
/**
40
 * Creates a new SBox object.
41
 * 
42
 * @param object The object to be boxed.
43
 * @param freefunc The Function to be used when freeing the boxed object.
44
 *
45
 * @return A new SBox object.
46
 */
49 by Gustav Hartvigsson
* started work SBox (Untested).
47
SBox * s_box_new_pointer (spointer object);
48
49
SBox * s_box_new_sobject (SObject * object);
50
51
SBox * s_box_new_int (int i);
52
53
SBox * s_box_new_long (long l);
54
55
SBox * s_box_new_short (short s);
56
57
SBox * s_box_new_char (char c);
58
59
SBox * s_box_new_wchar (wchar_t wc);
60
61
SBox * s_box_new_uint (unsigned int ui);
62
63
SBox * s_box_new_ulong (long l);
64
65
SBox * s_box_new_ushort (short s);
66
67
SBox * s_box_new_string (char * s);
68
69
SBox * s_box_new_wstring (wchar_t * ws);
43 by Gustav Hartvigsson
* Code cleanup
70
71
/**
72
 * Free the an SBox.
73
 *
74
 * @param box The SBox to be freed.
75
 */
76
void s_box_free (SBox * box);
77
78
/**
79
 * Get the object that is contained inside the SBox.
80
 *
81
 * @param box The SBox to get the object from.
82
 *
83
 * @return a pointer to the object.
84
 */
85
spointer s_box_get_object (SBox * box);
86
87
/**
88
 * Gets the SType of the object that is stored in the SBox.
89
 */
49 by Gustav Hartvigsson
* started work SBox (Untested).
90
SType s_box_get_type (SBox * box);
43 by Gustav Hartvigsson
* Code cleanup
91
92
/**
93
 * Gets the type name of the object.
94
 *
95
 * @param box The SBox to get the type name from.
96
 * @return A String containing the name of the type.
97
 * 
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
98
 * @note caller must free the string.
43 by Gustav Hartvigsson
* Code cleanup
99
 */
49 by Gustav Hartvigsson
* started work SBox (Untested).
100
char * s_box_get_type_name (SBox * box);
101
102
void s_box_set_free_func (SBox * box, FreeFunc free_func);
103
104
/**
105
 * 
106
 */
107
void s_box_set_free_data_on_free (SBox * self, sboolean free_data);
108
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
109
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
110
/** @} */
111
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
112
END_DECLS
113
114
#endif