ORIGINAL
Loading...
Searching...
No Matches
original::bitSet< ALLOC >::Iterator Class Referencefinal

An iterator for traversing the bits in a bitSet. More...

#include <bitSet.h>

Inheritance diagram for original::bitSet< ALLOC >::Iterator:
Inheritance graph
Collaboration diagram for original::bitSet< ALLOC >::Iterator:
Collaboration graph

Public Member Functions

Iteratorclone () const override
 Clones the 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 *other) const override
 Checks if the iterator is at the previous element.
 
bool atNext (const iterator *other) const override
 Checks if the iterator is at the next element.
 
void next () const override
 Moves the iterator to the next element.
 
void prev () const override
 Moves the iterator to the previous element.
 
IteratorgetPrev () const override
 Gets the previous iterator.
 
IteratorgetNext () const override
 Gets the next iterator.
 
void operator+= (integer steps) const override
 Advances the iterator by the given number of steps.
 
void operator-= (integer steps) const override
 Moves the iterator backward by the given number of steps.
 
integer operator- (const iterator &other) const override
 Computes the distance between two iterators.
 
bool & get () override
 Gets the value of the current bit.
 
std::string className () const override
 Returns the class name of this iterator.
 
bool get () const override
 Gets the value of the current bit (const version).
 
void set (const bool &data) override
 Sets the value of the current bit.
 
bool isValid () const override
 Checks if the iterator is valid.
 
- Public Member Functions inherited from original::baseIterator< bool >
 ~baseIterator () override=default
 Virtual destructor for proper cleanup of derived objects.
 
- Public Member Functions inherited from original::iterator< TYPE >
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.
 
- Public Member Functions inherited from original::printable
 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
 
- Public Member Functions inherited from original::cloneable
 ~cloneable () override=default
 Virtual destructor for cloneable.
 
- Public Member Functions inherited from original::baseCloneable< cloneable >
virtual ~baseCloneable ()=default
 Virtual destructor for baseCloneable.
 
- Public Member Functions inherited from original::comparable< iterator< TYPE > >
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.
 
- Public Member Functions inherited from original::iterator< bool >
bool & operator* ()
 Dereferences the iterator to get the element.
 
bool 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 bool 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.
 
- Public Member Functions inherited from original::comparable< iterator< bool > >
virtual integer compareTo (const iterator< bool > &other) const=0
 Compares the current object with another of the same type.
 
bool operator== (const iterator< bool > &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const iterator< bool > &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const iterator< bool > &other) const
 Checks if the current object is less than another.
 
bool operator> (const iterator< bool > &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const iterator< bool > &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const iterator< bool > &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.
 

Friends

class bitSet
 

Additional Inherited Members

- Static Public Member Functions inherited from original::printable
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
 
- Protected Member Functions inherited from original::cloneable
 cloneable ()=default
 Default constructor for cloneable.
 
- Protected Member Functions inherited from original::baseCloneable< cloneable >
 baseCloneable ()=default
 Default constructor for baseCloneable.
 

Detailed Description

template<typename ALLOC = allocator<bool>>
class original::bitSet< ALLOC >::Iterator

An iterator for traversing the bits in a bitSet.

This iterator allows iteration over the bits of a bitSet, providing functionality to move forward, backward, and access or modify the bits.

Member Function Documentation

◆ atNext()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::atNext ( const iterator * other) const
overridevirtual

Checks if the iterator is at the next element.

Parameters
otherThe other iterator to compare.
Returns
True if this iterator is at the next element relative to the other iterator.

Implements original::iterator< TYPE >.

◆ atPrev()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::atPrev ( const iterator * other) const
overridevirtual

Checks if the iterator is at the previous element.

Parameters
otherThe other iterator to compare.
Returns
True if this iterator is at the previous element relative to the other iterator.

Implements original::iterator< TYPE >.

◆ className()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::className ( ) const
nodiscardoverridevirtual

Returns the class name of this iterator.

Returns
A string representing the class name, which is "bitset::Iterator".

Reimplemented from original::printable.

◆ clone()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::clone ( ) const
overridevirtual

Clones the iterator.

Returns
A new iterator pointing to the same position.

Implements original::baseIterator< bool >.

◆ get() [1/2]

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::get ( ) const
nodiscardoverridevirtual

Gets the value of the current bit (const version).

Returns
The value of the current bit.

Implements original::iterator< TYPE >.

◆ get() [2/2]

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::get ( )
overridevirtual

Gets the value of the current bit.

Returns
A reference to the current bit.

Implements original::iterator< TYPE >.

◆ getNext()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::getNext ( ) const
overridevirtual

Gets the next iterator.

Returns
A new iterator pointing to the next element.

Reimplemented from original::iterator< TYPE >.

◆ getPrev()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::getPrev ( ) const
overridevirtual

Gets the previous iterator.

Returns
A new iterator pointing to the previous element.

Implements original::iterator< TYPE >.

◆ hasNext()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::hasNext ( ) const
nodiscardoverridevirtual

Checks if there is a next element.

Returns
True if there is a next element, false otherwise.

Implements original::iterator< TYPE >.

◆ hasPrev()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::hasPrev ( ) const
nodiscardoverridevirtual

Checks if there is a previous element.

Returns
True if there is a previous element, false otherwise.

Implements original::iterator< TYPE >.

◆ isValid()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::isValid ( ) const
nodiscardoverridevirtual

Checks if the iterator is valid.

Returns
True if the iterator is valid, false otherwise.

Implements original::iterator< TYPE >.

◆ next()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::next ( ) const
overridevirtual

Moves the iterator to the next element.

Implements original::iterator< TYPE >.

◆ operator+=()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::operator+= ( integer steps) const
overridevirtual

Advances the iterator by the given number of steps.

Parameters
stepsThe number of steps to move forward.

Implements original::iterator< TYPE >.

◆ operator-()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::operator- ( const iterator & other) const
overridevirtual

Computes the distance between two iterators.

Parameters
otherThe other iterator.
Returns
The distance between the two iterators in terms of the number of elements.

Implements original::iterator< TYPE >.

◆ operator-=()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::operator-= ( integer steps) const
overridevirtual

Moves the iterator backward by the given number of steps.

Parameters
stepsThe number of steps to move backward.

Implements original::iterator< TYPE >.

◆ prev()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::prev ( ) const
overridevirtual

Moves the iterator to the previous element.

Implements original::iterator< TYPE >.

◆ set()

template<typename ALLOC>
auto original::bitSet< ALLOC >::Iterator::set ( const bool & data)
overridevirtual

Sets the value of the current bit.

Parameters
dataThe value to set the bit to.

Implements original::iterator< bool >.


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