ORIGINAL
|
An iterator adapter for the iterable container. More...
#include <iterable.h>
Public Member Functions | |
iterAdaptor (const iterAdaptor &other) | |
Copy constructor for the iterAdaptor . | |
iterAdaptor & | operator= (const iterAdaptor &other) |
Copy assignment operator for the iterAdaptor . | |
const iterator< TYPE > & | getIt () const |
Gets the underlying iterator. | |
bool | hasNext () const override |
Checks if there is a next element. | |
bool | hasPrev () const override |
Checks if there is a previous element. | |
bool | atPrev (const iterator< TYPE > *other) const override |
Checks if the current iterator is at the previous element relative to another iterator. | |
bool | atNext (const iterator< TYPE > *other) const override |
Checks if the current iterator is at the next element relative to another iterator. | |
void | next () const override |
Moves the iterator to the next element. | |
void | prev () const override |
Moves the iterator to the previous element. | |
void | operator+= (integer steps) const override |
Advances the iterator by a specified number of steps. | |
void | operator-= (integer steps) const override |
Moves the iterator backward by a specified number of steps. | |
integer | operator- (const iterator< TYPE > &other) const override |
Calculates the distance between this iterator and another iterator. | |
TYPE & | get () override |
Gets the value of the element the iterator is pointing to. | |
void | set (const TYPE &data) override |
Sets the value of the element the iterator is pointing to. | |
TYPE | get () const override |
Gets the value of the element the iterator is pointing to (const version). | |
bool | isValid () const override |
Checks if the iterator is pointing to a valid element. | |
std::string | className () const override |
Returns the class name. | |
std::string | toString (bool enter) const override |
Converts the iterator to a string representation. | |
~iterAdaptor () override | |
Destructor for iterAdaptor . | |
![]() | |
TYPE & | operator* () |
Dereferences the iterator to get the element. | |
TYPE | operator* () const |
Dereferences the iterator to get a copy of the element. | |
void | operator++ () const |
Moves the iterator forward by one position. | |
void | operator++ (int postfix) const |
Moves the iterator forward by one position (postfix). | |
void | operator-- () const |
Moves the iterator backward by one position. | |
void | operator-- (int postfix) const |
Moves the iterator backward by one position (postfix). | |
integer | compareTo (const iterator &other) const override |
Compares two iterators to determine their relative positions. | |
operator bool () const | |
Checks if the iterator is valid (i.e., points to a valid element). | |
bool | atPrev (const iterator &other) const |
Checks if this iterator is positioned at the previous element. | |
bool | atNext (const iterator &other) const |
Checks if this iterator is positioned at the next element. | |
virtual TYPE | getElem () const |
Returns a copy of the element. | |
bool | equal (const iterator *other) const |
Checks if two iterators are equal. | |
bool | equal (const iterator &other) const |
Checks if two iterators are equal. | |
std::string | className () const override |
Returns the class name of the iterator. | |
std::string | toString (bool enter) const override |
Returns a string representation of the iterator. | |
~iterator () override=default | |
Virtual destructor for proper cleanup of derived objects. | |
![]() | |
operator std::string () const | |
Explicit conversion to std::string. | |
operator const char * () const | |
Explicit conversion to C-style string. | |
const char * | toCString (bool enter) const |
Direct C-string access with formatting control. | |
template<typename TYPE> | |
auto | formatString (const TYPE &t) -> std::string |
template<typename TYPE> | |
auto | formatCString (const TYPE &t) -> const char * |
template<typename TYPE> | |
auto | formatEnum (const TYPE &t) -> std::string |
template<typename TYPE> | |
auto | formatString (TYPE *const &ptr) -> std::string |
![]() | |
~cloneable () override=default | |
Virtual destructor for cloneable. | |
![]() | |
virtual | ~baseCloneable ()=default |
Virtual destructor for baseCloneable. | |
![]() | |
bool | operator== (const iterator< TYPE > &other) const |
Checks if the current object is equal to another. | |
bool | operator!= (const iterator< TYPE > &other) const |
Checks if the current object is not equal to another. | |
bool | operator< (const iterator< TYPE > &other) const |
Checks if the current object is less than another. | |
bool | operator> (const iterator< TYPE > &other) const |
Checks if the current object is greater than another. | |
bool | operator<= (const iterator< TYPE > &other) const |
Checks if the current object is less than or equal to another. | |
bool | operator>= (const iterator< TYPE > &other) const |
Checks if the current object is greater than or equal to another. | |
virtual | ~comparable ()=default |
Virtual destructor for proper cleanup of derived objects. | |
Protected Member Functions | |
bool | equalPtr (const iterator< TYPE > *other) const override |
Compares the current iterator with another iterator. | |
iterAdaptor * | clone () const override |
Creates a copy of the current iterator. | |
iterAdaptor * | getPrev () const override |
Gets the previous iterator. | |
iterAdaptor * | getNext () const override |
Gets the next iterator. | |
![]() | |
cloneable ()=default | |
Default constructor for cloneable. | |
![]() | |
baseCloneable ()=default | |
Default constructor for baseCloneable. | |
Friends | |
class | iterable |
Additional Inherited Members | |
![]() | |
template<typename TYPE> | |
static std::string | formatString (const TYPE &t) |
Universal value-to-string conversion. | |
template<typename TYPE> | |
static std::string | formatString (TYPE *const &ptr) |
Pointer-specific formatting. | |
template<typename TYPE> | |
static const char * | formatCString (const TYPE &t) |
C-string cache for temporary usage. | |
template<typename TYPE> | |
static std::string | formatEnum (const TYPE &t) |
Enum formatting utility. | |
template<> | |
auto | formatString (const char &t) -> std::string |
template<> | |
auto | formatString (const bool &t) -> std::string |
template<> | |
auto | formatString (const char *const &ptr) -> std::string |
An iterator adapter for the iterable container.
The iterAdaptor
class is an implementation of the iterator interface that adapts the base iterator (baseIterator<TYPE>
) and provides additional iterator functionalities to the iterable
class.
original::iterable< TYPE >::iterAdaptor::iterAdaptor | ( | const iterAdaptor & | other | ) |
Copy constructor for the iterAdaptor
.
other | The iterAdaptor to copy. |
|
override |
Destructor for iterAdaptor
.
Deletes the underlying base iterator.
|
overridevirtual |
Checks if the current iterator is at the next element relative to another iterator.
other | The iterator to compare with. |
true
if this iterator is positioned just after the other iterator. Implements original::iterator< TYPE >.
|
overridevirtual |
Checks if the current iterator is at the previous element relative to another iterator.
other | The iterator to compare with. |
true
if this iterator is positioned just before the other iterator. Implements original::iterator< TYPE >.
|
nodiscardoverridevirtual |
|
overrideprotectedvirtual |
Creates a copy of the current iterator.
iterAdaptor
pointing to the same element as the current iterator. Implements original::iterator< TYPE >.
|
overrideprotectedvirtual |
Compares the current iterator with another iterator.
other | The iterator to compare with. |
true
if the iterators are pointing to the same element. Implements original::iterator< TYPE >.
|
overridevirtual |
Gets the value of the element the iterator is pointing to (const version).
Implements original::iterator< TYPE >.
|
overridevirtual |
Gets the value of the element the iterator is pointing to.
Implements original::iterator< TYPE >.
auto original::iterable< TYPE >::iterAdaptor::getIt | ( | ) | const |
Gets the underlying iterator.
|
overrideprotectedvirtual |
Gets the next iterator.
iterAdaptor
pointing to the next element. Reimplemented from original::iterator< TYPE >.
|
overrideprotectedvirtual |
Gets the previous iterator.
iterAdaptor
pointing to the previous element. Implements original::iterator< TYPE >.
|
nodiscardoverridevirtual |
Checks if there is a next element.
true
if there is a next element. Implements original::iterator< TYPE >.
|
nodiscardoverridevirtual |
Checks if there is a previous element.
true
if there is a previous element. Implements original::iterator< TYPE >.
|
nodiscardoverridevirtual |
Checks if the iterator is pointing to a valid element.
true
if the iterator is valid, false
otherwise. Implements original::iterator< TYPE >.
|
overridevirtual |
Moves the iterator to the next element.
Implements original::iterator< TYPE >.
|
overridevirtual |
Advances the iterator by a specified number of steps.
steps | The number of steps to move forward. |
Implements original::iterator< TYPE >.
|
overridevirtual |
Calculates the distance between this iterator and another iterator.
other | The iterator to compare with. |
Implements original::iterator< TYPE >.
|
overridevirtual |
Moves the iterator backward by a specified number of steps.
steps | The number of steps to move backward. |
Implements original::iterator< TYPE >.
auto original::iterable< TYPE >::iterAdaptor::operator= | ( | const iterAdaptor & | other | ) |
Copy assignment operator for the iterAdaptor
.
other | The iterAdaptor to copy. |
iterAdaptor
.
|
overridevirtual |
Moves the iterator to the previous element.
Implements original::iterator< TYPE >.
|
overridevirtual |
Sets the value of the element the iterator is pointing to.
data | The value to set. |
Implements original::iterator< TYPE >.
|
nodiscardoverridevirtual |
Converts the iterator to a string representation.
enter | If true , adds a newline at the end. |
Reimplemented from original::printable.