Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMap.h
Go to the documentation of this file.
1
10 #ifndef K_API_MAP_H
11 #define K_API_MAP_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17
144 //typedef kObject kMap; --forward-declared in kApiDef.x.h
145
146
151 typedef kPointer kMapItem;
152
164 kFx(kStatus) kMap_Construct(kMap* map, kType keyType, kType valueType, kSize initialCapacity, kAlloc allocator);
165
178 kFx(kStatus) kMap_Allocate(kMap map, kType keyType, kType valueType, kSize initialCapacity);
179
191 kFx(kStatus) kMap_Assign(kMap map, kMap source);
192
201 kFx(kStatus) kMap_SetEqualsFx(kMap map, kEqualsFx function);
202
215 kFx(kSize) kMap_SetHashFx(kMap map, kHashFx function);
216
224 kFx(kType) kMap_KeyType(kMap map);
225
233 kFx(kType) kMap_ValueType(kMap map);
234
242 kFx(kSize) kMap_Count(kMap map);
243
251 kFx(kSize) kMap_Capacity(kMap map);
252
262 kFx(kStatus) kMap_Find(kMap map, const void* key, void* value);
263
273 kFx(kStatus) kMap_Add(kMap map, const void* key, const void* value);
274
288 kFx(kStatus) kMap_Replace(kMap map, const void* key, const void* value);
289
304 kFx(kStatus) kMap_Remove(kMap map, const void* key, void* oldKey, void* oldValue);
305
314 kFx(kStatus) kMap_Reserve(kMap map, kSize capacity);
315
323 kFx(kStatus) kMap_Clear(kMap map);
324
332 kFx(kStatus) kMap_Purge(kMap map);
333
341 kFx(kMapItem) kMap_First(kMap map);
342
351 kFx(kMapItem) kMap_Next(kMap map, kMapItem item);
352
362 kFx(kStatus) kMap_FindItem(kMap map, const void* key, kMapItem* item);
363
372 kFx(kStatus) kMap_RemoveItem(kMap map, kMapItem item);
373
382 kFx(const void*) kMap_Key(kMap map, kMapItem item);
383
392 kFx(void*) kMap_Value(kMap map, kMapItem item);
393
403 kFx(kStatus) kMap_SetValue(kMap map, kMapItem item, const void* value);
404
407 #define kMap_KeyType_(MAP) kxMap_KeyType_(MAP)
408 #define kMap_ValueType_(MAP) kxMap_ValueType_(MAP)
409 #define kMap_Count_(MAP) kxMap_Count_(MAP)
410
411
412 #define kMap_KeyAs_(MAP, ITEM, TYPE) kxMap_KeyAs_(MAP, ITEM, TYPE)
413
415 #define kMap_ValueAs_(MAP, ITEM, TYPE) kxMap_ValueAs_(MAP, ITEM, TYPE)
416
419 kEndHeader()
420
421 #include <kApi/Data/kMap.x.h>
422
423 #endif
kMap::kMap_Purge
kStatus kMap_Purge(kMap map)
Disposes any elements in the map and sets the count of map items to zero.
kMap::kMap_Find
kStatus kMap_Find(kMap map, const void *key, void *value)
Finds the value associated with the given key.
kMap::kMap_Clear
kStatus kMap_Clear(kMap map)
Sets the count of map items to zero.
kMap::kMap_SetEqualsFx
kStatus kMap_SetEqualsFx(kMap map, kEqualsFx function)
Sets a custom key equality comparator.
kMap::kMap_First
kMapItem kMap_First(kMap map)
Gets a reference to the first map item (key-value pair).
kPointer
Represents a void pointer.
kMap::kMap_Count
kSize kMap_Count(kMap map)
Returns the count of map elements.
kMap::kMap_Allocate
kStatus kMap_Allocate(kMap map, kType keyType, kType valueType, kSize initialCapacity)
Reallocates the map.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kMap::kMap_Construct
kStatus kMap_Construct(kMap *map, kType keyType, kType valueType, kSize initialCapacity, kAlloc allocator)
Constructs a kMap object.
kMap::kMap_Reserve
kStatus kMap_Reserve(kMap map, kSize capacity)
Ensures that capacity is reserved for at least the specified number of map items. ...
kMap::kMap_SetHashFx
kSize kMap_SetHashFx(kMap map, kHashFx function)
Sets a custom hash code generator.
kMap::kMap_Key
const void * kMap_Key(kMap map, kMapItem item)
Returns a pointer to the key associated with a map item.
kMap::kMap_ValueType
kType kMap_ValueType(kMap map)
Returns the value type.
kHashFx
kSize(kCall * kHashFx)(const void *item)
Callback signature to determine hash code of an item.
Definition: kApiDef.h:1470
kMap::kMap_Capacity
kSize kMap_Capacity(kMap map)
Returns the number of elements for which space has been allocated.
kMap::kMap_Add
kStatus kMap_Add(kMap map, const void *key, const void *value)
Adds a new key-value pair.
kEqualsFx
kBool(kCall * kEqualsFx)(const void *item1, const void *item2)
Callback signature to determine equality of two items.
Definition: kApiDef.h:1462
kMap::kMap_FindItem
kStatus kMap_FindItem(kMap map, const void *key, kMapItem *item)
Finds the map item associated with the given key.
kMap::kMap_Assign
kStatus kMap_Assign(kMap map, kMap source)
Performs a shallow copy of the source map.
kApiDef.h
Core Zen type declarations.
kMap::kMap_KeyType
kType kMap_KeyType(kMap map)
Returns the key type.
kMap::kMap_Next
kMapItem kMap_Next(kMap map, kMapItem item)
Given a map item, gets a reference to the next map item.
kMap::kMap_RemoveItem
kStatus kMap_RemoveItem(kMap map, kMapItem item)
Removes an item from the map.
kMap::kMap_Replace
kStatus kMap_Replace(kMap map, const void *key, const void *value)
Adds or replaces a key-value pair.
kMap::kMap_Remove
kStatus kMap_Remove(kMap map, const void *key, void *oldKey, void *oldValue)
Removes a key-value pair from the map.
kMap::kMap_SetValue
kStatus kMap_SetValue(kMap map, kMapItem item, const void *value)
Sets the value associated with a map item.
kType
Represents metadata about a type (class, interface, or value).
kMap::kMap_Value
void * kMap_Value(kMap map, kMapItem item)
Returns a pointer to the value associated with a map item.
kStatus
Represents an error code.
kMap
Represents a collection of key-value pairs stored in a hash table.