JUCE
|
Utility class to hold a list of TouchSurface::Touch objects with different indices and blockUIDs, where each touch has a mapping to some kind of user-supplied data value. More...
Classes | |
struct | TouchEntry |
Holds the current state of a touch, along with the user-data associated with it. More... | |
Public Member Functions | |
TouchList ()=default | |
Creates an empty touch list. More... | |
~TouchList ()=default | |
Destructor. More... | |
int | size () const noexcept |
Returns the number of entries in the touch list. More... | |
Type & | getValue (const TouchSurface::Touch &touch) |
Returns the user data object that corresponds to the given touch. More... | |
bool | contains (const TouchSurface::Touch &touch) const noexcept |
Returns true if a touch is already in the list. More... | |
void | updateTouch (const TouchSurface::Touch &touch) |
Updates the entry for the given touch, copying in the new state. More... | |
const TouchEntry * | find (const TouchSurface::Touch &touch) const noexcept |
If a touch is in the list, returns a pointer to the TouchEntry. More... | |
TouchEntry * | find (const TouchSurface::Touch &touch) noexcept |
TouchEntry * | begin () noexcept |
Allows iterator access to the list of touch entries. More... | |
const TouchEntry * | begin () const noexcept |
TouchEntry * | end () noexcept |
Allows iterator access to the list of touch entries. More... | |
const TouchEntry * | end () const noexcept |
TouchEntry & | operator[] (const int index) |
Retrieve a reference to particular item in the list of touch entries. More... | |
void | clear () noexcept |
Resets all contents, doest not generate any call-backs. More... | |
Utility class to hold a list of TouchSurface::Touch objects with different indices and blockUIDs, where each touch has a mapping to some kind of user-supplied data value.
The Type template is a user-defined type of object that will be stored for each touch element. The type must be default-constructable and copyable.
Returns the number of entries in the touch list.
Type& TouchList< Type >::getValue | ( | const TouchSurface::Touch & | touch | ) |
Returns the user data object that corresponds to the given touch.
This will also update the stored state of the TouchEntry::touch value for this touch index.
References TouchList< Type >::find().
|
noexcept |
Returns true if a touch is already in the list.
References TouchList< Type >::find().
Referenced by TouchList< Type >::updateTouch().
void TouchList< Type >::updateTouch | ( | const TouchSurface::Touch & | touch | ) |
Updates the entry for the given touch, copying in the new state.
If no entry with the same index and blockUID exists then a new entry is created. If given a touch which is a touch-end, this will remove any corresponding entries from the list.
References TouchList< Type >::contains(), TouchList< Type >::find(), TouchSurface::Touch::isTouchEnd, and jassert.
|
noexcept |
If a touch is in the list, returns a pointer to the TouchEntry.
Otherwise, returns nullptr.
References TouchList< Type >::TouchEntry::touch.
Referenced by TouchList< Type >::contains(), TouchList< Type >::find(), TouchList< Type >::getValue(), and TouchList< Type >::updateTouch().
|
noexcept |
References TouchList< Type >::find(), and TouchList< Type >::TouchEntry::touch.
|
noexcept |
Allows iterator access to the list of touch entries.
|
noexcept |
|
noexcept |
Allows iterator access to the list of touch entries.
|
noexcept |
TouchEntry& TouchList< Type >::operator[] | ( | const int | index | ) |
Retrieve a reference to particular item in the list of touch entries.
|
noexcept |
Resets all contents, doest not generate any call-backs.
References TouchSurface::Touch::blockUID, TouchSurface::Touch::index, and JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR.