-
Notifications
You must be signed in to change notification settings - Fork 2
/
structlist.qc
32 lines (29 loc) · 1.47 KB
/
structlist.qc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// the "structlist" is a tightly packed array of structure data. Every item
// must have the same size, and the structure uses pointers to communicate
// data back and forth. As a result, this is efficient for larger structures, but
// not for smaller ones. For structures that are 12 bytes or less, you can use
// the regular list type, which will be more efficient/safer. Note that since
// this structure deals with pointers, growing the list will effectively invalidate any
// pointers that were previously returned from the list. Storing these pointers
// is only safe if the list's size remains at or below its maximum reserve size.
accessor structlist : int;
structlist(int item_size, optional int reserve) structlist_alloc = #0;
void(structlist, variant*, int index) structlist_insert = #0;
void(structlist, variant*) structlist_push = #0;
void(structlist, variant*) structlist_unshift = #0;
void(structlist, int, optional variant*) structlist_delete = #0;
void(structlist, optional variant*) structlist_pop = #0;
void(structlist, optional variant*) structlist_shift = #0;
static int(structlist) structlist_get_length = #0;
void(structlist) structlist_clear = #0;
static variant*(structlist, int index) structlist_at = #0
static void(structlist, int index, variant *) structlist_value_at = #0
void(structlist, int) structlist_resize = #0;
accessor structlist : int
{
get int length = structlist_get_length;
inline get variant*[int index] =
{
return structlist_at(this, index);
};
};