16
unsigned long m_ulong;
17
unsigned short m_ushort;
22
void s_method_box_free (SBox * self);
24
/* Private function to allocate and set methods to the SBox.
27
SBox * self = malloc (sizeof (SBox));
28
SBoxClass * klass = malloc (sizeof (SBoxClass));
29
s_object_initialize (S_OBJECT (self), "SBox");
31
s_object_set_class (S_OBJECT (self), S_OBJECT_CLASS (klass));
32
s_object_set_free_method (S_OBJECT (self), FREE_METHOD (s_method_box_free));
37
SBox * s_box_new_pointer (spointer object);
39
SBox * s_box_new_sobject (SObject * object);
41
SBox * s_box_new_int (int i);
43
SBox * s_box_new_long (long l);
45
SBox * s_box_new_short (short s);
47
SBox * s_box_new_char (char c);
49
SBox * s_box_new_wchar (wchar_t wc);
51
SBox * s_box_new_uint (unsigned int ui);
53
SBox * s_box_new_ulong (long l);
55
SBox * s_box_new_ushort (short s);
57
SBox * s_box_new_string (char * s);
59
SBox * s_box_new_wstring (wchar_t * ws);
61
void s_box_free (SBox * self) {
62
s_object_free (S_OBJECT (self));
65
void s_box_set_free_data_on_free (SBox * self, sboolean free_data) {
69
void s_box_set_free_func (SBox * self, FreeFunc free_func) {
70
SBoxClass * klass = S_BOX_CLASS (s_object_get_class(S_OBJECT (self)));
71
klass->free_func = free_func;
74
void s_method_box_free (SBox * self) {
75
SBoxClass * klass = S_BOX_CLASS (s_object_get_class(S_OBJECT(self)));
77
SBoxPrivate * priv = self->priv;
79
FreeFunc free_func = klass->free_func;
81
if (priv->free_data) {
82
switch (priv->object_type) {
84
s_object_free (priv->m_sobject);
88
free_func (priv->m_ptr);
94
free (priv->m_string);
97
free (priv->m_wstring);
100
s_warn_print ("[SBox] free_data was set despite not being an object"
101
"that can be freed.");