OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ObjectList::iterator Class Reference

#include <C4ObjectList.h>

Public Member Functions

 ~iterator ()
 
iteratoroperator++ ()
 
iterator operator++ (int)
 
 iterator (const iterator &iter)
 
C4Objectoperator* ()
 
bool operator== (const iterator &iter) const
 
bool operator!= (const iterator &iter) const
 
bool find (C4Object *target)
 
bool atEnd () const
 
bool advance ()
 
bool reset ()
 
iteratoroperator= (const iterator &iter)
 

Friends

class C4ObjectList
 

Detailed Description

Definition at line 58 of file C4ObjectList.h.

Constructor & Destructor Documentation

C4ObjectList::iterator::~iterator ( )

Definition at line 868 of file C4ObjectList.cpp.

References C4ObjectList::RemoveIter().

869 {
870  List.RemoveIter(this);
871 }
void RemoveIter(iterator *iter) const

Here is the call graph for this function:

C4ObjectList::iterator::iterator ( const iterator iter)

Definition at line 863 of file C4ObjectList.cpp.

References C4ObjectList::AddIter().

863  :
864  List(iter.List), link(iter.link), Next(), reverse(iter.reverse)
865 {
866  Next=List.AddIter(this);
867 }
iterator * AddIter(iterator *iter) const

Here is the call graph for this function:

Member Function Documentation

bool C4ObjectList::iterator::advance ( )

Definition at line 928 of file C4ObjectList.cpp.

929 {
930  (*this)++;
931  return !atEnd();
932 }
bool C4ObjectList::iterator::atEnd ( ) const

Definition at line 916 of file C4ObjectList.cpp.

917 {
918  return link.Obj == nullptr;
919 }
C4Object * Obj
Definition: C4ObjectList.h:28
bool C4ObjectList::iterator::find ( C4Object target)

Definition at line 900 of file C4ObjectList.cpp.

901 {
902  while (link.Obj)
903  {
904  if (link.Obj == target)
905  {
906  return true;
907  }
908  else
909  {
910  (*this)++;
911  }
912  }
913  return false;
914 }
C4Object * Obj
Definition: C4ObjectList.h:28
bool C4ObjectList::iterator::operator!= ( const iterator iter) const

Definition at line 895 of file C4ObjectList.cpp.

896 {
897  return !(*this == iter);
898 }
C4Object * C4ObjectList::iterator::operator* ( )

Definition at line 884 of file C4ObjectList.cpp.

885 {
886  return link.Obj;
887 }
C4Object * Obj
Definition: C4ObjectList.h:28
C4ObjectList::iterator & C4ObjectList::iterator::operator++ ( )

Definition at line 872 of file C4ObjectList.cpp.

References C4ObjectLink::Next, and C4ObjectLink::Prev.

Referenced by operator++().

873 {
874  C4ObjectLink* advance = reverse ? link.Prev : link.Next;
875  link = advance ? *advance : NULL_LINK;
876  return *this;
877 }
C4ObjectLink * Next
Definition: C4ObjectList.h:29
C4ObjectLink * Prev
Definition: C4ObjectList.h:29

Here is the caller graph for this function:

C4ObjectList::iterator C4ObjectList::iterator::operator++ ( int  )

Definition at line 878 of file C4ObjectList.cpp.

References operator++().

879 {
880  iterator old = *this;
882  return old;
883 }
iterator(const iterator &iter)

Here is the call graph for this function:

C4ObjectList::iterator & C4ObjectList::iterator::operator= ( const iterator iter)

Definition at line 934 of file C4ObjectList.cpp.

935 {
936  // Can only assign iterators into the same list
937  assert(&iter.List == &List);
938 
939  link = iter.link;
940  reverse = iter.reverse;
941  return *this;
942 }
bool C4ObjectList::iterator::operator== ( const iterator iter) const

Definition at line 888 of file C4ObjectList.cpp.

References C4ObjectLink::Obj, and C4ObjectList::reverse().

889 {
890  return
891  &iter.List == &List &&
892  iter.link.Obj == link.Obj /* checking for same object should be enough */ &&
893  iter.reverse == reverse;
894 }
C4Object * Obj
Definition: C4ObjectList.h:28

Here is the call graph for this function:

bool C4ObjectList::iterator::reset ( )

Definition at line 921 of file C4ObjectList.cpp.

References C4ObjectList::First, and C4ObjectList::Last.

922 {
923  C4ObjectLink* l = reverse ? List.Last : List.First;
924  link = l ? *l : NULL_LINK;
925  return !atEnd();
926 }
C4ObjectLink * First
Definition: C4ObjectList.h:51
C4ObjectLink * Last
Definition: C4ObjectList.h:51

Friends And Related Function Documentation

friend class C4ObjectList
friend

Definition at line 85 of file C4ObjectList.h.


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