Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UnitCollection::ConstIterator Class Reference

#include <collection.h>

Public Member Functions

 ConstIterator ()
 
 ConstIterator (const ConstIterator &)
 
 ConstIterator (const UnitCollection *)
 
 ~ConstIterator ()
 
ConstIteratoroperator= (const ConstIterator &orig)
 
Unitnext ()
 
bool isDone ()
 
bool notDone ()
 
void advance ()
 
const ConstIteratoroperator++ ()
 
const ConstIterator operator++ (int)
 
Unitoperator* () const
 
 ConstIterator ()
 
 ConstIterator (const ConstIterator &orig)
 
 ConstIterator (const UnitListNode *start)
 
ConstIteratoroperator= (const ConstIterator &orig)
 
 ~ConstIterator ()
 
const Unitnext ()
 
const Unitcurrent () const
 
bool isDone () const
 
bool notDone () const
 
void advance ()
 
const Unitoperator++ ()
 
const Unitoperator++ (int)
 
const Unitoperator* () const
 

Protected Attributes

const UnitCollectioncol
 
std::list< class Unit * >
::const_iterator 
it
 

Friends

class UnitCollection
 

Detailed Description

Definition at line 109 of file collection.h.

Constructor & Destructor Documentation

UnitCollection::ConstIterator::ConstIterator ( )
inline

Definition at line 112 of file collection.h.

112 : col( NULL ) {}
UnitCollection::ConstIterator::ConstIterator ( const ConstIterator orig)

Definition at line 120 of file collection.cpp.

References col, and it.

121 {
122  col = orig.col;
123  it = orig.it;
124 }
UnitCollection::ConstIterator::ConstIterator ( const UnitCollection orig)

Definition at line 126 of file collection.cpp.

127 {
128  col = orig;
129  for (it = orig->u.begin(); it != col->u.end(); ++it)
130  if (*it)
131  break;
132 }
UnitCollection::ConstIterator::~ConstIterator ( )

Definition at line 134 of file collection.cpp.

135 {}
UnitCollection::ConstIterator::ConstIterator ( )
inline

Definition at line 138 of file oldcollection.h.

138 : ConstIterator() : pos( NULL ) {}
UnitCollection::ConstIterator::ConstIterator ( const ConstIterator orig)
inline

Definition at line 139 of file oldcollection.h.

139 : pos( orig.pos ) {}
UnitCollection::ConstIterator::ConstIterator ( const UnitListNode *  start)
inline

Definition at line 140 of file oldcollection.h.

140  : pos( start )
141  {
142  GetNextValidUnit();
143  }
UnitCollection::ConstIterator::~ConstIterator ( )
inline

Definition at line 149 of file oldcollection.h.

150  {
151  pos = NULL;
152  }

Member Function Documentation

void UnitCollection::ConstIterator::advance ( )
inline

Definition at line 145 of file collection.cpp.

Referenced by next(), and operator++().

146 {
147  if ( !col || it == col->u.end() ) return;
148  ++it;
149  while ( it != col->u.end() ) {
150  if ( (*it) == NULL )
151  ++it;
152  else if ( (*it)->Killed() )
153  ++it;
154  else
155  break;
156  }
157 }
void UnitCollection::ConstIterator::advance ( )
inline

Definition at line 170 of file oldcollection.h.

171  {
172  pos = pos->next;
173  GetNextValidUnit();
174  }
const Unit* UnitCollection::ConstIterator::current ( ) const
inline

Definition at line 158 of file oldcollection.h.

Referenced by isDone(), next(), notDone(), operator*(), and operator++().

159  {
160  return pos->next->unit;
161  }
bool UnitCollection::ConstIterator::isDone ( )
inline

Definition at line 118 of file collection.h.

References col, and it.

Referenced by notDone().

119  {
120  if ( col && it != col->u.end() )
121  return false;
122  return true;
123  }
bool UnitCollection::ConstIterator::isDone ( ) const
inline

Definition at line 162 of file oldcollection.h.

References current().

163  {
164  return current() == NULL;
165  }
Unit * UnitCollection::ConstIterator::next ( )

Definition at line 137 of file collection.cpp.

138 {
139  advance();
140  if ( col && it != col->u.end() )
141  return *it;
142  return NULL;
143 }
const Unit* UnitCollection::ConstIterator::next ( )
inline

Definition at line 153 of file oldcollection.h.

References advance(), and current().

154  {
155  advance();
156  return current();
157  }
bool UnitCollection::ConstIterator::notDone ( )
inline

Definition at line 124 of file collection.h.

References isDone().

125  {
126  return !isDone();
127  }
bool UnitCollection::ConstIterator::notDone ( ) const
inline

Definition at line 166 of file oldcollection.h.

References current().

167  {
168  return current() != NULL;
169  }
Unit* UnitCollection::ConstIterator::operator* ( ) const
inline

Definition at line 131 of file collection.h.

References col, UnitCollection::empty(), and it.

132  {
133  if ( it != col->u.end() && !col->empty() ) return *it;
134  return NULL;
135  }
const Unit* UnitCollection::ConstIterator::operator* ( ) const
inline

Definition at line 186 of file oldcollection.h.

References current().

187  {
188  return current();
189  }
const UnitCollection::ConstIterator & UnitCollection::ConstIterator::operator++ ( )

Definition at line 159 of file collection.cpp.

160 {
161  advance();
162  return *this;
163 }
const UnitCollection::ConstIterator UnitCollection::ConstIterator::operator++ ( int  )

Definition at line 165 of file collection.cpp.

166 {
167  UnitCollection::ConstIterator tmp( *this );
168  advance();
169  return tmp;
170 }
const Unit* UnitCollection::ConstIterator::operator++ ( )
inline

Definition at line 175 of file oldcollection.h.

References advance(), and current().

176  {
177  advance();
178  return current();
179  }
const Unit* UnitCollection::ConstIterator::operator++ ( int  )
inline

Definition at line 180 of file oldcollection.h.

References advance(), and current().

181  {
182  const Unit *un = current();
183  advance();
184  return un;
185  }
UnitCollection::ConstIterator & UnitCollection::ConstIterator::operator= ( const ConstIterator orig)

Definition at line 113 of file collection.cpp.

References col, and it.

114 {
115  col = orig.col;
116  it = orig.it;
117  return *this;
118 }
ConstIterator& UnitCollection::ConstIterator::operator= ( const ConstIterator orig)
inline

Definition at line 144 of file oldcollection.h.

145  {
146  pos = orig.pos;
147  return *this;
148  }

Friends And Related Function Documentation

friend class UnitCollection
friend

Definition at line 137 of file collection.h.

Member Data Documentation

const UnitCollection* UnitCollection::ConstIterator::col
protected

Definition at line 138 of file collection.h.

Referenced by ConstIterator(), isDone(), operator*(), and operator=().

std::list< class Unit* >::const_iterator UnitCollection::ConstIterator::it
protected

Definition at line 139 of file collection.h.

Referenced by ConstIterator(), isDone(), operator*(), and operator=().


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