Skip to content
This repository was archived by the owner on Sep 24, 2023. It is now read-only.

Commit cb6d8a3

Browse files
committed
Sync more_adt include to master
1 parent 2a9343e commit cb6d8a3

1 file changed

Lines changed: 53 additions & 8 deletions

File tree

scripting/include/more_adt.inc

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,77 @@
22
#endinput
33
#endif
44

5+
#define __more_adt_ext
6+
57
/**
68
* An iterator for the StringMultiMap.
79
* Call its Next() function before performing any retrievals to ensure that it is valid.
810
*/
911
methodmap StringMultiMapIterator < Handle {
12+
/**
13+
* Advances the iterator to the next key / value.
14+
* Returns false when the iterator has been exhausted.
15+
*/
1016
public native bool Next();
17+
18+
/**
19+
* Returns the key at the current position.
20+
*/
1121
public native void GetKey(char[] name, int maxlen);
1222

1323
/**
14-
* Returns the string at the current iterator position.
24+
* Retrieves the string at the current iterator position, storing it in the specified
25+
* buffer.
26+
* Returns false if the current position contains a cell value or array.
1527
*/
1628
public native bool GetString(char[] value, int max_size, int& size = 0);
29+
30+
/**
31+
* Assigns the given string to the current iterator position, replacing any value
32+
* previously set.
33+
*/
1734
public native void SetString(const char[] value);
1835

36+
/**
37+
* Retrieves the single cell value at the current iterator position, storing it in the
38+
* specified cell reference.
39+
* Returns false if the current position contains a string or a cell array.
40+
*/
1941
public native bool GetValue(any &value);
42+
43+
/**
44+
* Assigns the given cell value to the current iterator position, replacing any value
45+
* previously set.
46+
*/
2047
public native void SetValue(any value);
2148

49+
/**
50+
* Retrieves the cell array at the current iterator position, storing it in the specified
51+
* array.
52+
* Returns false if the current position contains a string or a cell array.
53+
*/
2254
public native bool GetArray(any[] array, int max_size, int& size = 0);
55+
56+
/**
57+
* Assigns the cell array to the current iterator position, replacing any value
58+
* previously set.
59+
*/
2360
public native void SetArray(const any[] array, int num_items);
2461

2562
/**
26-
* Marks the element at the current iterator position as removed.
27-
* The entry will be removed on the next invocation of Next().
63+
* Removes the entry at the current iterator position. The iterator is not advanced.
64+
* Attempts to call getters / setters on a removed entry will throw an error.
65+
* Subsequent calls to `Remove()` on the same entry will not throw any error.
2866
*/
2967
public native void Remove();
3068
}
3169

3270
/**
3371
* Creates a multimap. A multimap is a container that can map keys to arbitrary values.
3472
*
35-
* There can be multiple entries in a multimap for a given key; only the first inerted entry
36-
* will be accessible through the Get*() methods. To retrieve all the entries for a given key,
37-
* use the GetKeyIterator() method to get an iterator over the specified key.
73+
* There can be multiple entries in a multimap for a given key; however, only the first inserted
74+
* entry will be accessible through the Get*() methods. To retrieve all the entries for a given
75+
* key, use the GetKeyIterator() method to get an iterator over the specified key.
3876
*/
3977
methodmap StringMultiMap < Handle {
4078
public native StringMultiMap();
@@ -66,8 +104,16 @@ methodmap StringMultiMap < Handle {
66104
*/
67105
public native bool GetString(const char[] key, char[] value, int max_size, int& size = 0);
68106

107+
/**
108+
* Adds a new cell array with the specified key.
109+
*/
69110
public native void AddArray(const char[] key, const any[] array, int num_items);
70-
public native void GetArray(const char[] key, any[] array, int max_size, int& size = 0);
111+
112+
/**
113+
* Returns true iff the first entry associated with a key is a cell value, filling the
114+
* passed-in `value` buffer.
115+
*/
116+
public native bool GetArray(const char[] key, any[] array, int max_size, int& size = 0);
71117

72118
/**
73119
* Returns an interator over all keys. Will still return a valid StringMultiMapIterator
@@ -77,7 +123,6 @@ methodmap StringMultiMap < Handle {
77123

78124
/**
79125
* Returns an iterator for elements matching a specific key.
80-
* (Wrapper for std::multimap::equal_range.)
81126
*/
82127
public native StringMultiMapIterator GetKeyIterator(const char[] key);
83128
}

0 commit comments

Comments
 (0)