home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 8090 / ModelEdit.7z / ltwintreeitemiter.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-08  |  1.1 KB  |  51 lines

  1. #include "ltwintreeitemiter.h"
  2. #include "ltwintreeitem.h"
  3.  
  4. //allow the copying of iterators so that positions can be saved
  5. CLTWinTreeItemIter::CLTWinTreeItemIter(const CLTWinTreeItemIter& rhs)
  6. {
  7.     *this = rhs;
  8. }
  9.  
  10. //allow the copying of iterators so that positions can be saved
  11. const CLTWinTreeItemIter& CLTWinTreeItemIter::operator=(const CLTWinTreeItemIter& rhs)
  12. {
  13.     m_pCurrent = rhs.m_pCurrent;
  14.     return *this;
  15. }
  16.  
  17. //gets the item the iterator is currently on
  18. CLTWinTreeItem*    CLTWinTreeItemIter::Current()
  19. {
  20.     return m_pCurrent;
  21. }
  22.  
  23. //gets the next item in the list, and advances the iterator
  24. CLTWinTreeItem* CLTWinTreeItemIter::Next()
  25. {
  26.     if(m_pCurrent)
  27.     {
  28.         m_pCurrent = m_pCurrent->m_pNextSibling;
  29.     }
  30.     return m_pCurrent;
  31. }
  32.  
  33. //determines if there are any more items to iterate through
  34. BOOL CLTWinTreeItemIter::IsMore() const
  35. {
  36.     if(m_pCurrent)
  37.     {
  38.         return TRUE;
  39.     }
  40.     return FALSE;
  41. }
  42.  
  43. //make the constructor private so that only items
  44. //can create iterators, this prevents invalid iterators
  45. CLTWinTreeItemIter::CLTWinTreeItemIter(CLTWinTreeItem* pStart)
  46. {
  47.     m_pCurrent = pStart;
  48. }
  49.  
  50.  
  51.