regify utility 2.1.0-0
 
Loading...
Searching...
No Matches
map.h
1/*
2 * Copyright regify
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22#ifndef REGIFY_UTIL_MAP_H
23#define REGIFY_UTIL_MAP_H
24
33typedef void* ruMap;
34
41RUAPI ruMap ruMapNew(ruType keyType, ruType valueType);
42
49
63RUAPI int32_t ruMapPutData(ruMap rm, ptr key, ptr val, ptr* exisitingVal);
64
75#define ruMapPut(map, key, val) ruMapPutData(map, (ptr)(key), (ptr)(val), NULL)
76
88#define ruMapTryPut(map, key, val, existing) ruMapPutData(map, (ptr)(key), (ptr)(val), (ptr*)(existing))
89
99RUAPI int32_t ruMapRemoveData(ruMap rm, trans_ptr key, ptr* val);
100
110#define ruMapRemove(rm, key, val) ruMapRemoveData(rm, (trans_ptr)(key), (ptr*)(val))
111
118RUAPI int32_t ruMapRemoveAll(ruMap rm);
119
129RUAPI int32_t ruMapGetValue(ruMap rm, trans_ptr key, ptr* val);
130
134#define ruMapGet(rm, key, val) ruMapGetValue(rm, (trans_ptr)(key), (ptr*)(val))
135
145RUAPI bool ruMapHasKey(ruMap rm, trans_ptr key, int32_t *code);
146
156#define ruMapHas(rm, key, code) ruMapHasKey(rm, (trans_ptr)(key), code)
157
171RUAPI int32_t ruMapFirstSet(ruMap rm, ptr* key, ptr* value);
172
194#define ruMapFirst(rm, key, value) ruMapFirstSet(rm, (ptr*)(key), (ptr*)(value))
195
210RUAPI int32_t ruMapNextSet(ruMap rm, ptr* key, ptr* value);
211
215#define ruMapNext(rm, key, value) ruMapNextSet(rm, (ptr*)(key), (ptr*)(value))
216
226RUAPI int32_t ruMapKeyList(ruMap rm, ruList* keys);
227
234RUAPI uint32_t ruMapSize(ruMap rm, int32_t *code);
247typedef void* ruSet;
248
254RUAPI ruSet ruSetNew(ruType keyType);
255
262
271RUAPI int32_t ruSetPutItem(ruSet rs, ptr item);
272
280#define ruSetPut(rs, item) ruSetPutItem(rs, (ptr)(item))
281
290RUAPI int32_t ruSetRemoveItem(ruMap rs, ptr item);
291
300#define ruSetRemove(rs, item) ruSetRemoveItem(rs, (ptr)(item))
301
311RUAPI bool ruSetHasItem(ruSet rs, trans_ptr item, int32_t *code);
312
322#define ruSetHas(rs, item, code) ruSetHasItem(rs, (trans_ptr)(item), code)
323
335RUAPI int32_t ruSetFirstSet(ruSet rs, ptr* item);
336
356#define ruSetFirst(rs, item) ruSetFirstSet(rs, (ptr*)(item))
357
370RUAPI int32_t ruSetNextSet(ruSet rs, ptr* item);
371
375#define ruSetNext(rs, item) ruSetNextSet(rs, (ptr*)(item))
376
386RUAPI int32_t ruSetItemList(ruSet rs, ruList* items);
387
395RUAPI int32_t ruSetRemoveAll(ruSet rs);
396
403RUAPI uint32_t ruSetSize(ruSet rs, int32_t *code);
408#ifdef __cplusplus
409}
410#endif /* __cplusplus */
411#endif //REGIFY_UTIL_MAP_H
RUAPI int32_t ruMapPutData(ruMap rm, ptr key, ptr val, ptr *exisitingVal)
Insert a key/val pair into the map.
RUAPI int32_t ruMapNextSet(ruMap rm, ptr *key, ptr *value)
Retrieves the next key/value pair from the map.
RUAPI int32_t ruMapFirstSet(ruMap rm, ptr *key, ptr *value)
Initializes a map iterator and populates given parameters with the first key pair to serve as a for l...
RUAPI ruMap ruMapNew(ruType keyType, ruType valueType)
Creates a new ruMap based on the given specifications.
RUAPI ruMap ruMapFree(ruMap rm)
Frees the given map and its members.
RUAPI uint32_t ruMapSize(ruMap rm, int32_t *code)
Returns the size of the map.
RUAPI int32_t ruMapKeyList(ruMap rm, ruList *keys)
Return a key list of the given map.
RUAPI int32_t ruMapRemoveData(ruMap rm, trans_ptr key, ptr *val)
Removes an entry from the map.
RUAPI int32_t ruMapGetValue(ruMap rm, trans_ptr key, ptr *val)
Retrieves an pointer entry from the map.
RUAPI int32_t ruMapRemoveAll(ruMap rm)
Removes all entries from the map.
void * ruMap
An opaque type representing a map object.
Definition map.h:33
RUAPI bool ruMapHasKey(ruMap rm, trans_ptr key, int32_t *code)
Tests whether map has an entry for given key.
RUAPI uint32_t ruSetSize(ruSet rs, int32_t *code)
Returns the size of the set.
RUAPI bool ruSetHasItem(ruSet rs, trans_ptr item, int32_t *code)
Tests whether set contains given item.
RUAPI int32_t ruSetRemoveAll(ruSet rs)
Removes all items from the set.
RUAPI int32_t ruSetNextSet(ruSet rs, ptr *item)
Retrieves the next item from the set.
RUAPI int32_t ruSetItemList(ruSet rs, ruList *items)
Return an item list of the given set.
RUAPI ruSet ruSetFree(ruSet rs)
Frees the given set and its members.
RUAPI int32_t ruSetPutItem(ruSet rs, ptr item)
Insert an item into the set.
RUAPI ruSet ruSetNew(ruType keyType)
Creates a new ruSet based on the given specifications.
void * ruSet
An opaque type representing a set object.
Definition map.h:247
RUAPI int32_t ruSetFirstSet(ruSet rs, ptr *item)
Initializes a set iterator and populates given parameter with the first item to serve as a for loop i...
RUAPI int32_t ruSetRemoveItem(ruMap rs, ptr item)
Removes an entry from the map.
void * ruList
Opaque pointer to list object. See List Collection.
Definition list.h:103
const void * trans_ptr
A transient pointer.
Definition regify-util.h:287
void * ptr
A generic pointer.
Definition regify-util.h:304
void * ruType
An opaque type representing a type specification.
Definition regify-util.h:344