All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions
Qtilities::Core::ConstSubjectIterator< T > Class Template Reference

An non-const iterator which iterates throught the subjects of an Observer. More...

#include <SubjectIterator.h>

Inheritance diagram for Qtilities::Core::ConstSubjectIterator< T >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ObserverIterationLevel { IterateChildren, IterateSiblings }
 The level to use when passing only an observer in your constructor. More...

Public Member Functions

 ConstSubjectIterator (const T *subject, Observer *observer=0, int iterator_id=-1)
 Default constructor.
 ConstSubjectIterator (const Observer *observer, ObserverIterationLevel iteration_level, const Observer *sibling_iteration_parent_observer=0, int iterator_id=-1)
 Observer based constructor.
const T * current () const
 The current item in the context iterated through.
const T * first ()
 The first item in the context iterated through.
const T * last ()
 The last item in the context iterated through.
const T * next ()
 The next item in the context iterated through.
const T * previous ()
 The previous item in the context iterated through.
void setCurrent (const T *current)
 Sets the current item in the context iterated through.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IConstIterator< T >
virtual bool hasNext ()
 Indicates if a next item exists.
virtual bool hasPrevious ()
 Indicates if a previous item exists.
virtual const T * operator++ ()
 Prefix increment.
virtual const T * operator++ (int x)
 Postfix increment.
virtual const T * operator-- ()
 Prefix decrement.
virtual const T * operator-- (int x)
 Postfix decrement.

Detailed Description

template<class T>
class Qtilities::Core::ConstSubjectIterator< T >

An non-const iterator which iterates throught the subjects of an Observer.

See also:
SubjectIterator, TreeIterator

This class was added in Qtilities v1.0.


Member Enumeration Documentation

The level to use when passing only an observer in your constructor.

Enumerator:
IterateChildren 

Iterate on the observer's children.

IterateSiblings 

Iterate on the observer's siblings. In this case T must be a subclass of Observer.


Constructor & Destructor Documentation

template<class T >
Qtilities::Core::ConstSubjectIterator< T >::ConstSubjectIterator ( const T *  subject,
Observer observer = 0,
int  iterator_id = -1 
)
inline

Default constructor.

Parameters:
subjectThe current subject where your iterator must start.
observerThis is an optional parameter which is needed when your subject is observed in multiple contexts. In that case, the observer must be specified in order to know which observer parent to use.
iterator_idInternal iterator ID. You should never use this directly.
template<class T >
Qtilities::Core::ConstSubjectIterator< T >::ConstSubjectIterator ( const Observer observer,
ObserverIterationLevel  iteration_level,
const Observer sibling_iteration_parent_observer = 0,
int  iterator_id = -1 
)
inline

Observer based constructor.

Parameters:
observerThe observer that must be used in cases where multiple subjects have multiple parents.
iteration_levelIndicates on which level the observer must be interated.
sibling_iteration_parent_observerWhen interating over siblings of an obsever (iteration_level = IterateSiblings), *it is necessary to specify the parent of the siblings you are iterating when any of the siblings has multiple parents.
iterator_idInternal iterator ID. You should never use this directly.


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé