MySQL 9.0.0
Source Code Documentation
Query_terms< visit_order, visit_leaves >::Query_term_iterator Class Reference

The iterator class itself is private. More...

Public Member Functions

 Query_term_iterator (Query_term *root)
 Construct an iterator over the query term tree rooted in root, optionally skipping the leaves. More...
 
 Query_term_iterator ()=default
 
Query_term_iteratoroperator++ ()
 
Query_termoperator* ()
 
bool operator== (const Query_term_iterator &other) const
 
bool operator!= (const Query_term_iterator &other) const
 

Private Member Functions

void dive_to_leftmost_leaf_of_child ()
 Starting at m_current->m_children[m_child_index], dive down through any left-most (index == 0) further children till we find left-most leaf term (a Query_block) under the child pointed to by m_child_index. More...
 
void prepare_for_next_sibling ()
 Find the index of the next sibling, if any, of m_current qua child of its parent, so we can visit it: assign it to m_child_idx. More...
 

Private Attributes

Query_termm_current {nullptr}
 Iterator state consists of the next two member variables. More...
 
uint m_child_idx {0}
 Used to find next child node to dive into, see set_next_child_idx. More...
 

Detailed Description

template<Visit_order visit_order, Visit_leaves visit_leaves>
class Query_terms< visit_order, visit_leaves >::Query_term_iterator

The iterator class itself is private.

Only used directly by begin and end

Constructor & Destructor Documentation

◆ Query_term_iterator() [1/2]

template<Visit_order visit_order, Visit_leaves visit_leaves>
Query_terms< visit_order, visit_leaves >::Query_term_iterator::Query_term_iterator ( Query_term root)
inlineexplicit

Construct an iterator over the query term tree rooted in root, optionally skipping the leaves.

Skipping is useful for those cases where the leaves are visited separately[1] and we only want to visit the set operation nodes in the tree. [1] By walking the Query_expression::first_query_block and Query_block::next_query_block chain

Parameters
rootthe node to start iteration from

◆ Query_term_iterator() [2/2]

template<Visit_order visit_order, Visit_leaves visit_leaves>
Query_terms< visit_order, visit_leaves >::Query_term_iterator::Query_term_iterator ( )
default

Member Function Documentation

◆ dive_to_leftmost_leaf_of_child()

template<Visit_order visit_order, Visit_leaves visit_leaves>
void Query_terms< visit_order, visit_leaves >::Query_term_iterator::dive_to_leftmost_leaf_of_child ( )
inlineprivate

Starting at m_current->m_children[m_child_index], dive down through any left-most (index == 0) further children till we find left-most leaf term (a Query_block) under the child pointed to by m_child_index.

After the dive, m_child_index will be zero, and m_current will be set to the leaf term.

◆ operator!=()

template<Visit_order visit_order, Visit_leaves visit_leaves>
bool Query_terms< visit_order, visit_leaves >::Query_term_iterator::operator!= ( const Query_term_iterator other) const
inline

◆ operator*()

template<Visit_order visit_order, Visit_leaves visit_leaves>
Query_term * Query_terms< visit_order, visit_leaves >::Query_term_iterator::operator* ( )
inline

◆ operator++()

template<Visit_order visit_order, Visit_leaves visit_leaves>
Query_term_iterator & Query_terms< visit_order, visit_leaves >::Query_term_iterator::operator++ ( )
inline

◆ operator==()

template<Visit_order visit_order, Visit_leaves visit_leaves>
bool Query_terms< visit_order, visit_leaves >::Query_term_iterator::operator== ( const Query_term_iterator other) const
inline

◆ prepare_for_next_sibling()

template<Visit_order visit_order, Visit_leaves visit_leaves>
void Query_terms< visit_order, visit_leaves >::Query_term_iterator::prepare_for_next_sibling ( )
inlineprivate

Find the index of the next sibling, if any, of m_current qua child of its parent, so we can visit it: assign it to m_child_idx.

Setting m_child_idx to a value of Query_term::child_count means we signal that we are done. Also, m_current is set to its parent.

Member Data Documentation

◆ m_child_idx

template<Visit_order visit_order, Visit_leaves visit_leaves>
uint Query_terms< visit_order, visit_leaves >::Query_term_iterator::m_child_idx {0}
private

Used to find next child node to dive into, see set_next_child_idx.

◆ m_current

template<Visit_order visit_order, Visit_leaves visit_leaves>
Query_term* Query_terms< visit_order, visit_leaves >::Query_term_iterator::m_current {nullptr}
private

Iterator state consists of the next two member variables.


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