Index: trunk/src/lib/util/ini_parser.cc
===================================================================
--- trunk/src/lib/util/ini_parser.cc	(revision 5113)
+++ trunk/src/lib/util/ini_parser.cc	(revision 5115)
@@ -58,9 +58,9 @@
   {
     tIterator<IniSection>* sectionIt = this->sections->getIterator();
-    IniSection* sectionEnum = sectionIt->nextElement();
+    IniSection* sectionEnum = sectionIt->firstElement();
     while (sectionEnum)
     {
       tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
-      IniEntry* entryEnum = entryIt->nextElement();
+      IniEntry* entryEnum = entryIt->firstElement();
       while (entryEnum)
       {
@@ -192,5 +192,5 @@
     {
       tIterator<IniSection>* sectionIt = this->sections->getIterator();
-      IniSection* sectionEnum = sectionIt->nextElement();
+      IniSection* sectionEnum = sectionIt->firstElement();
       while (sectionEnum)
       {
@@ -198,5 +198,5 @@
 
         tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
-        IniEntry* entryEnum = entryIt->nextElement();
+        IniEntry* entryEnum = entryIt->firstElement();
         while (entryEnum)
         {
@@ -246,5 +246,5 @@
 {
   tIterator<IniSection>* sectionIt = this->sections->getIterator();
-  IniSection* sectionEnum = sectionIt->nextElement();
+  IniSection* sectionEnum = sectionIt->firstElement();
   while (sectionEnum)
   {
@@ -347,5 +347,5 @@
   {
     tIterator<IniSection>* sectionIt = this->sections->getIterator();
-    IniSection* sectionEnum = sectionIt->nextElement();
+    IniSection* sectionEnum = sectionIt->firstElement();
     while (sectionEnum)
     {
@@ -395,5 +395,5 @@
   {
     tIterator<IniSection>* sectionIt = this->sections->getIterator();
-    IniSection* sectionEnum = sectionIt->nextElement();
+    IniSection* sectionEnum = sectionIt->firstElement();
     while (sectionEnum)
     {
@@ -401,5 +401,5 @@
       {
         tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
-        IniEntry* entryEnum = entryIt->nextElement();
+        IniEntry* entryEnum = entryIt->firstElement();
         while (entryEnum)
         {
@@ -452,5 +452,5 @@
   {
     tIterator<IniSection>* sectionIt = this->sections->getIterator();
-    IniSection* sectionEnum = sectionIt->nextElement();
+    IniSection* sectionEnum = sectionIt->firstElement();
     while (sectionEnum)
     {
@@ -458,5 +458,5 @@
 
       tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
-      IniEntry* entryEnum = entryIt->nextElement();
+      IniEntry* entryEnum = entryIt->firstElement();
       while (entryEnum)
       {
Index: trunk/src/lib/util/list.h
===================================================================
--- trunk/src/lib/util/list.h	(revision 5113)
+++ trunk/src/lib/util/list.h	(revision 5115)
@@ -12,5 +12,5 @@
 #endif
 
-
+template<class T> class tIterator;
 
 //! a list element of the tList,
@@ -23,101 +23,4 @@
 
 /**
- *  an iterator class
-
-   this enables the user to iterate through a list very easely
-*/
-template<class T> class tIterator
-{
- public:
-  tIterator(listElement<T>* startElement);
-  ~tIterator();
-
-  T* nextElement();
-  T* seekElement(T* element);
-
- private:
-  listElement<T>*    currentEl;                      //!< pointer to the current list element in the iterator
-  listElement<T>*    tmpEl;                          //!< temp listElemnt pointer
-  listElement<T>*    startElement;                   //!< pointer to the start of the list
-};
-
-
-/**
- *  iterator constructor
- * @param startElement:  the first list element from the tList
-
-   normaly you will use it like this:
-
-   tIterator<char>* nameIterator = nameList->getIterator();
-   char name* = nameIterator->nextElement();
-   while( name != NULL)
-   {
-     PRINTF(3)("found name: %s in list\n", name);
-     name = nameIterator->nextElement();
-   }
-   delete nameIterator;
-*/
-template<class T>
-inline tIterator<T>::tIterator (listElement<T>* startElement)
-{
-  this->currentEl = startElement;
-  this->tmpEl = NULL;
-  this->startElement = startElement;
-}
-
-
-/**
- *  the destructor
-*/
-template<class T>
-inline tIterator<T>::~tIterator ()
-{
-  this->currentEl = NULL;
-}
-
-
-/**
- *  use it to iterate through the list
- * @returns next list element
-*/
-template<class T>
-inline T* tIterator<T>::nextElement ()
-{
-  if( this->currentEl == NULL)
-    return NULL;
-
-  this->tmpEl = this->currentEl;
-  this->currentEl = this->currentEl->next;
-  return this->tmpEl->curr;
-}
-
-/**
- *  gets the element after the selected one, sets the iterator to this point in the list
- * @param element the element to seek
- * @returns next list element
-
-  Attention: if you seek an element, the iterator pointer will point to the NEXT listelement after the argument!
- */
-template<class T>
-inline T* tIterator<T>::seekElement (T* element)
-{
-  for(this->tmpEl = this->startElement; this->tmpEl != NULL; this->tmpEl = this->tmpEl->next)
-  {
-    if( unlikely(this->tmpEl->curr == element))
-    {
-      if( this->tmpEl->next != NULL)
-      {
-        this->currentEl = this->tmpEl->next->next;
-        return this->tmpEl->next->curr;
-      }
-      return NULL;
-    }
-  }
-  return NULL;
-}
-
-
-
-/**
  *  the list template class
 
@@ -126,4 +29,6 @@
 template<class T> class tList
 {
+  friend class tIterator<T>;
+
  public:
   tList ();
@@ -374,6 +279,5 @@
 inline tIterator<T>* tList<T>::getIterator() const
 {
-  tIterator<T>* iterator = new tIterator<T>(this->first);
-  return iterator;
+  return new tIterator<T>(this);
 }
 
@@ -414,3 +318,142 @@
 }
 
+
+
+
+/**
+ *  an iterator class
+
+   this enables the user to iterate through a list very easely
+ */
+template<class T> class tIterator
+{
+  public:
+    tIterator(const tList<T>* list);
+    ~tIterator();
+
+    T* firstElement();
+    T* nextElement();
+    T* seekElement(T* element);
+    T* iteratorElement(const tIterator<T>* iterator);
+
+  private:
+    listElement<T>*    currentEl;                      //!< pointer to the current list element in the iterator
+    listElement<T>*    tmpEl;                          //!< temp listElemnt pointer
+    const tList<T>*    list;                           //!< The List, that we want to iterate through
+};
+
+
+/**
+ *  iterator constructor
+ * @param startElement:  the first list element from the tList
+ *
+ * normaly you will use it like this:
+ **********************************************************
+ * tIterator<char>* nameIterator = nameList->getIterator();
+ * char name* = nameIterator->firstElement();
+ * while( name != NULL)
+ *  {
+ *   PRINTF(3)("found name: %s in list\n", name);
+ *   name = nameIterator->nextElement();
+ *  }
+ * delete nameIterator;
+ * ********************************************************
+ */
+template<class T>
+  inline tIterator<T>::tIterator (const tList<T>* list)
+{
+  this->currentEl = list->first;
+  this->tmpEl = NULL;
+  this->list = list;
+}
+
+
+/**
+ *  the destructor
+ */
+template<class T>
+    inline tIterator<T>::~tIterator ()
+{
+  this->currentEl = NULL;
+}
+
+template<class T>
+    inline T* tIterator<T>::firstElement ()
+{
+  this->currentEl = this->list->first;
+  if (this->currentEl == NULL)
+    return NULL;
+  else
+    return this->currentEl->curr;
+}
+
+
+/**
+ *  use it to iterate through the list
+ * @returns next list element
+ */
+template<class T>
+    inline T* tIterator<T>::nextElement ()
+{
+  if( this->currentEl == NULL)
+    return NULL;
+
+  this->currentEl = this->currentEl->next;
+  if (this->currentEl != NULL)
+    return this->currentEl->curr;
+  else
+    return NULL;
+}
+
+/**
+ *  gets the element after the selected one, sets the iterator to this point in the list
+ * @param element the element to seek
+ * @returns current list element
+ */
+template<class T>
+    inline T* tIterator<T>::seekElement (T* element)
+{
+  if (element == NULL)
+  {
+    this->currentEl = NULL;
+    return NULL;
+  }
+  this->tmpEl = this->list->first;
+  while( this->tmpEl != NULL)
+  {
+    if( unlikely(this->tmpEl->curr == element))
+    {
+      this->currentEl = this->tmpEl;
+      return this->currentEl->curr;
+    }
+    this->tmpEl = this->tmpEl->next;
+  }
+  this->currentEl = NULL;
+  return NULL;
+}
+
+/**
+ * grabs the iterator entity from another iterator
+ * @param iterator the iterator to grab the local currentEl from
+ * @returns the grabbed element (current).
+ */
+template<class T>
+    T* tIterator<T>::iteratorElement(const tIterator<T>* iterator)
+{
+  if (iterator != NULL)
+  {
+    this->currentEl = iterator->currentEl;
+    if (this->currentEl != NULL)
+      return this->currentEl->curr;
+    else
+      return NULL;
+  }
+  else
+  {
+    this->currentEl = NULL;
+    return NULL;
+  }
+}
+
+
 #endif /* _LIST_H */
