Blender V5.3
blender::MainAllIDsIterator Class Reference

#include <BKE_main.hh>

Public Types

using iterator_category = std::bidirectional_iterator_tag
using value_type = ID
using difference_type = std::ptrdiff_t
using pointer = ID *
using reference = ID &

Public Member Functions

 MainAllIDsIterator ()
 MainAllIDsIterator (MainListsArray &lbarray, const bool reverse_id_type_order=false)
 MainAllIDsIterator (Main &bmain, const bool reverse_id_type_order=false)
MainAllIDsIterator begin () const
MainAllIDsIterator end () const
MainAllIDsIterator & operator++ ()
MainAllIDsIterator operator++ (int)
MainAllIDsIterator & operator-- ()
MainAllIDsIterator operator-- (int)
ID & operator* () const
int64_t size () const

Friends

bool operator== (const MainAllIDsIterator &a, const MainAllIDsIterator &b)

Detailed Description

An iterator over all IDs in the given Main.

As with the historic C-based APIs, order is defined by these rules:

  • ID types are iterated based on their eID_Index, by default from higher index to lower one (for historical reasons). This can be inverted by using the #reverse_id_type_order option.
  • Within a same type, IDs are iterated based on their libraries (local IDs always iterated first) and names (alphanumeric sorting).

This iterator will remain stable if the underlying Main is modified, as long as the current ID pointed at by the iterator is not modified.

  • Renaming the current ID may shift its position in the underlying main, making the iterator unstable (some items may be skipped, or iterated over several times).
  • Deleting the current ID will fully invalidate the iterator, attempt to use it in any way afterwards will result in invalid memory accesses.

Definition at line 826 of file BKE_main.hh.

Member Typedef Documentation

◆ difference_type

Definition at line 830 of file BKE_main.hh.

◆ iterator_category

using blender::MainAllIDsIterator::iterator_category = std::bidirectional_iterator_tag

Definition at line 828 of file BKE_main.hh.

◆ pointer

Definition at line 831 of file BKE_main.hh.

◆ reference

Definition at line 832 of file BKE_main.hh.

◆ value_type

Definition at line 829 of file BKE_main.hh.

Constructor & Destructor Documentation

◆ MainAllIDsIterator() [1/3]

◆ MainAllIDsIterator() [2/3]

blender::MainAllIDsIterator::MainAllIDsIterator ( MainListsArray & lbarray,
const bool reverse_id_type_order = false )
inlineexplicit

Definition at line 848 of file BKE_main.hh.

◆ MainAllIDsIterator() [3/3]

blender::MainAllIDsIterator::MainAllIDsIterator ( Main & bmain,
const bool reverse_id_type_order = false )
inlineexplicit

Definition at line 855 of file BKE_main.hh.

References blender::BKE_main_lists_get().

Member Function Documentation

◆ begin()

MainAllIDsIterator blender::MainAllIDsIterator::begin ( ) const
inline

Definition at line 901 of file BKE_main.hh.

References MainAllIDsIterator().

Referenced by blender::bke::tests::TEST_F().

◆ end()

MainAllIDsIterator blender::MainAllIDsIterator::end ( ) const
inline

Definition at line 909 of file BKE_main.hh.

References MainAllIDsIterator().

Referenced by blender::bke::tests::TEST_F().

◆ operator*()

ID & blender::MainAllIDsIterator::operator* ( ) const
inline

Definition at line 940 of file BKE_main.hh.

◆ operator++() [1/2]

MainAllIDsIterator & blender::MainAllIDsIterator::operator++ ( )

Definition at line 1224 of file main.cc.

References blender::BLI_assert(), BLI_assert_unreachable, and MainAllIDsIterator().

◆ operator++() [2/2]

MainAllIDsIterator blender::MainAllIDsIterator::operator++ ( int )
inline

Definition at line 919 of file BKE_main.hh.

References MainAllIDsIterator().

◆ operator--() [1/2]

MainAllIDsIterator & blender::MainAllIDsIterator::operator-- ( )

Definition at line 1258 of file main.cc.

References blender::BLI_assert(), BLI_assert_unreachable, and MainAllIDsIterator().

◆ operator--() [2/2]

MainAllIDsIterator blender::MainAllIDsIterator::operator-- ( int )
inline

Definition at line 928 of file BKE_main.hh.

References MainAllIDsIterator().

◆ size()

int64_t blender::MainAllIDsIterator::size ( ) const

Return the total number of IDs in the Main database that this iterator is iterating over.

Definition at line 1291 of file main.cc.

References size().

Referenced by size(), and blender::bke::tests::TEST_F().

◆ operator==

bool operator== ( const MainAllIDsIterator & a,
const MainAllIDsIterator & b )
friend

Definition at line 935 of file BKE_main.hh.

References b, and MainAllIDsIterator().


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