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

  • Committer: Gustav Hartvigsson
  • Date: 2015-07-12 19:04:18 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150712190418-yi9rfito5ovnf6dy
* Made the code more easy to read.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
/**
78
78
 * Data structure representing an SMapItem
79
79
 */
80
 
struct SMapItem {
 
80
struct
 
81
SMapItem {
81
82
  void * key; /**< The Key */
82
83
  void * value; /**< The Value */
83
84
};
85
86
/** @brief
86
87
 * Data structure representing an SMap
87
88
 */
88
 
struct SMap {
 
89
struct
 
90
SMap {
89
91
  SMapClass * klass;
90
92
  SMapPrivate * priv; /**< Private data pointer */
91
93
};
92
94
 
93
 
struct SMapClass {
 
95
struct
 
96
SMapClass {
94
97
  CompFunc is_equal; /** method to check if items are equal. */
95
98
  HashFunc key_hash_func;
96
99
  FuncPointer free_key;
108
111
 * @param key The key to be added to the item.
109
112
 * @param value The value to be added to the item.
110
113
 */
111
 
SMapItem * s_map_item_new (void * key, void * value);
 
114
SMapItem *
 
115
s_map_item_new (void * key, void * value);
112
116
 
113
117
/** @breif
114
118
 * Frees a SMapItem.
117
121
 * @param free_key The function to be used to free the key.
118
122
 * @param free_value The function to be used to free the value.
119
123
 */
120
 
void s_map_item_free (SMapItem * self, FuncPointer free_key,
 
124
void
 
125
s_map_item_free (SMapItem * self, FuncPointer free_key,
121
126
                                       FuncPointer free_value);
122
127
 
123
128
/* -------------------------------
138
143
 * Check if free_key and/or free_value is null and set them to something
139
144
 * appropriate.
140
145
 */
141
 
SMap * s_map_new (CompFunc comp_func,
 
146
SMap *
 
147
s_map_new (CompFunc comp_func,
142
148
                  HashFunc key_hash_func,
143
149
                  FuncPointer free_key,
144
150
                  FuncPointer free_value);
148
154
 * 
149
155
 * @param self the object to free.
150
156
 */
151
 
void s_map_free (SMap * self);
 
157
void
 
158
s_map_free (SMap * self);
152
159
 
153
160
/** @breif
154
161
 * This function adds a key/value pair to an SMap.
159
166
 * @todo
160
167
 *  make it return false on failure, or some other nastiness.
161
168
 */
162
 
void s_map_add (SMap * self, spointer key, spointer value);
 
169
void
 
170
s_map_add (SMap * self, spointer key, spointer value);
163
171
 
164
172
/** @breif
165
173
 * Get a value using using a key.
168
176
 * @param key the key that you use to retrieve the value from the SMap from
169
177
 *            with.
170
178
 */
171
 
spointer s_map_get (SMap * self, spointer key);
 
179
spointer
 
180
s_map_get (SMap * self, spointer key);
172
181
 
173
182
/**
174
183
 * @todo
175
184
 */
176
 
void  s_map_remove (SMap * self, spointer key);
177
 
 
178
 
/**
179
 
 *
180
 
 */
181
 
int s_map_ref (SMap * self);
182
 
 
183
 
/**
184
 
 *
185
 
 */
186
 
int s_map_unref (SMap * self);
 
185
void
 
186
s_map_remove (SMap * self, spointer key);
 
187
 
 
188
/**
 
189
 *
 
190
 */
 
191
int
 
192
s_map_ref (SMap * self);
 
193
 
 
194
/**
 
195
 *
 
196
 */
 
197
int
 
198
s_map_unref (SMap * self);
187
199
 
188
200
/** @} */
189
201