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 869 of file C4ObjectList.cpp.

References C4ObjectList::RemoveIter().

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

Here is the call graph for this function:

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

Definition at line 864 of file C4ObjectList.cpp.

References C4ObjectList::AddIter().

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

Here is the call graph for this function:

Member Function Documentation

bool C4ObjectList::iterator::advance ( )

Definition at line 929 of file C4ObjectList.cpp.

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

Definition at line 917 of file C4ObjectList.cpp.

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

Definition at line 901 of file C4ObjectList.cpp.

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

Definition at line 896 of file C4ObjectList.cpp.

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

Definition at line 885 of file C4ObjectList.cpp.

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

Definition at line 873 of file C4ObjectList.cpp.

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

Referenced by operator++().

874 {
875  C4ObjectLink* advance = reverse ? link.Prev : link.Next;
876  link = advance ? *advance : NULL_LINK;
877  return *this;
878 }
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 879 of file C4ObjectList.cpp.

References operator++().

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

Here is the call graph for this function:

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

Definition at line 935 of file C4ObjectList.cpp.

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

Definition at line 889 of file C4ObjectList.cpp.

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

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

Here is the call graph for this function:

bool C4ObjectList::iterator::reset ( )

Definition at line 922 of file C4ObjectList.cpp.

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

923 {
924  C4ObjectLink* l = reverse ? List.Last : List.First;
925  link = l ? *l : NULL_LINK;
926  return !atEnd();
927 }
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: