17static const char*
_keys[] = {
"One" ,
"Two" ,
"Three" };
23static const char*
_values[] = {
"Value 1",
"Value 2",
"Value 3" };
61 iterator->
value = NULL;
71 bool retrievedItem =
false;
76 size_t numKeys =
sizeof(
_keys) /
sizeof(
_keys[0]);
101 bool retrievedKey =
false;
103 if (iterator != NULL)
106 size_t numKeys =
sizeof(
_keys) /
sizeof(
_keys[0]);
117 iterator->
key = NULL;
129 bool retrievedValue =
false;
131 if (iterator != NULL)
136 if (index < numValues)
141 retrievedValue =
true;
145 iterator->
value = NULL;
149 return retrievedValue;
static const char * _values[]
A list of values as example data. The number of values must match the number of keys in the _keys lis...
void Iterator_GetItems(ItemIterator *iterator)
Retrieve an iterator over the whole items in the internal data structure.
void Iterator_GetValues(ValueIterator *iterator)
Retrieve an iterator over the values in the internal data structure.
void Iterator_GetKeys(KeyIterator *iterator)
Retrieve an iterator over the keys in the internal data structure.
static const char * _keys[]
A list of keys as example data. The number of keys must match the number of values in the _values lis...
bool Iterator_NextValue(ValueIterator *iterator)
Retrieve the next value (const char*) from the iterator.
bool Iterator_NextKey(KeyIterator *iterator)
Retrieve the next key (const char*) from the iterator.
bool Iterator_NextItem(ItemIterator *iterator)
Retrieve the next whole item (ItemPair) from the iterator.
Declaration of the ItemPair structure, along with the iterator functions, Iterator_GetItems(),...
Represents an iterator that retrieves whole items.
ItemPair item
The key/value pair pointed to by this iterator. item.key and item.value are NULL if Iterator_NextItem...
size_t iterator
The (opaque) iterator value tracking progress through the data.
const char * value
The value part of the item.
const char * key
The key part of the item.
Represents an iterator that retrieves the key of each item.
size_t iterator
The (opaque) iterator value tracking progress through the data.
const char * key
The key pointed to by this iterator. key is NULL if Iterator_NextKey() has not yet been called or the...
Represents an iterator that retrieves the value of each item.
const char * value
The value pointed to by this iterator. value is NULL if Iterator_NextValue() has not yet been called ...
size_t iterator
The (opaque) iterator value tracking progress through the data.