ORIGINAL
|
A stream class that allows iteration, comparison, and printing. More...
#include <iterationStream.h>
Public Member Functions | |
integer | compareTo (const iterationStream &other) const override |
Compares the current iteration stream with another iteration stream. | |
std::string | className () const override |
Returns the class name. | |
std::string | toString (bool enter) const override |
Converts the iteration stream to a string representation. | |
![]() | |
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 |
![]() | |
iterAdaptor | begin () |
Returns an iterator pointing to the beginning of the iterable container. | |
iterAdaptor | end () |
Returns an iterator pointing to the end of the iterable container. | |
iterAdaptor | begin () const |
Returns a constant iterator pointing to the beginning of the iterable container. | |
iterAdaptor | end () const |
Returns a constant iterator pointing to the end of the iterable container. | |
iterAdaptor | first () |
Returns an iterator pointing to the first element. | |
iterAdaptor | last () |
Returns an iterator pointing to the last element. | |
iterAdaptor | first () const |
Returns a constant iterator pointing to the first element. | |
iterAdaptor | last () const |
Returns a constant iterator pointing to the last element. | |
virtual baseIterator< TYPE > * | begins () const =0 |
Returns the iterator to the beginning of the container. | |
virtual baseIterator< TYPE > * | ends () const =0 |
Returns the iterator to the end of the container. | |
template<typename Callback = transform<TYPE>> requires Operation<Callback, TYPE> | |
void | forEach (Callback operation=Callback{}) |
Applies a given operation to each element in the iterable container. | |
template<typename Callback = transform<TYPE>> requires Operation<Callback, TYPE> | |
void | forEach (const Callback &operation=Callback{}) const |
Applies a given operation to each element in the iterable container (const version). | |
template<typename Callback> requires original::Operation<Callback, TYPE> | |
auto | forEach (Callback operation) -> void |
template<typename Callback> requires original::Operation<Callback, TYPE> | |
auto | forEach (const Callback &operation) const -> void |
![]() | |
virtual integer | compareTo (const DERIVED &other) const=0 |
Compares the current object with another of the same type. | |
bool | operator== (const DERIVED &other) const |
Checks if the current object is equal to another. | |
bool | operator!= (const DERIVED &other) const |
Checks if the current object is not equal to another. | |
bool | operator< (const DERIVED &other) const |
Checks if the current object is less than another. | |
bool | operator> (const DERIVED &other) const |
Checks if the current object is greater than another. | |
bool | operator<= (const DERIVED &other) const |
Checks if the current object is less than or equal to another. | |
bool | operator>= (const DERIVED &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 | |
std::string | elementsString () const |
Returns a string representation of the elements in the stream. | |
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 |
A stream class that allows iteration, comparison, and printing.
TYPE | The type of elements contained in the stream. |
DERIVED | The derived class type. |
This class allows iteration over a collection of elements of type TYPE
. It provides methods for comparing two iteration streams and converting the stream into a string representation. The class is intended to be inherited by more specific stream types.
|
nodiscardoverridevirtual |
Returns the class name.
This method returns a string representing the class name of the object.
Reimplemented from original::printable.
Reimplemented in original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
override |
Compares the current iteration stream with another iteration stream.
other | Another iteration stream to compare with. |
Compares the elements of the two streams sequentially. If the elements are equal, the comparison continues. The first unequal element determines the result.
|
nodiscardprotected |
Returns a string representation of the elements in the stream.
This method iterates over the elements and formats them into a string.
|
nodiscardoverridevirtual |
Converts the iteration stream to a string representation.
enter | Whether to add a newline at the end of the string. |
This method returns a string containing the class name followed by a string representation of the stream elements. An optional newline character can be appended based on the enter
parameter.
Reimplemented from original::printable.