/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/Box.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-06-04 17:36:18 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150604173618-qobcg09u33eyrpfd
* started work SBox (Untested).
* Fixed compilation errors.
* added more macros and made use of them.
* Added more documentation.
* Made s_object_get_class return a SObjectClass pointer instead.
* Reorderd S_TYPE_* enum.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
struct SBoxClass {
32
32
  SObjectClass parent_class;
 
33
  FreeFunc free_func;
33
34
};
34
35
 
 
36
#define S_BOX(o) (SBox *)(o);
 
37
#define S_BOX_CLASS(k) (SBoxClass *)(k);
 
38
 
35
39
/**
36
40
 * Creates a new SBox object.
37
41
 * 
38
42
 * @param object The object to be boxed.
39
 
 * @param type The type of object that is being boxed.
40
43
 * @param freefunc The Function to be used when freeing the boxed object.
41
44
 *
42
45
 * @return A new SBox object.
43
 
 *
44
 
 * @note if freefunc is NULL, then standard free() will be used.
45
46
 */
46
 
SBox * s_box_new (spointer object, SType type, FreeFunc freefunc);
 
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);
47
70
 
48
71
/**
49
72
 * Free the an SBox.
50
73
 *
51
74
 * @param box The SBox to be freed.
52
 
 *
53
 
 * @warning Freeing an SBox will free the object that is held by it.
54
75
 */
55
76
void s_box_free (SBox * box);
56
77
 
66
87
/**
67
88
 * Gets the SType of the object that is stored in the SBox.
68
89
 */
69
 
SType s_box_get_object_type (SBox * box);
 
90
SType s_box_get_type (SBox * box);
70
91
 
71
92
/**
72
93
 * Gets the type name of the object.
76
97
 * 
77
98
 * @note caller must free the string.
78
99
 */
79
 
char * s_box_get_object_type_name (SBox * box);
 
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
 
80
109
 
81
110
/** @} */
82
111