Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. listit.hxx
  5. Abstract:
  6. This is an implementation of iterator for LIST.
  7. Environment:
  8. ULIB, User Mode
  9. --*/
  10. #if ! defined( _LIST_ITERATOR_ )
  11. #define _LIST_ITERATOR_
  12. #include "iterator.hxx"
  13. #include "list.hxx"
  14. DECLARE_CLASS( LIST_ITERATOR );
  15. class LIST_ITERATOR : public ITERATOR {
  16. FRIEND class LIST;
  17. public:
  18. DECLARE_CONSTRUCTOR( LIST_ITERATOR );
  19. DECLARE_CAST_MEMBER_FUNCTION( LIST_ITERATOR );
  20. NONVIRTUAL
  21. BOOLEAN
  22. Initialize(
  23. IN PCLIST List
  24. );
  25. VIRTUAL
  26. VOID
  27. Reset(
  28. );
  29. VIRTUAL
  30. POBJECT
  31. GetCurrent(
  32. );
  33. VIRTUAL
  34. POBJECT
  35. GetNext(
  36. );
  37. VIRTUAL
  38. POBJECT
  39. GetPrevious(
  40. );
  41. private:
  42. POBJECT_LIST_NODE _current;
  43. PCLIST _list;
  44. NONVIRTUAL
  45. VOID
  46. Construct(
  47. );
  48. };
  49. INLINE
  50. VOID
  51. LIST_ITERATOR::Construct(
  52. )
  53. /*++
  54. Routine Description:
  55. This routine resets LIST_ITERATOR.
  56. Arguments:
  57. None.
  58. Return Value:
  59. None.
  60. --*/
  61. {
  62. _current = NULL;
  63. _list = NULL;
  64. }
  65. INLINE
  66. BOOLEAN
  67. LIST_ITERATOR::Initialize(
  68. IN PCLIST List
  69. )
  70. {
  71. DebugAssert(List);
  72. _list = List;
  73. return TRUE;
  74. }
  75. #endif // _LIST_ITERATOR_