MySQL 8.4.2
Source Code Documentation
Item_tree_walker Class Reference

Utility mixin class to be able to walk() only parts of item trees. More...

#include <item.h>

Inheritance diagram for Item_tree_walker:
[legend]

Protected Member Functions

 Item_tree_walker ()
 
 ~Item_tree_walker ()
 
 Item_tree_walker (const Item_tree_walker &)=delete
 
Item_tree_walkeroperator= (const Item_tree_walker &)=delete
 
void stop_at (const Item *i)
 Stops walking children of this item. More...
 
bool is_stopped (const Item *i)
 

Private Attributes

const Itemstopped_at_item {nullptr}
 

Detailed Description

Utility mixin class to be able to walk() only parts of item trees.

Used with PREFIX+POSTFIX walk: in the prefix call of the Item processor, we process the item X, may decide that its children should not be processed (just like if they didn't exist): processor calls stop_at(X) for that. Then walk() goes to a child Y; the processor tests is_stopped(Y) which returns true, so processor sees that it must not do any processing and returns immediately. Finally, the postfix call to the processor on X tests is_stopped(X) which returns "true" and understands that the not-to-be-processed children have been skipped so calls restart(). Thus, any sibling of X, any part of the Item tree not under X, can then be processed.

Constructor & Destructor Documentation

◆ Item_tree_walker() [1/2]

Item_tree_walker::Item_tree_walker ( )
inlineprotected

◆ ~Item_tree_walker()

Item_tree_walker::~Item_tree_walker ( )
inlineprotected

◆ Item_tree_walker() [2/2]

Item_tree_walker::Item_tree_walker ( const Item_tree_walker )
protecteddelete

Member Function Documentation

◆ is_stopped()

bool Item_tree_walker::is_stopped ( const Item i)
inlineprotected
Returns
if we are stopped. If item 'i' is where we stopped, restarts the walk for next items.

◆ operator=()

Item_tree_walker & Item_tree_walker::operator= ( const Item_tree_walker )
protecteddelete

◆ stop_at()

void Item_tree_walker::stop_at ( const Item i)
inlineprotected

Stops walking children of this item.

Member Data Documentation

◆ stopped_at_item

const Item* Item_tree_walker::stopped_at_item {nullptr}
private

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