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

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-07 08:35:51 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150407083551-eigkistus394ds7e
* Made the code compile using CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#define __H_DYNAMIC_ARRAY__
25
25
#include <stdlib.h>
26
26
#include "defs.h"
 
27
#include "Func.h"
27
28
 
28
29
BEGIN_DECLS
29
30
 
59
60
 *       <tt>free()</tt>.
60
61
 *        
61
62
 *        Normally a function with the signature <tt> (DynamicArray * self,
62
 
          _pointer item, _pointer data) </tt> should be used but cast to FreeFunc.
 
63
          spointer item, spointer data) </tt> should be used but cast to FreeFunc.
63
64
 */
64
65
DynamicArray * dynamic_array_new (size_t len, FreeFunc free_func);
65
66
 
74
75
/**
75
76
 * Get an item from the array.
76
77
 */
77
 
_pointer dynamic_array_get (DynamicArray * self, size_t index);
 
78
spointer dynamic_array_get (DynamicArray * self, size_t index);
78
79
 
79
80
/**
80
81
 * Get the length of the array.
95
96
/**
96
97
 * Add an item to the array.
97
98
 */
98
 
void dynamic_array_add (DynamicArray * self, _pointer item);
 
99
void dynamic_array_add (DynamicArray * self, spointer item);
99
100
 
100
101
/**
101
102
 * Dumps a copy of the array. Must be cast.
104
105
 * 
105
106
 * Is null-terminated.
106
107
 */
107
 
_pointer* dynamic_array_dump_array (DynamicArray * self);
 
108
spointer* dynamic_array_dump_array (DynamicArray * self);
108
109
 
109
110
/**
110
111
 * Use a function on the array.
111
112
 */
112
113
void dynamic_array_for_each (DynamicArray * self, ForEachFunc func,
113
 
                             _pointer data);
 
114
                             spointer data);
114
115
 
115
116
/** TODO
116
117
 * same as dynamic_array_for_each (), with the difference that it returns a new
118
119
 */
119
120
DynamicArray * dynamic_array_for_each_with_return (DynamicArray * self,
120
121
                                                   ForEachFunc func,
121
 
                                                   _pointer data);
 
122
                                                   spointer data);
122
123
 
123
124
END_DECLS
124
125