JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator Struct Reference

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

#include "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.
 
Iteratoroperator++ () noexcept
 
ValueType operator* () const
 
bool operator!= (const Iterator &other) const noexcept
 
void resetToEnd () noexcept
 

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.

while (i.next())
{
DBG (i.getKey() << " -> " << i.getValue());
}
#define DBG(textToWrite)
Writes a string to the standard error stream.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
Iterates over the items in a HashMap.

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

Definition at line 399 of file juce_HashMap.h.

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)
noexcept

Definition at line 401 of file juce_HashMap.h.

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

Definition at line 405 of file juce_HashMap.h.

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

Returns the current item's key.

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

Definition at line 432 of file juce_HashMap.h.

◆ getValue()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
ValueType juce::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.

Definition at line 440 of file juce_HashMap.h.

◆ next()

template<typename KeyType , typename ValueType , class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection>
bool juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::next ( )
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.

Definition at line 413 of file juce_HashMap.h.

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

Definition at line 454 of file juce_HashMap.h.

◆ operator*()

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

Definition at line 453 of file juce_HashMap.h.

◆ operator++()

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

Definition at line 452 of file juce_HashMap.h.

◆ reset()

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

Resets the iterator to its starting position.

Definition at line 446 of file juce_HashMap.h.

◆ resetToEnd()

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

Definition at line 455 of file juce_HashMap.h.


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