ORIGINAL
Loading...
Searching...
No Matches
doubleDirectionIterator.h
Go to the documentation of this file.
1#ifndef DOUBLEDIRECTIONITERATOR_H
2#define DOUBLEDIRECTIONITERATOR_H
3#include "stepIterator.h"
4
11
12namespace original {
13
23 template<typename TYPE>
25 protected:
31
32 public:
38
45
50 doubleDirectionIterator* clone() const override;
51
56 [[nodiscard]] bool hasPrev() const override;
57
62 void prev() const override;
63 };
64}
65
66 template<typename TYPE>
69
70 template<typename TYPE>
75
76 template<typename TYPE>
78 const doubleDirectionIterator &other) {
79 if (this == &other) {
80 return *this;
81 }
83 return *this;
84 }
85
86 template<typename TYPE>
88 return this->isValid();
89 }
90
91 template<typename TYPE>
93 if (!this->isValid()) throw nullPointerError();
94 this->_ptr = this->_ptr->getPPrev();
95 }
96
97 template<typename TYPE>
101
102#endif //DOUBLEDIRECTIONITERATOR_H
Abstract base class for double-direction iterators.
Definition doubleDirectionIterator.h:24
doubleDirectionIterator & operator=(const doubleDirectionIterator &other)
Copy assignment operator for doubleDirectionIterator.
Definition doubleDirectionIterator.h:77
doubleDirectionIterator * clone() const override
Creates a heap-allocated copy of the iterator.
Definition doubleDirectionIterator.h:98
doubleDirectionIterator(wrapper< TYPE > *ptr)
Protected constructor for doubleDirectionIterator.
Definition doubleDirectionIterator.h:67
bool hasPrev() const override
Checks if the iterator can move backward.
Definition doubleDirectionIterator.h:87
void prev() const override
Moves the iterator to the previous element.
Definition doubleDirectionIterator.h:92
Exception for null pointer dereference attempts.
Definition error.h:110
wrapper< TYPE > * _ptr
Pointer to the current wrapper.
Definition stepIterator.h:39
stepIterator(wrapper< TYPE > *ptr)
Protected constructor for derived classes.
Definition stepIterator.h:184
stepIterator & operator=(const stepIterator &other)
Copy assignment operator for stepIterator.
Definition stepIterator.h:224
bool isValid() const override
Checks if the iterator is valid.
Definition stepIterator.h:351
Base class for linked value containers with formatted output.
Definition wrapper.h:28
Main namespace for the project Original.
Definition algorithms.h:21
Step iterator base class for single-step iterators.