Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
QMapIterator< K, T > Class Template Reference

#include <qmap.h>

Public Types

typedef QMapNode< K, T > * NodePtr
 

Public Member Functions

 QMapIterator ()
 
 QMapIterator (QMapNode< K, T > *p)
 
 QMapIterator (const QMapIterator< K, T > &it)
 
bool operator== (const QMapIterator< K, T > &it) const
 
bool operator!= (const QMapIterator< K, T > &it) const
 
T & operator* ()
 
const T & operator* () const
 
const K & key () const
 
T & data ()
 
const T & data () const
 
QMapIterator< K, T > & operator++ ()
 
QMapIterator< K, T > operator++ (int)
 
QMapIterator< K, T > & operator-- ()
 
QMapIterator< K, T > operator-- (int)
 

Public Attributes

QMapNode< K, T > * node
 

Private Member Functions

int inc ()
 
int dec ()
 

Detailed Description

template<class K, class T>
class QMapIterator< K, T >

Definition at line 86 of file qmap.h.

Member Typedef Documentation

template<class K, class T>
typedef QMapNode< K, T >* QMapIterator< K, T >::NodePtr

Typedefs

Definition at line 92 of file qmap.h.

Constructor & Destructor Documentation

template<class K, class T>
QMapIterator< K, T >::QMapIterator ( )
inline

Functions

Definition at line 102 of file qmap.h.

102 : node( 0 ) {}
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
QMapIterator< K, T >::QMapIterator ( QMapNode< K, T > *  p)
inline

Definition at line 103 of file qmap.h.

103 : node( p ) {}
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
QMapIterator< K, T >::QMapIterator ( const QMapIterator< K, T > &  it)
inline

Definition at line 104 of file qmap.h.

104 : node( it.node ) {}
QMapNode< K, T > * node
Definition: qmap.h:97

Member Function Documentation

template<class K, class T>
T& QMapIterator< K, T >::data ( )
inline

Definition at line 115 of file qmap.h.

115 { return node->data; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
const T& QMapIterator< K, T >::data ( ) const
inline

Definition at line 116 of file qmap.h.

116 { return node->data; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
int QMapIterator< K, T >::dec ( )
inlineprivate

Definition at line 138 of file qmap.h.

138  {
139  QMapNodeBase* tmp = node;
140  if (tmp->color == QMapNodeBase::Red &&
141  tmp->parent->parent == tmp ) {
142  tmp = tmp->right;
143  } else if (tmp->left != 0) {
144  QMapNodeBase* y = tmp->left;
145  while ( y->right )
146  y = y->right;
147  tmp = y;
148  } else {
149  QMapNodeBase* y = tmp->parent;
150  while (tmp == y->left) {
151  tmp = y;
152  y = y->parent;
153  }
154  tmp = y;
155  }
156  node = (NodePtr)tmp;
157  return 0;
158  }
QMapNodeBase * left
Definition: qmap.h:51
QMapNodeBase * parent
Definition: qmap.h:53
QMapNode< K, T > * node
Definition: qmap.h:97
string tmp
Definition: languages.py:63
QMapNodeBase * right
Definition: qmap.h:52
Color color
Definition: qmap.h:55
QMapNode< K, T > * NodePtr
Definition: qmap.h:92
template<class K, class T>
int QMapIterator< K, T >::inc ( )
inlineprivate

Definition at line 119 of file qmap.h.

119  {
120  QMapNodeBase* tmp = node;
121  if ( tmp->right ) {
122  tmp = tmp->right;
123  while ( tmp->left )
124  tmp = tmp->left;
125  } else {
126  QMapNodeBase* y = tmp->parent;
127  while (tmp == y->right) {
128  tmp = y;
129  y = y->parent;
130  }
131  if (tmp->right != y)
132  tmp = y;
133  }
134  node = (NodePtr)tmp;
135  return 0;
136  }
QMapNodeBase * left
Definition: qmap.h:51
QMapNodeBase * parent
Definition: qmap.h:53
QMapNode< K, T > * node
Definition: qmap.h:97
string tmp
Definition: languages.py:63
QMapNodeBase * right
Definition: qmap.h:52
QMapNode< K, T > * NodePtr
Definition: qmap.h:92
template<class K, class T>
const K& QMapIterator< K, T >::key ( ) const
inline

Definition at line 114 of file qmap.h.

114 { return node->key; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
bool QMapIterator< K, T >::operator!= ( const QMapIterator< K, T > &  it) const
inline

Definition at line 107 of file qmap.h.

107 { return node != it.node; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
T& QMapIterator< K, T >::operator* ( )
inline

Definition at line 108 of file qmap.h.

108 { return node->data; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
const T& QMapIterator< K, T >::operator* ( ) const
inline

Definition at line 109 of file qmap.h.

109 { return node->data; }
QMapNode< K, T > * node
Definition: qmap.h:97
template<class K, class T>
QMapIterator<K,T>& QMapIterator< K, T >::operator++ ( )
inline

Definition at line 161 of file qmap.h.

161  {
162  inc();
163  return *this;
164  }
int inc()
Definition: qmap.h:119
template<class K, class T>
QMapIterator<K,T> QMapIterator< K, T >::operator++ ( int  )
inline

Definition at line 166 of file qmap.h.

166  {
167  QMapIterator<K,T> tmp = *this;
168  inc();
169  return tmp;
170  }
int inc()
Definition: qmap.h:119
string tmp
Definition: languages.py:63
template<class K, class T>
QMapIterator<K,T>& QMapIterator< K, T >::operator-- ( )
inline

Definition at line 172 of file qmap.h.

172  {
173  dec();
174  return *this;
175  }
int dec()
Definition: qmap.h:138
template<class K, class T>
QMapIterator<K,T> QMapIterator< K, T >::operator-- ( int  )
inline

Definition at line 177 of file qmap.h.

177  {
178  QMapIterator<K,T> tmp = *this;
179  dec();
180  return tmp;
181  }
string tmp
Definition: languages.py:63
int dec()
Definition: qmap.h:138
template<class K, class T>
bool QMapIterator< K, T >::operator== ( const QMapIterator< K, T > &  it) const
inline

Definition at line 106 of file qmap.h.

106 { return node == it.node; }
QMapNode< K, T > * node
Definition: qmap.h:97

Member Data Documentation

template<class K, class T>
QMapNode<K,T>* QMapIterator< K, T >::node

Variables

Definition at line 97 of file qmap.h.


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