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

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-09 18:45:12 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150409184512-fn8m3f26mzsqdy4n
* Started to structuce the dectumentation a little better.
* Added Callback.[c,h] which will contain the methods to add callbacks to SObjects.
  This is still a work it pregross.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
THE SOFTWARE.
21
21
*/
22
22
 
23
 
/** @file */
24
 
 
25
 
 
26
 
 
27
 
 
28
23
#ifndef __H_BASE_OBJECT__
29
24
#define __H_BASE_OBJECT__
30
25
 
31
26
 
 
27
#include "Func.h"
 
28
 
 
29
BEGIN_DECLS;
 
30
 
32
31
/** @file
 
32
 * @defgroup SObject SObject
 
33
 * @addtogroup SObject SObject
 
34
 * @{
33
35
 * An SObject represents the base of the Super Simple Type System.
34
36
 * 
35
37
 * Almost all other data structures in this library are children to this object
45
47
 * ---------------------------------------------------
46
48
 */
47
49
 
48
 
#include "Func.h"
49
 
 
50
 
BEGIN_DECLS
51
 
 
52
 
typedef struct _SObjectClass SObjectClass;
53
 
 
54
 
typedef struct _SObject SObject;
 
50
/**
 
51
 * The class holds all the "virtual" functions, also knows  as methods
 
52
 * that are to be used with the object.
 
53
 * 
 
54
 */
 
55
typedef struct SObjectClass SObjectClass;
 
56
 
 
57
/**
 
58
 * The instance holds the data that is associated with the object.
 
59
 * it also holds a pointer to the class of the object.
 
60
 * 
 
61
 */
 
62
typedef struct SObject SObject;
 
63
 
 
64
 
55
65
 
56
66
 
57
67
/**
76
86
 
77
87
 
78
88
#define S_OBJECT(k) (SObject *)k
 
89
#define S_OBJECT_CLASS(k) (SObjectClass *)k
79
90
 
80
 
/**
81
 
 * The class holds all the "virtual" functions, also knows  as methods
82
 
 * that are to be used with the object.
83
 
 * 
84
 
 */
85
 
struct _SObjectClass {
 
91
struct SObjectClass {
86
92
  MethodFunc initialize;
87
93
  MethodFunc deinitialize;
88
94
  FreeMethod free;
92
98
  ToStringFunc to_string;
93
99
};
94
100
 
95
 
/**
96
 
 * The instance holds the data that is associated with the object.
97
 
 * it also holds a pointer to the class of the object.
98
 
 * 
99
 
 */
100
 
struct _SObject {
 
101
 
 
102
struct SObject {
101
103
  char * name;
102
104
  SObjectClass * base_class;
103
105
  unsigned int refcount;
125
127
/**
126
128
 * This function is used to set the ref method.
127
129
 * 
128
 
 * DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
 
130
 * @warning DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
129
131
 */
130
132
void s_object_set_ref_method (SObject * self, MethodFuncInt method);
131
133
 
132
134
/**
133
135
 * This function is used to set the unref method.
134
136
 * 
135
 
 * DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
 
137
 * @warning DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
136
138
 */
137
139
void s_object_set_unref_method (SObject * self, MethodFuncInt method);
138
140
 
139
141
/**!
140
142
 * This function is used to set the get_refcount method.
141
143
 * 
142
 
 * DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
 
144
 * @warning DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
143
145
 */
144
146
void s_object_set_get_refcount_method (SObject * self,  MethodFuncInt method);
145
147
 
220
222
 
221
223
/**
222
224
 * This function returns a textual (string) that represents the object.
223
 
 * The method can be set using s_object_set_to_string_method.
 
225
 * The method can be set using s_object_set_to_string_method().
224
226
 *
225
227
 * Note: The string that is returned must be freed.
226
228
 */
227
229
char * s_object_to_string (SObject * self);
228
230
 
 
231
/**
 
232
 * @}
 
233
 */
 
234
 
229
235
END_DECLS
230
236
 
231
237
#endif