34template<
typename TYPE>
115 explicit operator bool()
const;
121 [[nodiscard]]
virtual bool hasNext()
const = 0;
127 [[nodiscard]]
virtual bool hasPrev()
const = 0;
189 virtual TYPE
get()
const = 0;
201 virtual void set(
const TYPE& data) = 0;
221 [[nodiscard]]
virtual bool isValid()
const = 0;
234 [[nodiscard]] std::string
toString(
bool enter)
const override;
258template <
typename TYPE>
298 template<
typename TYPE>
303 template<
typename TYPE>
308 template<
typename TYPE>
313 template<
typename TYPE>
318 template<
typename TYPE>
323 template<
typename TYPE>
328 template<
typename TYPE>
333 template<
typename TYPE>
338 template<
typename TYPE>
340 return this->
atPrev(&other);
343 template<
typename TYPE>
345 return this->
atNext(&other);
348 template<
typename TYPE>
351 auto it = this->
clone();
356 template <
typename TYPE>
362 template<
typename TYPE>
367 template<
typename TYPE>
369 return this->
equal(&other);
372 template<
typename TYPE>
377 template<
typename TYPE>
379 std::stringstream ss;
389 template <
typename TYPE>
392 auto* nit = it.clone();
393 nit->operator+=(steps);
397 template <
typename TYPE>
400 auto* nit = it.clone();
401 nit->operator-=(steps);
A base class for basic iterators.
Definition iterator.h:259
baseIterator * clone() const override=0
Creates a clone of the iterator.
~baseIterator() override=default
Virtual destructor for proper cleanup of derived objects.
cloneable()=default
Default constructor for cloneable.
Base class for comparable objects.
Definition comparable.h:31
Base iterator interface that supports common operations for iteration.
Definition iterator.h:35
virtual void next() const =0
Moves the iterator to the next element.
virtual integer operator-(const iterator &other) const =0
Returns the distance between this iterator and another iterator.
virtual bool equalPtr(const iterator *other) const =0
Checks if two iterators point to the same object.
void operator++(int postfix) const
Moves the iterator forward by one position (postfix).
Definition iterator.h:314
virtual bool hasPrev() const =0
Checks if there is a previous element.
bool atPrev(const iterator &other) const
Checks if this iterator is positioned at the previous element.
Definition iterator.h:339
~iterator() override=default
Virtual destructor for proper cleanup of derived objects.
bool equal(const iterator *other) const
Checks if two iterators are equal.
Definition iterator.h:363
void operator--(int postfix) const
Moves the iterator backward by one position (postfix).
Definition iterator.h:324
virtual void operator-=(integer steps) const =0
Subtracts a number of steps from the current position of iterator.
void operator--() const
Moves the iterator backward by one position.
Definition iterator.h:319
friend iterator< T > * operator+(const iterator< T > &it, integer steps)
Adds a number of steps to the iterator's current position and returns a new iterator.
std::string toString(bool enter) const override
Returns a string representation of the iterator.
Definition iterator.h:378
virtual void set(const TYPE &data)=0
Sets the element pointed to by the iterator.
virtual iterator * getPrev() const =0
Returns a new iterator pointing to the previous element.
std::string className() const override
Returns the class name of the iterator.
Definition iterator.h:373
virtual bool atNext(const iterator *other) const =0
Checks if this iterator is positioned at the next element.
virtual bool atPrev(const iterator *other) const =0
Checks if this iterator is positioned at the previous element.
virtual TYPE & get()=0
Gets the element pointed to by the iterator.
TYPE & operator*()
Dereferences the iterator to get the element.
Definition iterator.h:299
friend iterator< T > * operator-(const iterator< T > &it, integer steps)
Subtracts a number of steps from the iterator's current position and returns a new iterator.
integer compareTo(const iterator &other) const override
Compares two iterators to determine their relative positions.
Definition iterator.h:329
TYPE operator*() const
Dereferences the iterator to get a copy of the element.
Definition iterator.h:304
virtual void prev() const =0
Moves the iterator to the previous element.
virtual bool isValid() const =0
Checks if the iterator is valid.
virtual bool hasNext() const =0
Checks if there is a next element.
void operator++() const
Moves the iterator forward by one position.
Definition iterator.h:309
iterator * clone() const override=0
Creates a clone of the iterator.
bool equal(const iterator &other) const
Checks if two iterators are equal.
Definition iterator.h:368
virtual TYPE get() const =0
Gets a copy of the element pointed to by the iterator.
bool atNext(const iterator &other) const
Checks if this iterator is positioned at the next element.
Definition iterator.h:344
virtual iterator * getNext() const
Returns a new iterator pointing to the next element.
Definition iterator.h:349
virtual TYPE getElem() const
Returns a copy of the element.
Definition iterator.h:357
virtual void operator+=(integer steps) const =0
Adds a number of steps to the current position of iterator.
Exception for container index out-of-range errors.
Definition error.h:84
Base class providing polymorphic string conversion capabilities.
Definition printable.h:25
static std::string formatString(const TYPE &t)
Universal value-to-string conversion.
Abstract base class for cloneable objects.
Interface for objects that can be compared.
Custom exception classes and callback validation utilities.
Main namespace for the project Original.
Definition algorithms.h:21
auto operator+(const iterator< T > &it, integer steps) -> iterator< T > *
Adds a number of steps to the iterator's current position and returns a new iterator.
auto operator-(const iterator< T > &it, integer steps) -> iterator< T > *
Subtracts a number of steps from the iterator's current position and returns a new iterator.
std::int64_t integer
64-bit signed integer type for arithmetic operations
Definition config.h:15
Interface for polymorphic string formatting and output.