TIterator< T > Class Template Reference
[Template Containers]

Template container iterator base class (abstract). More...

#include <tcontainer.h>

Inheritance diagram for TIterator< T >:
Inheritance graph
[legend]

Public Member Functions

 TIterator (const TContainer< T > &cont)
virtual ~TIterator ()
virtual bool done () const =0
 Check if end of container is reached.
virtual T & next ()=0
 Returns the current data and advances the iterator. postfix as in t = c++;.
virtual T & previous ()=0
 Returns the current data and backup. postfix as in t = c--;.
virtual T & current () const =0
 Returns the current data.
virtual void first ()=0
 Move to first data.
virtual void last ()=0
 Move to last data.
T & next (const T &)
 Advance to next equal.
T & previous (const T &)
 Backup to previous equal.
const TContainer< T > & container () const
 Return container reference.
 operator int32 () const
 Check if not end.
T & operator++ ()
 Advance the iterator to the next item and return it.
T & operator++ (int)
 Return the current item and advance the iterator to the next.
T & operator+= (int32 n)
 Advance the iterator n places and returns the item.
T & operator-- ()
 Decrement the iterator by one and return the item.
T & operator-- (int)
 Return the current item and decrement the iterator by one.
T & operator-= (int32)
 Decrement the iterator n places and returns the item.
T & operator() () const
 Return current item.

Protected Attributes

const TContainer< T > & _container
 Iterated container.

Detailed Description

template<class T>
class Steinberg::TIterator< T >

Template container iterator base class (abstract).

Each container implementation has a matching iterator. This class defines the basic interface for any iterator implementation.
Please note that TIterator::next and TIterator::previous always return the current iterator item and switch to the new item afterwards. This allows iteration loops in this style:

TLinkedList<int> myList;
...
TLinkedListIterator<int> iter (myList);
while (iter.done () == false)
{
   int myInt = iter.next ();
}
See also:
Steinberg::TContainer

Constructor & Destructor Documentation

TIterator ( const TContainer< T > &  cont  )  [inline, explicit]
virtual ~TIterator (  )  [inline, virtual]

Member Function Documentation

virtual bool done (  )  const [pure virtual]
virtual T& next (  )  [pure virtual]
virtual T& previous (  )  [pure virtual]
virtual T& current (  )  const [pure virtual]
virtual void first (  )  [pure virtual]
virtual void last (  )  [pure virtual]
T & next ( const T &  rItem  )  [inline]

Advance to next equal.

T & previous ( const T &  rItem  )  [inline]

Backup to previous equal.

const TContainer< T > & container (  )  const [inline]

Return container reference.

operator int32 (  )  const [inline]

Check if not end.

T & operator++ (  )  [inline]

Advance the iterator to the next item and return it.

T & operator++ ( int   )  [inline]

Return the current item and advance the iterator to the next.

T & operator+= ( int32  n  )  [inline]

Advance the iterator n places and returns the item.

T & operator-- (  )  [inline]

Decrement the iterator by one and return the item.

T & operator-- ( int   )  [inline]

Return the current item and decrement the iterator by one.

T & operator-= ( int32  num  )  [inline]

Decrement the iterator n places and returns the item.

T & operator() (  )  const [inline]

Return current item.


Field Documentation

const TContainer<T>& _container [protected]

Iterated container.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.