JUCE
|
Iterates over the items in a HashMap. More...
Public Member Functions | |
Iterator (const HashMap &hashMapToIterate) | |
bool | next () |
Moves to the next item, if one is available. More... | |
KeyType | getKey () const |
Returns the current item's key. More... | |
ValueType | getValue () const |
Returns the current item's value. More... | |
void | reset () noexcept |
Resets the iterator to its starting position. More... | |
Iterates over the items in a HashMap.
To use it, repeatedly call next() until it returns false, e.g.
The order in which items are iterated bears no resemblence to the order in which they were originally added!
Obviously as soon as you call any non-const methods on the original hash-map, any iterators that were created beforehand will cease to be valid, and should not be used.
HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::Iterator | ( | const HashMap & | hashMapToIterate | ) |
bool HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::next | ( | ) |
Moves to the next item, if one is available.
When this returns true, you can get the item's key and value using getKey() and getValue(). If it returns false, the iteration has finished and you should stop.
KeyType HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getKey | ( | ) | const |
Returns the current item's key.
This should only be called when a call to next() has just returned true.
ValueType HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getValue | ( | ) | const |
Returns the current item's value.
This should only be called when a call to next() has just returned true.
|
noexcept |
Resets the iterator to its starting position.
References JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR.