Loading...
Searching...
No Matches
juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator Struct Reference

## Detailed Description

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
struct juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator

Iterates over the items in a HashMap.

To use it, repeatedly call next() until it returns false, e.g.

HashMap <String, String> myMap;
HashMap<String, String>::Iterator i (myMap);
while (i.next())
{
DBG (i.getKey() << " -> " << i.getValue());
}
juce::HashMap::HashMap
HashMap(int numberOfSlots=defaultHashTableSize, HashFunctionType hashFunction=HashFunctionType())
Creates an empty hash-map.
Definition juce_HashMap.h:133
DBG
#define DBG(textToWrite)
Writes a string to the standard error stream.
Definition juce_PlatformDefs.h:159
juce::HashMap::Iterator
Iterates over the items in a HashMap.
Definition juce_HashMap.h:412

The order in which items are iterated bears no resemblance 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.

See also
  HashMap

The documentation for this struct was generated from the following file:

- juce_core/containers/juce_HashMap.h

## Public Member Functions

| Iterator (const HashMap &hashMapToIterate) noexcept
| Iterator (const Iterator &other) noexcept
bool | next () noexcept
| Moves to the next item, if one is available.
KeyType | getKey () const
| Returns the current item's key.
ValueType | getValue () const
| Returns the current item's value.
void | reset () noexcept
| Resets the iterator to its starting position.
Iterator & | operator++ () noexcept
ValueType | operator* () const
bool | operator!= (const Iterator &other) const noexcept
void | resetToEnd () noexcept

## Constructors and Destructors

## Iterator() [1/2]

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::Iterator | ( | const HashMap & | hashMapToIterate | ) |

inline noexcept

References juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::HashMap().

Referenced by Iterator(), operator!=(), and operator++().

## Iterator() [2/2]

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::Iterator | ( | const Iterator & | other | ) |

inline noexcept

References Iterator().

## Member Functions

## next()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

bool juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::next | ( |  | ) |

inline noexcept

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.

Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::begin(), and operator++().

## getKey()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

KeyType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getKey | ( |  | ) | const

inline

Returns the current item's key.

This should only be called when a call to next() has just returned true.

## getValue()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

ValueType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getValue | ( |  | ) | const

inline

Returns the current item's value.

This should only be called when a call to next() has just returned true.

Referenced by operator*().

## reset()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

void juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::reset | ( |  | ) |

inline noexcept

Resets the iterator to its starting position.

## operator++()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

Iterator & juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator++ | ( |  | ) |

inline noexcept

References Iterator(), and next().

## operator*()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

ValueType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator* | ( |  | ) | const

inline

References getValue().

## operator!=()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

bool juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator!= | ( | const Iterator & | other | ) | const

inline noexcept

References Iterator().

## resetToEnd()

template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>

void juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::resetToEnd | ( |  | ) |

inline noexcept

Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::end().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited