Blender V5.0
IndexRange Class Reference

#include <BLI_index_range.hh>

Classes

class  Iterator

Public Member Functions

constexpr IndexRange ()=default
constexpr IndexRange (int64_t size)
constexpr IndexRange (const int64_t start, const int64_t size)
constexpr Iterator begin () const
constexpr Iterator end () const
constexpr int64_t operator[] (int64_t index) const
constexpr int64_t size () const
constexpr IndexRange index_range () const
constexpr bool is_empty () const
constexpr IndexRange with_new_end (const int64_t new_end) const
constexpr IndexRange after (int64_t n) const
constexpr IndexRange before (int64_t n) const
constexpr int64_t first () const
constexpr int64_t last (const int64_t n=0) const
constexpr int64_t one_before_start () const
constexpr int64_t one_after_last () const
constexpr int64_t start () const
constexpr bool contains (int64_t value) const
constexpr bool contains (const IndexRange range) const
constexpr IndexRange slice (int64_t start, int64_t size) const
constexpr IndexRange slice (IndexRange range) const
constexpr IndexRange intersect (IndexRange other) const
constexpr IndexRange drop_front (int64_t n) const
constexpr IndexRange drop_back (int64_t n) const
constexpr IndexRange take_front (int64_t n) const
constexpr IndexRange take_back (int64_t n) const
constexpr IndexRange shift (int64_t n) const

Static Public Member Functions

static constexpr IndexRange from_begin_size (const int64_t begin, const int64_t size)
static constexpr IndexRange from_begin_end (const int64_t begin, const int64_t end)
static constexpr IndexRange from_begin_end_inclusive (const int64_t begin, const int64_t last)
static constexpr IndexRange from_end_size (const int64_t end, const int64_t size)
static constexpr IndexRange from_single (const int64_t index)

Friends

constexpr friend bool operator== (IndexRange a, IndexRange b)
constexpr friend bool operator!= (IndexRange a, IndexRange b)
std::ostream & operator<< (std::ostream &stream, IndexRange range)

Detailed Description

Definition at line 50 of file BLI_index_range.hh.

Constructor & Destructor Documentation

◆ IndexRange() [1/3]

blender::IndexRange::IndexRange ( )
constexprdefault

◆ IndexRange() [2/3]

blender::IndexRange::IndexRange ( int64_t size)
inlineexplicitconstexpr

Definition at line 58 of file BLI_index_range.hh.

◆ IndexRange() [3/3]

blender::IndexRange::IndexRange ( const int64_t start,
const int64_t size )
inlineconstexpr

Definition at line 63 of file BLI_index_range.hh.

Member Function Documentation

◆ after()

IndexRange blender::IndexRange::after ( int64_t n) const
inlineconstexpr

Create a new range starting at the end of the current one.

Definition at line 181 of file BLI_index_range.hh.

◆ before()

IndexRange blender::IndexRange::before ( int64_t n) const
inlineconstexpr

Create a new range that ends at the start of the current one.

Definition at line 190 of file BLI_index_range.hh.

◆ begin()

Iterator blender::IndexRange::begin ( ) const
inlineconstexpr

Definition at line 117 of file BLI_index_range.hh.

Referenced by BKE_pbvh_sync_visibility_from_verts().

◆ contains() [1/2]

bool blender::IndexRange::contains ( const IndexRange range) const
inlineconstexpr

Returns true when all indices in the given range are also in the current range.

Definition at line 255 of file BLI_index_range.hh.

◆ contains() [2/2]

bool blender::IndexRange::contains ( int64_t value) const
inlineconstexpr

Returns true when the range contains a certain number, otherwise false.

Definition at line 247 of file BLI_index_range.hh.

◆ drop_back()

Returns a new IndexRange with n elements removed from the end of the range. This invokes undefined behavior when n is negative.

Definition at line 313 of file BLI_index_range.hh.

◆ drop_front()

Returns a new IndexRange with n elements removed from the beginning of the range. This invokes undefined behavior when n is negative.

Definition at line 302 of file BLI_index_range.hh.

Referenced by draw_fcurve_curve_keys().

◆ end()

Iterator blender::IndexRange::end ( ) const
inlineconstexpr

Definition at line 122 of file BLI_index_range.hh.

Referenced by BKE_pbvh_sync_visibility_from_verts().

◆ first()

◆ from_begin_end()

constexpr IndexRange blender::IndexRange::from_begin_end ( const int64_t begin,
const int64_t end )
inlinestaticconstexpr

