Kale
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
Kale::Tree< T >::RawIterator< S > Struct Template Reference

#include <Tree.hpp>

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using value_type = S
 
using pointer = S*
 
using reference = S&
 

Public Member Functions

 RawIterator (const Tree &tree, S *ptr=nullptr)
 
RawIterator< S > & operator= (S *ptr)
 
 operator bool () const
 
bool operator== (const RawIterator< S > it) const
 
bool operator!= (const RawIterator< S > it) const
 
RawIterator< S > & operator++ ()
 
RawIterator< S > & operator-- ()
 
RawIterator< Soperator++ (int)
 
RawIterator< Soperator-- (int)
 
Soperator* ()
 
const Soperator* () const
 
Soperator-> ()
 
const Soperator-> () const
 
SgetPtr () const
 
const SgetConstPtr () const
 

Private Attributes

Sptr
 
const Treetree
 

Detailed Description

template<typename T>
template<typename S>
struct Kale::Tree< T >::RawIterator< S >

Custom iterator for iterating through trees. Attempts to iterate horizontally then vertically

Template Parameters
SThe structure held within the iterator (either T or const T)

Definition at line 328 of file Tree.hpp.

Member Typedef Documentation

◆ iterator_category

template<typename T >
template<typename S >
using Kale::Tree< T >::RawIterator< S >::iterator_category = std::bidirectional_iterator_tag

Definition at line 344 of file Tree.hpp.

◆ pointer

template<typename T >
template<typename S >
using Kale::Tree< T >::RawIterator< S >::pointer = S*

Definition at line 346 of file Tree.hpp.

◆ reference

template<typename T >
template<typename S >
using Kale::Tree< T >::RawIterator< S >::reference = S&

Definition at line 347 of file Tree.hpp.

◆ value_type

template<typename T >
template<typename S >
using Kale::Tree< T >::RawIterator< S >::value_type = S

Definition at line 345 of file Tree.hpp.

Constructor & Destructor Documentation

◆ RawIterator()

template<typename T >
template<typename S >
Kale::Tree< T >::RawIterator< S >::RawIterator ( const Tree & tree,
S * ptr = nullptr )
inline

Constructs a new raw iterator given a pointer

Parameters
treeThe tree this iterator belongs to
ptrThe pointer

Definition at line 354 of file Tree.hpp.

Member Function Documentation

◆ getConstPtr()

template<typename T >
template<typename S >
const S * Kale::Tree< T >::RawIterator< S >::getConstPtr ( ) const
inline

Gets a constant pointer to the child

Returns
A constant pointer to the child

Definition at line 498 of file Tree.hpp.

◆ getPtr()

template<typename T >
template<typename S >
S * Kale::Tree< T >::RawIterator< S >::getPtr ( ) const
inline

Gets a pointer to the child

Returns
A pointer to the child

Definition at line 490 of file Tree.hpp.

◆ operator bool()

template<typename T >
template<typename S >
Kale::Tree< T >::RawIterator< S >::operator bool ( ) const
inline

Returns whether or not the pointer is invalid

Returns
whether or not the pointer is invalid

Definition at line 367 of file Tree.hpp.

◆ operator!=()

template<typename T >
template<typename S >
bool Kale::Tree< T >::RawIterator< S >::operator!= ( const RawIterator< S > it) const
inline

Checks for inequality with another iterator

Parameters
itThe other iterator
Returns
True when unequal, false when equal

Definition at line 381 of file Tree.hpp.

◆ operator*() [1/2]

template<typename T >
template<typename S >
S & Kale::Tree< T >::RawIterator< S >::operator* ( )
inline

Dereferences the iterator

Returns
A reference to the child

Definition at line 458 of file Tree.hpp.

◆ operator*() [2/2]

template<typename T >
template<typename S >
const S & Kale::Tree< T >::RawIterator< S >::operator* ( ) const
inline

Dereferences the iterator

Returns
A reference to the child

Definition at line 466 of file Tree.hpp.

◆ operator++() [1/2]

template<typename T >
template<typename S >
RawIterator< S > & Kale::Tree< T >::RawIterator< S >::operator++ ( )
inline

Increments the iterator to continue to the next iteration

Returns
A reference to this (after increment)

Definition at line 387 of file Tree.hpp.

◆ operator++() [2/2]

template<typename T >
template<typename S >
RawIterator< S > Kale::Tree< T >::RawIterator< S >::operator++ ( int )
inline

Increments the iterator to continue to the next iteration

Returns
A copy of the iterator prior to the increment

Definition at line 438 of file Tree.hpp.

◆ operator--() [1/2]

template<typename T >
template<typename S >
RawIterator< S > & Kale::Tree< T >::RawIterator< S >::operator-- ( )
inline

Decrements the iterator to continue to the previous iteration

Returns
A reference to this (after decrement)

Definition at line 411 of file Tree.hpp.

◆ operator--() [2/2]

template<typename T >
template<typename S >
RawIterator< S > Kale::Tree< T >::RawIterator< S >::operator-- ( int )
inline

Decrements the iterator to continue to the previous iteration

Returns
A copy of the iterator prior to the decrement

Definition at line 448 of file Tree.hpp.

◆ operator->() [1/2]

template<typename T >
template<typename S >
S * Kale::Tree< T >::RawIterator< S >::operator-> ( )
inline

Allows for access to the child's methods and members

Returns
A pointer to the child

Definition at line 474 of file Tree.hpp.

◆ operator->() [2/2]

template<typename T >
template<typename S >
const S * Kale::Tree< T >::RawIterator< S >::operator-> ( ) const
inline

Allows for access to the child's methods and members

Returns
A pointer to the child

Definition at line 482 of file Tree.hpp.

◆ operator=()

template<typename T >
template<typename S >
RawIterator< S > & Kale::Tree< T >::RawIterator< S >::operator= ( S * ptr)
inline

Assigns the iterator to another pointer

Parameters
ptrThe pointer to assign to
Returns
A reference of this

Definition at line 361 of file Tree.hpp.

◆ operator==()

template<typename T >
template<typename S >
bool Kale::Tree< T >::RawIterator< S >::operator== ( const RawIterator< S > it) const
inline

Checks for equality with another iterator

Parameters
itThe other iterator
Returns
True when equal, false when not equal

Definition at line 374 of file Tree.hpp.

Member Data Documentation

◆ ptr

template<typename T >
template<typename S >
S* Kale::Tree< T >::RawIterator< S >::ptr
private

A pointer to the held node

Definition at line 334 of file Tree.hpp.

◆ tree

template<typename T >
template<typename S >
const Tree& Kale::Tree< T >::RawIterator< S >::tree
private

A reference to the tree

Definition at line 339 of file Tree.hpp.


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