37
39
#define S_BOX_CLASS(k) (SBoxClass *)(k);
42
* C11 Generic macro to create object easily.
44
#define s_box_new(x) _Generic((x)\
45
spointer: s_box_new_pointer,\
46
SObject: s_box_new_object,\
47
long: s_box_new_long,\
48
short: s_box_new_short,\
49
char: s_box_new_char,\
50
wchar_t: s_box_new_wchar,\
51
char *: s_box_new_string,\
52
wchar_t *: s_box_new_wstring\
40
56
* Creates a new SBox object.
42
58
* @param object The object to be boxed.
45
61
* @return A new SBox object.
47
SBox * s_box_new_pointer (spointer object);
49
SBox * s_box_new_sobject (SObject * object);
51
SBox * s_box_new_int (int i);
53
SBox * s_box_new_long (long l);
55
SBox * s_box_new_short (short s);
57
SBox * s_box_new_char (char c);
59
SBox * s_box_new_wchar (wchar_t wc);
61
SBox * s_box_new_uint (unsigned int ui);
63
SBox * s_box_new_ulong (long l);
65
SBox * s_box_new_ushort (short s);
67
SBox * s_box_new_string (char * s);
69
SBox * s_box_new_wstring (wchar_t * ws);
64
s_box_new_pointer (spointer object);
67
s_box_new_sobject (SObject * object);
70
s_box_new_int (int i);
73
s_box_new_long (long l);
76
s_box_new_short (short s);
79
s_box_new_char (char c);
82
s_box_new_wchar (wchar_t wc);
85
s_box_new_uint (unsigned int ui);
88
s_box_new_ulong (long l);
91
s_box_new_ushort (short s);
94
s_box_new_string (char * s);
97
s_box_new_wstring (wchar_t * ws);
72
100
* Free the an SBox.
74
102
* @param box The SBox to be freed.
76
void s_box_free (SBox * box);
105
s_box_free (SBox * box);
79
108
* Get the object that is contained inside the SBox.
83
112
* @return a pointer to the object.
85
spointer s_box_get_object (SBox * box);
115
s_box_get_object (SBox * box);
88
118
* Gets the SType of the object that is stored in the SBox.
90
SType s_box_get_type (SBox * box);
121
s_box_get_type (SBox * box);
93
124
* Gets the type name of the object.
98
129
* @note caller must free the string.
100
char * s_box_get_type_name (SBox * box);
132
s_box_get_type_name (SBox * box);
102
void s_box_set_free_func (SBox * box, FreeFunc free_func);
135
s_box_set_free_func (SBox * box, FreeFunc free_func);
107
void s_box_set_free_data_on_free (SBox * self, sboolean free_data);
141
s_box_set_free_data_on_free (SBox * self, sboolean free_data);