Declaration of the ItemPair structure, along with the iterator functions, Iterator_GetItems(), Iterator_GetKeys(), Iterator_GetValues(), Iterator_NextItem(), Iterator_NextKey(), and Iterator_NextValue(), as used in the Iterator Pattern. More...
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Classes | |
struct | ItemPair |
Represents a key/value pair where the key and value are strings. More... | |
struct | ItemIterator |
Represents an iterator that retrieves whole items. More... | |
struct | KeyIterator |
Represents an iterator that retrieves the key of each item. More... | |
struct | ValueIterator |
Represents an iterator that retrieves the value of each item. More... | |
Macros | |
#define | __ITERATOR_ITERATORS_H__ |
Functions | |
void | Iterator_GetItems (ItemIterator *iterator) |
Retrieve an iterator over the whole items in the internal data structure. | |
void | Iterator_GetKeys (KeyIterator *iterator) |
Retrieve an iterator over the keys in the internal data structure. | |
void | Iterator_GetValues (ValueIterator *iterator) |
Retrieve an iterator over the values in the internal data structure. | |
bool | Iterator_NextItem (ItemIterator *iterator) |
Retrieve the next whole item (ItemPair) from the iterator. | |
bool | Iterator_NextKey (KeyIterator *iterator) |
Retrieve the next key (const char*) from the iterator. | |
bool | Iterator_NextValue (ValueIterator *iterator) |
Retrieve the next value (const char*) from the iterator. | |
Declaration of the ItemPair structure, along with the iterator functions, Iterator_GetItems(), Iterator_GetKeys(), Iterator_GetValues(), Iterator_NextItem(), Iterator_NextKey(), and Iterator_NextValue(), as used in the Iterator Pattern.
Definition in file Iterator_Iterators.h.
#define __ITERATOR_ITERATORS_H__ |
Definition at line 10 of file Iterator_Iterators.h.
void Iterator_GetItems | ( | ItemIterator * | iterator | ) |
Retrieve an iterator over the whole items in the internal data structure.
iterator | Pointer to an ItemIterator object to populate with the iterator. Call Iterator_NextItem() to start using the iterator. |
Definition at line 32 of file Iterator_Iterators.c.
References ItemIterator::item, ItemIterator::iterator, ItemPair::key, and ItemPair::value.
Referenced by Iterator_Exercise().
void Iterator_GetKeys | ( | KeyIterator * | iterator | ) |
Retrieve an iterator over the keys in the internal data structure.
iterator | Pointer to an KeyIterator object to populate with the iterator. Call Iterator_NextKey() to start using the iterator. |
Definition at line 45 of file Iterator_Iterators.c.
References KeyIterator::iterator, and KeyIterator::key.
Referenced by Iterator_Exercise().
void Iterator_GetValues | ( | ValueIterator * | iterator | ) |
Retrieve an iterator over the values in the internal data structure.
iterator | Pointer to an ValueIterator object to populate with the iterator. Call Iterator_NextValue() to start using the iterator. |
Definition at line 57 of file Iterator_Iterators.c.
References ValueIterator::iterator, and ValueIterator::value.
Referenced by Iterator_Exercise().
bool Iterator_NextItem | ( | ItemIterator * | iterator | ) |
Retrieve the next whole item (ItemPair) from the iterator.
iterator | The KeyIterator used to get the next item. |
Definition at line 69 of file Iterator_Iterators.c.
References _keys, _values, ItemIterator::item, ItemIterator::iterator, ItemPair::key, and ItemPair::value.
Referenced by Iterator_Exercise().
bool Iterator_NextKey | ( | KeyIterator * | iterator | ) |
Retrieve the next key (const char*) from the iterator.
iterator | The ItemIterator used to get the next key. |
Definition at line 99 of file Iterator_Iterators.c.
References _keys, KeyIterator::iterator, and KeyIterator::key.
Referenced by Iterator_Exercise().
bool Iterator_NextValue | ( | ValueIterator * | iterator | ) |
Retrieve the next value (const char*) from the iterator.
iterator | The ValueIterator used to get the next value. |
Definition at line 127 of file Iterator_Iterators.c.
References _values, ValueIterator::iterator, and ValueIterator::value.
Referenced by Iterator_Exercise().