UString  0.1.0
UTF-8 C++11 string library
Public Types | Public Member Functions | Friends | List of all members
UString::IteratorBase< IterType > Class Template Reference

#include <UString.h>

Inheritance diagram for UString::IteratorBase< IterType >:
Inheritance graph
[legend]
Collaboration diagram for UString::IteratorBase< IterType >:
Collaboration graph
[legend]

Public Types

typedef UChar value_type
 
using reference = UChar
 

Public Member Functions

 IteratorBase ()=default
 
IteratorBaseoperator++ ()
 
IteratorBase operator++ (int)
 
IteratorBaseoperator-- ()
 
IteratorBase operator-- (int)
 
IterType base () const
 
const UChar operator* () const
 
bool operator!= (const IteratorBase &other)
 
bool operator== (const IteratorBase &other)
 

Friends

class UString
 

Detailed Description

template<typename IterType>
class UString::IteratorBase< IterType >

Base class for Iterators used in UString

This is a bidirectional iterator Random access can not be provided because all index operations need to iterate through UTF-8 characters, which can be multiple bytes. The iterator is not writable because UTF-8 characters are not a fixed size changing one codepoint to another could overwrite another codepoint. This would invalidate any iterators to the string.

Constructor & Destructor Documentation

template<typename IterType >
UString::IteratorBase< IterType >::IteratorBase ( )
default

Create a empty Iterator without a reference to any part of a string

Member Function Documentation

template<typename IterType >
IterType UString::IteratorBase< IterType >::base ( ) const
inline

The base iterator type

Returns
Base iterator
template<typename IterType >
bool UString::IteratorBase< IterType >::operator!= ( const IteratorBase< IterType > &  other)
inline

Compare this iterator with a other

Parameters
otherThe iterator to compare it to
Returns
False if the iterators are equal, and True if they aren't
template<typename IterType >
const UChar UString::IteratorBase< IterType >::operator* ( ) const
inline

Return the value of the current position

Returns
The value
template<typename IterType >
IteratorBase& UString::IteratorBase< IterType >::operator++ ( )
inline

Increment the iterator position

Returns
Reference to this iterator
template<typename IterType >
IteratorBase UString::IteratorBase< IterType >::operator++ ( int  )
inline

Increment the iterator position

Returns
Reference to this iterator
template<typename IterType >
IteratorBase& UString::IteratorBase< IterType >::operator-- ( )
inline

Decrement the iterator position

Returns
Reference to this iterator
template<typename IterType >
IteratorBase UString::IteratorBase< IterType >::operator-- ( int  )
inline

Decrement the iterator position

Returns
Reference to this iterator
template<typename IterType >
bool UString::IteratorBase< IterType >::operator== ( const IteratorBase< IterType > &  other)
inline

Compare this iterator with a other

Parameters
otherThe iterator to compare it to
Returns
True if the iterator is equal to other

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