DIWNE::FilteredRecursiveNodeIterator
A wrapper around the RecursiveNodeIterator that also filters its output. More...
#include "DIWNE/Core/diwne_iterators.h"
Inherits from DIWNE::RecursiveNodeIteratorImpl< FilteredRecursiveNodeIterator< Node >, Node >, DIWNE::ForwardNodeIterator< Iterator, NodeType, false >, DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >
Public Types
Name | |
---|---|
using typename Super::shared_pointer | shared_pointer |
Protected Types
Name | |
---|---|
using FilteredRecursiveNodeIterator< NodeType > | Iterator |
using bool(*)(const Node *) | Predicate |
using RecursiveNodeIteratorImpl< FilteredRecursiveNodeIterator< NodeType >, NodeType > | Super |
Public Functions
Name | |
---|---|
FilteredRecursiveNodeIterator() | |
FilteredRecursiveNodeIterator(Predicate predicate, Predicate divePredicate, typename Super::Container nodes, std::size_t idx) | |
FilteredRecursiveNodeIterator(Predicate predicate, typename Super::Container nodes, std::size_t idx) | |
void | next() |
bool | valid() const |
Protected Attributes
Name | |
---|---|
Predicate | _predicate |
Additional inherited members
Protected Types inherited from DIWNE::RecursiveNodeIteratorImpl< FilteredRecursiveNodeIterator< Node >, Node >
Name | |
---|---|
using NodeIterator<> | ChildNodeIterator |
using NodeRange<> | ChildNodeRange |
Public Functions inherited from DIWNE::RecursiveNodeIteratorImpl< FilteredRecursiveNodeIterator< Node >, Node >
Name | |
---|---|
RecursiveNodeIteratorImpl() | |
RecursiveNodeIteratorImpl(Predicate divePredicate, typename Super::Container nodes, std::size_t idx) | |
RecursiveNodeIteratorImpl(typename Super::Container nodes, std::size_t idx) | |
Node * | basePtr()<br>Returns the base Node* pointer that isn't casted to the derived NodeType. |
reference | dereference() const |
bool | equals(const Iterator & b) const |
pointer | ptr() const |
shared_pointer | sharedPtr() const |
Protected Attributes inherited from DIWNE::RecursiveNodeIteratorImpl< FilteredRecursiveNodeIterator< Node >, Node >
Name | |
---|---|
Predicate | _divePredicate <br>Dive predicate, an additional condition required to consider diving inside node's children. |
std::stack< ChildNodeIterator, std::vector< ChildNodeIterator > > | _stack <br>A stack of child container node iterators, they store their own position at each depth level. |
Public Types inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >
Name | |
---|---|
using const NodeList * | Container |
Public Functions inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >
Name | |
---|---|
ForwardNodeIterator() | |
ForwardNodeIterator(Container nodes, std::size_t idx) | |
reference | dereference() const |
bool | equals(const Iterator & b) const<br>Determines whether this iterator is pointing to the same element as another one (used by the == operator) |
pointer | ptr() const |
shared_pointer | sharedPtr() const |
Protected Attributes inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >
Name | |
---|---|
std::size_t | _idx <br>Current node index // TODO: Should probably be an int. |
Container | _nodes <br>Reference to the node list. |
Public Types inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >
Name | |
---|---|
using std::ptrdiff_t | difference_type |
using std::forward_iterator_tag | iterator_category |
using typename std::conditional< IsConst, const Value *, Value * >::type | pointer |
using typename std::conditional< IsConst, const Value &, Value & >::type | reference |
using typename std::conditional< IsConst, const Value, Value >::type | value_type |
Public Functions inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >
Name | |
---|---|
reference | operator*() |
Iterator & | operator++() |
Iterator | operator++(int ) |
pointer | operator->() |
Protected Functions inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >
Name | |
---|---|
ForwardIteratorBase() | |
virtual | ~ForwardIteratorBase() =default |
reference | dereference() const<br>Return a reference to the current element (reference to a value type, not a pointer). |
bool | equals(const Iterator & b) const<br>Determines whether this iterator is pointing to the same element as another one (used by the == operator) |
pointer | ptr() const<br>Return a raw pointer to the current element. |
Iterator * | self()<br>CRTP self pointer (pointer to the derived type) |
const Iterator * | self() const<br>CRTP const self pointer. |
std::shared_ptr< Value > | sharedPtr() const<br>Return the owning pointer to the current element. Creates a new shared pointer object. |
Friends inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >
Name | |
---|---|
bool | operator!=(const Iterator & a, const Iterator & b) |
bool | operator==(const Iterator & a, const Iterator & b) |
Detailed Description
template <typename NodeType =Node>
class DIWNE::FilteredRecursiveNodeIterator;
template <typename NodeType =Node>
class DIWNE::FilteredRecursiveNodeIterator;
A wrapper around the RecursiveNodeIterator that also filters its output.
Template Parameters:
- NodeType The node type returned nodes are casted to. It must be ensured that the passed node list only contains nodes of this subtype or the filtering condition is only passed for this subtype. Otherwise an incompatible node type gets downcasted and undefined behavior will occur (static cast is used).
See: RecursiveNodeIterator, FilteredRecursiveNodeRange
Warning: This iterator iterates to the first valid position immediately on construction. It will iterate over the whole underlying node list if no node matches its filter!
Like the regular recursive node iterator it is a forward iterator that cannot go back.
Public Types Documentation
using shared_pointer
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::shared_pointer = typename Super::shared_pointer;
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::shared_pointer = typename Super::shared_pointer;
Protected Types Documentation
using Iterator
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Iterator = FilteredRecursiveNodeIterator<NodeType>;
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Iterator = FilteredRecursiveNodeIterator<NodeType>;
using Predicate
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Predicate = bool (*)(const Node*);
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Predicate = bool (*)(const Node*);
using Super
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Super = RecursiveNodeIteratorImpl<FilteredRecursiveNodeIterator<NodeType>, NodeType>;
using DIWNE::FilteredRecursiveNodeIterator< NodeType >::Super = RecursiveNodeIteratorImpl<FilteredRecursiveNodeIterator<NodeType>, NodeType>;
Public Functions Documentation
function FilteredRecursiveNodeIterator
inline FilteredRecursiveNodeIterator()
inline FilteredRecursiveNodeIterator()
function FilteredRecursiveNodeIterator
inline FilteredRecursiveNodeIterator(
Predicate predicate,
Predicate divePredicate,
typename Super::Container nodes,
std::size_t idx
)
inline FilteredRecursiveNodeIterator(
Predicate predicate,
Predicate divePredicate,
typename Super::Container nodes,
std::size_t idx
)
function FilteredRecursiveNodeIterator
inline FilteredRecursiveNodeIterator(
Predicate predicate,
typename Super::Container nodes,
std::size_t idx
)
inline FilteredRecursiveNodeIterator(
Predicate predicate,
typename Super::Container nodes,
std::size_t idx
)
function next
inline void next()
inline void next()
function valid
inline bool valid() const
inline bool valid() const
Protected Attributes Documentation
variable _predicate
Predicate _predicate;
Predicate _predicate;
Updated on 2025-05-31 at 12:55:31 +0000