Holds a set of primitive values, storing them as a set of ranges. More...
#include <juce_SparseSet.h>


Public Member Functions | |
| SparseSet ()=default | |
| SparseSet (const SparseSet &)=default | |
| SparseSet (SparseSet &&other) noexcept | |
| void | addRange (Range< Type > range) |
| Adds a range of contiguous values to the set. | |
| void | clear () |
| Clears the set. | |
| bool | contains (Type valueToLookFor) const noexcept |
| Checks whether a particular value is in the set. | |
| bool | containsRange (Range< Type > range) const noexcept |
| Checks whether the whole of a given range is contained within this one. | |
| int | getNumRanges () const noexcept |
| Returns the number of contiguous blocks of values. | |
| Range< Type > | getRange (int rangeIndex) const noexcept |
| Returns one of the contiguous ranges of values stored. | |
| const Array< Range< Type > > & | getRanges () const noexcept |
| Returns the set as a list of ranges, which you may want to iterate over. | |
| Range< Type > | getTotalRange () const noexcept |
| Returns the range between the lowest and highest values in the set. | |
| void | invertRange (Range< Type > range) |
| Does an XOR of the values in a given range. | |
| bool | isEmpty () const noexcept |
| Checks whether the set is empty. | |
| bool | operator!= (const SparseSet &other) const noexcept |
| SparseSet & | operator= (const SparseSet &)=default |
| SparseSet & | operator= (SparseSet &&other) noexcept |
| bool | operator== (const SparseSet &other) const noexcept |
| Type | operator[] (Type index) const noexcept |
| Returns one of the values in the set. | |
| bool | overlapsRange (Range< Type > range) const noexcept |
| Checks whether any part of a given range overlaps any part of this set. | |
| void | removeRange (Range< Type > rangeToRemove) |
| Removes a range of values from the set. | |
| Type | size () const noexcept |
| Returns the number of values in the set. | |
Private Member Functions | |
| void | simplify () |
Private Attributes | |
| Array< Range< Type > > | ranges |
Holds a set of primitive values, storing them as a set of ranges.
This container acts like an array, but can efficiently hold large contiguous ranges of values. It's quite a specialised class, mostly useful for things like keeping the set of selected rows in a listbox.
The type used as a template parameter must be an integer type, such as int, short, int64, etc.
@tags{Core}
|
default |
|
default |
|
inlinenoexcept |
|
inline |
Adds a range of contiguous values to the set.
e.g. addRange (Range <int> (10, 14)) will add (10, 11, 12, 13) to the set.
References juce::SparseSet< Type >::ranges, juce::SparseSet< Type >::removeRange(), and juce::SparseSet< Type >::simplify().
Referenced by juce::SparseSet< Type >::invertRange().
|
inline |
Clears the set.
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Checks whether a particular value is in the set.
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Checks whether the whole of a given range is contained within this one.
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Returns the number of contiguous blocks of values.
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Returns one of the contiguous ranges of values stored.
| rangeIndex | the index of the range to look up, between 0 and (getNumRanges() - 1) |
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Returns the set as a list of ranges, which you may want to iterate over.
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Returns the range between the lowest and highest values in the set.
References juce::Range< ValueType >::getStart(), and juce::SparseSet< Type >::ranges.
Referenced by juce::SparseSet< Type >::removeRange().
|
inline |
Does an XOR of the values in a given range.
References juce::SparseSet< Type >::addRange(), juce::SparseSet< Type >::ranges, and juce::SparseSet< Type >::removeRange().
|
inlinenoexcept |
Checks whether the set is empty.
This is much quicker than using (size() == 0).
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
References juce::SparseSet< Type >::ranges.
|
default |
|
inlinenoexcept |
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
References juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Returns one of the values in the set.
| index | the index of the value to retrieve, in the range 0 to (size() - 1). |
References juce::end(), and juce::SparseSet< Type >::ranges.
|
inlinenoexcept |
Checks whether any part of a given range overlaps any part of this set.
References juce::SparseSet< Type >::ranges.
|
inline |
Removes a range of values from the set.
e.g. removeRange (Range<int> (10, 14)) will remove (10, 11, 12, 13) from the set.
References juce::Range< ValueType >::contains(), juce::Range< ValueType >::getEnd(), juce::Range< ValueType >::getStart(), juce::SparseSet< Type >::getTotalRange(), juce::Range< ValueType >::isEmpty(), jassert, and juce::SparseSet< Type >::ranges.
Referenced by juce::SparseSet< Type >::addRange(), and juce::SparseSet< Type >::invertRange().
|
inlineprivate |
References juce::SparseSet< Type >::ranges.
Referenced by juce::SparseSet< Type >::addRange().
|
inlinenoexcept |
Returns the number of values in the set.
Because of the way the data is stored, this method can take longer if there are a lot of items in the set. Use isEmpty() for a quick test of whether there are any items.
References juce::SparseSet< Type >::ranges.
|
private |
Referenced by juce::SparseSet< Type >::addRange(), juce::SparseSet< Type >::clear(), juce::SparseSet< Type >::contains(), juce::SparseSet< Type >::containsRange(), juce::SparseSet< Type >::getNumRanges(), juce::SparseSet< Type >::getRange(), juce::SparseSet< Type >::getRanges(), juce::SparseSet< Type >::getTotalRange(), juce::SparseSet< Type >::invertRange(), juce::SparseSet< Type >::isEmpty(), juce::SparseSet< Type >::operator!=(), juce::SparseSet< Type >::operator=(), juce::SparseSet< Type >::operator==(), juce::SparseSet< Type >::operator[](), juce::SparseSet< Type >::overlapsRange(), juce::SparseSet< Type >::removeRange(), juce::SparseSet< Type >::simplify(), and juce::SparseSet< Type >::size().