Definition at line 74 of file BLI_index_range.hh.

◆ from_begin_end_inclusive()

constexpr IndexRange blender::IndexRange::from_begin_end_inclusive ( const int64_t begin,
const int64_t last )
inlinestaticconstexpr

Definition at line 79 of file BLI_index_range.hh.

◆ from_begin_size()

constexpr IndexRange blender::IndexRange::from_begin_size ( const int64_t begin,
const int64_t size )
inlinestaticconstexpr

◆ from_end_size()

constexpr IndexRange blender::IndexRange::from_end_size ( const int64_t end,
const int64_t size )
inlinestaticconstexpr

Definition at line 84 of file BLI_index_range.hh.

◆ from_single()

constexpr IndexRange blender::IndexRange::from_single ( const int64_t index)
inlinestaticconstexpr

Definition at line 89 of file BLI_index_range.hh.

◆ index_range()

IndexRange blender::IndexRange::index_range ( ) const
inlineconstexpr

Definition at line 157 of file BLI_index_range.hh.

◆ intersect()

IndexRange blender::IndexRange::intersect ( IndexRange other) const
inlineconstexpr

Returns a new IndexRange that contains the intersection of the current one with the given range. Returns empty range if there are no overlapping indices. The returned range is always a valid slice of this range.

Definition at line 290 of file BLI_index_range.hh.

◆ is_empty()

bool blender::IndexRange::is_empty ( ) const
inlineconstexpr

Returns true if the size is zero.

Definition at line 165 of file BLI_index_range.hh.

Referenced by update_custom_knots().

◆ last()

int64_t blender::IndexRange::last ( const int64_t n = 0) const
inlineconstexpr

Get the nth last element in the range. Asserts when the range is empty or when n is negative.

Definition at line 210 of file BLI_index_range.hh.

Referenced by draw_fcurve_curve_keys().

◆ one_after_last()

int64_t blender::IndexRange::one_after_last ( ) const
inlineconstexpr

Get the element one after the end. The returned value is undefined when the range is empty.

Definition at line 231 of file BLI_index_range.hh.

Referenced by imb_partial_display_buffer_update_ex().

◆ one_before_start()

Get the element one before the beginning. The returned value is undefined when the range is empty, and the range must start after zero already.

Definition at line 222 of file BLI_index_range.hh.

◆ operator[]()

int64_t blender::IndexRange::operator[] ( int64_t index) const
inlineconstexpr

Access an element in the range.

Definition at line 130 of file BLI_index_range.hh.

◆ shift()

IndexRange blender::IndexRange::shift ( int64_t n) const
inlineconstexpr

Move the range forward or backward within the larger array. The amount may be negative, but its absolute value cannot be greater than the existing start of the range.

Definition at line 346 of file BLI_index_range.hh.

◆ size()

◆ slice() [1/2]

IndexRange blender::IndexRange::slice ( IndexRange range) const
inlineconstexpr

Definition at line 280 of file BLI_index_range.hh.

◆ slice() [2/2]

IndexRange blender::IndexRange::slice ( int64_t start,
int64_t size ) const
inlineconstexpr

Returns a new range, that contains a sub-interval of the current one.

Definition at line 272 of file BLI_index_range.hh.

◆ start()

int64_t blender::IndexRange::start ( ) const
inlineconstexpr

Get the first element in the range. The returned value is undefined when the range is empty.

Definition at line 239 of file BLI_index_range.hh.

Referenced by shrink_attribute_storage().

◆ take_back()

Returns a new IndexRange that only contains the last n elements. This invokes undefined behavior when n is negative.

Definition at line 335 of file BLI_index_range.hh.

◆ take_front()

Returns a new IndexRange that only contains the first n elements. This invokes undefined behavior when n is negative.

Definition at line 324 of file BLI_index_range.hh.

◆ with_new_end()

IndexRange blender::IndexRange::with_new_end ( const int64_t new_end) const
inlineconstexpr

Creates a new index range with the same beginning but a different end.

Definition at line 173 of file BLI_index_range.hh.

◆ operator!=

friend bool operator!= ( IndexRange a,
IndexRange b )
friend

Definition at line 144 of file BLI_index_range.hh.

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
IndexRange range )
friend

Definition at line 46 of file index_range.cc.

◆ operator==

friend bool operator== ( IndexRange a,
IndexRange b )
friend

Two ranges compare equal when they contain the same numbers.

Definition at line 140 of file BLI_index_range.hh.


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