![]() |
|
Uniot Core
|
| 0.8.1 |
#include <IterableQueue.h>
Public Member Functions | |
| void | begin () const |
| Initialize the iterator to the beginning of the queue. | |
| bool | isEnd () const |
| Check if the iterator has reached the end of the queue. | |
| const T & | next () const |
| Move to the next element and return the current element. | |
| const T & | current () const |
| Access the current element without moving the iterator. | |
| bool | deleteCurrent () |
| Remove the current element from the queue. | |
Public Member Functions inherited from ClearQueue< T > | |
| ClearQueue (ClearQueue const &)=delete | |
| Deleted copy constructor to prevent copying. | |
| void | operator= (ClearQueue const &)=delete |
| Deleted assignment operator to prevent copying. | |
| ClearQueue () | |
| Constructs an empty queue. | |
| virtual | ~ClearQueue () |
| Destroys the queue and releases all allocated memory. | |
| void | push (const T &value) |
| Adds an element to the end of the queue. | |
| bool | pushUnique (const T &value) |
| Adds an element to the queue only if it doesn't already exist. | |
| T | hardPop () |
| Removes and returns the element at the front of the queue. | |
| const T & | hardPeek () const |
| Returns the element at the front of the queue without removing it. | |
| T | pop (const T &errorCode) |
| Safely removes and returns the element at the front of the queue. | |
| const T & | peek (const T &errorCode) const |
| Safely returns the element at the front of the queue without removing it. | |
| bool | removeOne (const T &value) |
| Removes the first occurrence of a specific value from the queue. | |
| bool | contains (const T &value) const |
| Checks if the queue contains a specific value. | |
| T * | find (const T &value) const |
| Finds and returns a pointer to the first occurrence of a value. | |
| bool | isEmpty () const |
| Checks if the queue is empty. | |
| size_t | calcSize () const |
| Calculate the number of elements in the queue by traversal. | |
| void | clean () |
| Removes all elements from the queue. | |
| void | forEach (VoidCallback callback) const |
| Executes a callback function on each element in the queue. | |
Protected Attributes | |
| ClearQueue< T >::pnode | mCurrent |
| Pointer to the current node during iteration. | |
Protected Attributes inherited from ClearQueue< T > | |
| pnode | mHead |
| Pointer to the first node in the queue. | |
| pnode | mTail |
| Pointer to the last node in the queue. | |
Additional Inherited Members | |
Public Types inherited from ClearQueue< T > | |
| typedef std::function< void(const T &)> | VoidCallback |
| Callback function type for forEach operations. | |
Protected Types inherited from ClearQueue< T > | |
| typedef struct ClearQueue::node * | pnode |
| Node structure for the linked list implementation. | |
| void IterableQueue< T >::begin | ( | ) | const |
Initialize the iterator to the beginning of the queue.
Sets the current position to the head of the queue for iteration.
| const T & IterableQueue< T >::current | ( | ) | const |
Access the current element without moving the iterator.
| T& | The value at the current iterator position |
| bool IterableQueue< T >::deleteCurrent | ( | ) |
Remove the current element from the queue.
Removes the element at the current iterator position and advances the iterator to the next element. If the current element is the last element, the iterator will point to the end.
| true | The element was successfully removed |
| false | The iterator was at the end or queue was empty |
| bool IterableQueue< T >::isEnd | ( | ) | const |
Check if the iterator has reached the end of the queue.
| true | If the iterator has reached the end (no more elements) |
| false | If there are still elements to iterate through |
| const T & IterableQueue< T >::next | ( | ) | const |
Move to the next element and return the current element.
Advances the iterator to the next position and returns the value at the previous position.
| T& | The value of the current element before advancing |
|
mutableprotected |
Pointer to the current node during iteration.
This mutable member allows modification within const methods to support iteration in const contexts.