/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-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:
23
23
#ifndef __H_MAP__
24
24
#define __H_MAP__
25
25
 
 
26
 
 
27
#include "baseobject.h"
 
28
#include "Func.h"
 
29
#include "defs.h"
 
30
#include "utils.h"
 
31
#include <stdbool.h>
 
32
 
 
33
BEGIN_DECLS
 
34
 
26
35
/**
 
36
 * @file
 
37
 * @defgroup SMap SMap
 
38
 * @addtogroup SMap
 
39
 * @{
27
40
 * An SMap is a data structure that holds many mappings of objects to objects:
28
41
 * say, a string to an other string. This can be likened to the Dict structure
29
42
 * in python, but not fully.
33
46
 *
34
47
 * please note that SMaps can be slow and are unordered.
35
48
 *
36
 
 * @file
 
49
 * TODO: Total rewrite.
37
50
 */
38
51
 
39
 
#include "baseobject.h"
40
 
#include "Func.h"
41
 
#include "defs.h"
42
 
#include "utils.h"
43
 
#include <stdbool.h>
44
 
 
45
 
BEGIN_DECLS
46
52
 
47
53
/** @brief
48
54
 * SMapItem holds the mapping of a key to a value.
49
55
 */
50
 
typedef struct _SMapItem SMapItem;
 
56
typedef struct SMapItem SMapItem;
51
57
 
52
58
/** @brief
53
59
 * An SMap is a map many SMapItems. Mapping between a key and a value.
54
60
 * 
55
61
 * functions:
56
 
 * * \c s_map_new \c ()
57
 
 * * \c s_map_free \c ()
58
 
 * * \c s_map_add \c ()
59
 
 * * \c s_map_get \c ()
 
62
 * * s_map_new()
 
63
 * * s_map_free()
 
64
 * * s_map_add()
 
65
 * * s_map_get()
60
66
 */
61
 
typedef struct _SMap SMap;
62
 
 
63
 
 
64
 
typedef struct _SMapClass SMapClass;
65
 
 
66
 
 
67
 
typedef struct _SMapPrivate SMapPrivate;
 
67
typedef struct SMap SMap;
 
68
 
 
69
 
 
70
typedef struct SMapClass SMapClass;
 
71
 
 
72
 
 
73
typedef struct SMapPrivate SMapPrivate;
68
74
 
69
75
/**
70
76
 * Data structure representing an SMapItem
71
77
 */
72
 
struct _SMapItem {
 
78
struct SMapItem {
73
79
  void * key; /**< The Key */
74
80
  void * value; /**< The Value */
75
81
};
77
83
/** @brief
78
84
 * Data structure representing an SMap
79
85
 */
80
 
struct _SMap {
81
 
  SMapClass * klass;
 
86
struct SMap {
 
87
  SObject parent;
82
88
  SMapPrivate * priv; /**< Private data pointer */
83
89
};
84
90
 
85
 
struct _SMapClass {
 
91
struct SMapClass {
 
92
  SObjectClass parent_class;
86
93
  CompFunc is_equal; /** method to check if items are equal. */
87
94
  FuncPointer free_key;
88
95
  FuncPointer free_value;
98
105
 *
99
106
 * @param key The key to be added to the item.
100
107
 * @param value The value to be added to the item.
101
 
 * @param free_key The function to be used to free the key.
102
 
 * @param free_value The function to be used to free the value.
103
108
 */
104
109
SMapItem * s_map_item_new (void * key, void * value);
105
110
 
176
181
 */
177
182
int s_map_unref (SMap * self);
178
183
 
 
184
/** @} */
 
185
 
179
186
END_DECLS
180
187
 
181
188
#endif