JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator Struct Reference

Iterates over the items in a HashMap. More...

#include <juce_HashMap.h>

Collaboration diagram for juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator:

Public Member Functions

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

Private Member Functions

Iteratoroperator= (const Iterator &)=delete
 

Private Attributes

HashEntryentry
 
const HashMaphashMap
 
int index
 

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;
while (i.next())
{
DBG (i.getKey() << " -> " << i.getValue());
}

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

Constructor & Destructor Documentation

◆ 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)
inlinenoexcept

◆ 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)
inlinenoexcept

Member Function Documentation

◆ getKey()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
KeyType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getKey ( ) const
inline

◆ getValue()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
ValueType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::getValue ( ) const
inline

◆ next()

◆ 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
inlinenoexcept

◆ operator*()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
ValueType juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator* ( ) const
inline

◆ operator++()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
Iterator& juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator++ ( )
inlinenoexcept

◆ operator=()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
Iterator& juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::operator= ( const Iterator )
privatedelete

◆ reset()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
void juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::reset ( )
inlinenoexcept

◆ resetToEnd()

Member Data Documentation

◆ entry

◆ hashMap

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
const HashMap& juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::hashMap
private

◆ index


The documentation for this struct was generated from the following file:
DBG
#define DBG(textToWrite)
Writes a string to the standard error stream.
Definition: juce_PlatformDefs.h:145
juce::HashMap::Iterator
friend struct Iterator
Definition: juce_HashMap.h:478