ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Types | Public Methods | Protected Fields | List of all members
TString< TChar >::TRandomAccessIterator< TCharConstOrMutable > Class Template Reference

#include <string.hpp>

Class Description

template<typename TChar>
template<typename TCharConstOrMutable>
class aworx::lib::strings::TString< TChar >::TRandomAccessIterator< TCharConstOrMutable >


Implementation of std::iterator_traits for class TString and its descendents. Base class String exposes ConstIterator which uses const TChar* and const TChar& for template types TPointer and TReference. Descendant classes may expose a mutable version (e.g. AString).

As the name of the class indicates, this iterator satisfies the C++ standard library concept RandomAccessIterator .

Definition at line 2007 of file string.hpp.

Public Types

using difference_type = integer
 Implementation of std::iterator_traits.
 
using iterator_category = std::random_access_iterator_tag
 Implementation of std::iterator_traits.
 
using pointer = TCharConstOrMutable *
 Implementation of std::iterator_traits.
 
using reference = TCharConstOrMutable &
 Implementation of std::iterator_traits.
 
using value_type = TCharConstOrMutable
 Implementation of std::iterator_traits.
 

Public Methods

 TRandomAccessIterator (TCharConstOrMutable *start=nullptr)
 
bool operator!= (TRandomAccessIterator other) const
 
TCharConstOrMutable & operator* ()
 
TCharConstOrMutable & operator* () const
 
TRandomAccessIterator operator+ (integer n) const
 
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE TRandomAccessIteratoroperator++ ()
 
TRandomAccessIterator operator++ (int)
 
TRandomAccessIteratoroperator+= (integer n)
 
TRandomAccessIterator operator- (integer n) const
 
integer operator- (TRandomAccessIterator other) const
 
TRandomAccessIteratoroperator-- ()
 
TRandomAccessIterator operator-- (int)
 
TRandomAccessIteratoroperator-= (integer n)
 
bool operator< (TRandomAccessIterator other) const
 
bool operator<= (TRandomAccessIterator other) const
 
bool operator== (TRandomAccessIterator other) const
 
bool operator> (TRandomAccessIterator other) const
 
bool operator>= (TRandomAccessIterator other) const
 
TCharConstOrMutable & operator[] (integer n) const
 

Protected Fields

TCharConstOrMutable * p
 

Constructor & Destructor Documentation

◆ TRandomAccessIterator()

TRandomAccessIterator ( TCharConstOrMutable *  start = nullptr)
inlineexplicit

Constructor.

Parameters
startPointer to the initial character.

Definition at line 2023 of file string.hpp.

Member Function Documentation

◆ operator!=()

bool operator!= ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and given iterator are not equal, false otherwise.

Definition at line 2056 of file string.hpp.

◆ operator*() [1/2]

TCharConstOrMutable& operator* ( )
inline

Retrieves the character that this iterator references.

Returns
The character value.

Definition at line 2070 of file string.hpp.

◆ operator*() [2/2]

TCharConstOrMutable& operator* ( ) const
inline

Retrieves the character that this iterator references.

Returns
The character value.

Definition at line 2063 of file string.hpp.

◆ operator+()

TRandomAccessIterator operator+ ( integer  n) const
inline

Addition.

Parameters
nThe value to subtract.
Returns
The resulting iterator value.

Definition at line 2118 of file string.hpp.

Here is the call graph for this function:

◆ operator++() [1/2]

Prefix increment operator.

Returns
A reference to this object.

Definition at line 2031 of file string.hpp.

◆ operator++() [2/2]

TRandomAccessIterator operator++ ( int  )
inline

Postfix increment operator.

Returns
An iterator value that is not increased, yet.

Definition at line 2039 of file string.hpp.

Here is the call graph for this function:

◆ operator+=()

TRandomAccessIterator& operator+= ( integer  n)
inline

Addition assignment.

Parameters
nThe value to subtract.
Returns
A reference to this iterator.

Definition at line 2100 of file string.hpp.

◆ operator-() [1/2]

TRandomAccessIterator operator- ( integer  n) const
inline

Subtraction.

Parameters
nThe value to subtract.
Returns
The resulting iterator value.

Definition at line 2126 of file string.hpp.

Here is the call graph for this function:

◆ operator-() [2/2]

integer operator- ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Difference (distance) from this iterator to the given one.

Parameters
otherThe iterator to subtract
Returns
The difference between (distance of) this and the given iterator.

Definition at line 2134 of file string.hpp.

◆ operator--() [1/2]

TRandomAccessIterator& operator-- ( )
inline

Prefix decrement operator.

Returns
A reference to this object.

Definition at line 2080 of file string.hpp.

◆ operator--() [2/2]

TRandomAccessIterator operator-- ( int  )
inline

Postfix decrement operator.

Returns
The iterator value prior the decrement operation.

Definition at line 2089 of file string.hpp.

Here is the call graph for this function:

◆ operator-=()

TRandomAccessIterator& operator-= ( integer  n)
inline

Subtraction assignment.

Parameters
nThe value to subtract.
Returns
A reference to this iterator.

Definition at line 2109 of file string.hpp.

◆ operator<()

bool operator< ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Compares this iterator with the given one.

Parameters
otherThe iterator to compare
Returns
true if this iterator is smaller than other, false otherwise.

Definition at line 2155 of file string.hpp.

◆ operator<=()

bool operator<= ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Compares this iterator with the given one.

Parameters
otherThe iterator to compare
Returns
true if this iterator is smaller than or equal to other, false otherwise.

Definition at line 2164 of file string.hpp.

◆ operator==()

bool operator== ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and the given iterator are pointing to the same character in the same array, false otherwise.

Definition at line 2048 of file string.hpp.

◆ operator>()

bool operator> ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Compares this iterator with the given one.

Parameters
otherThe iterator to compare
Returns
true if this iterator is greater than other, false otherwise.

Definition at line 2174 of file string.hpp.

◆ operator>=()

bool operator>= ( TRandomAccessIterator< TCharConstOrMutable >  other) const
inline

Compares this iterator with the given one.

Parameters
otherThe iterator to compare
Returns
true if this iterator is greater than or equal to other, false otherwise.

Definition at line 2183 of file string.hpp.

◆ operator[]()

TCharConstOrMutable& operator[] ( integer  n) const
inline

Subscript operator.

Parameters
nThe distance to add.
Returns
Reference to the character referenced by this iterator plus the distance given.

Definition at line 2144 of file string.hpp.

Member Data Documentation

◆ p

TCharConstOrMutable* p
protected

The pointer into the buffer is all we store.

Definition at line 2019 of file string.hpp.


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