Source code of Windows XP (NT5)
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.

121 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. arrayit.hxx
  5. Abstract:
  6. This module contains the declaration for the ARRAY_ITERATOR class.
  7. ARRAY_ITERATOR is a concrete implementation derived from the abstarct
  8. ITERATOR class. It is used to 'read' (iterate) over an ARRAY object.
  9. It has no public constructor and therefore can only be queried from an
  10. ARRAY object. It is the client's responsibility to detsroy
  11. ARRAY_ITERATORs when they are done. ARRAY_ITERATORs maintain the currency
  12. for reading an ARRAY in order.
  13. Environment:
  14. ULIB, User Mode
  15. --*/
  16. #if ! defined( _ARRAY_ITERATOR_ )
  17. #define _ARRAY_ITERATOR_
  18. #include "iterator.hxx"
  19. //
  20. // Forward references
  21. //
  22. DECLARE_CLASS( ARRAY );
  23. DECLARE_CLASS( ARRAY_ITERATOR );
  24. class ARRAY_ITERATOR : public ITERATOR {
  25. friend ARRAY;
  26. public:
  27. VIRTUAL
  28. ~ARRAY_ITERATOR(
  29. );
  30. VIRTUAL
  31. VOID
  32. Reset(
  33. );
  34. VIRTUAL
  35. POBJECT
  36. GetCurrent(
  37. );
  38. VIRTUAL
  39. POBJECT
  40. GetNext(
  41. );
  42. VIRTUAL
  43. POBJECT
  44. GetPrevious(
  45. );
  46. NONVIRTUAL
  47. ULONG
  48. QueryCurrentIndex(
  49. );
  50. protected:
  51. DECLARE_CAST_MEMBER_FUNCTION( ARRAY_ITERATOR );
  52. DECLARE_CONSTRUCTOR( ARRAY_ITERATOR );
  53. NONVIRTUAL
  54. BOOLEAN
  55. Initialize(
  56. IN OUT PARRAY Array
  57. );
  58. NONVIRTUAL
  59. VOID
  60. Construct(
  61. );
  62. private:
  63. PARRAY _Array; // Array
  64. ULONG _CurrentIndex; // Current index
  65. };
  66. INLINE
  67. ULONG
  68. ARRAY_ITERATOR::QueryCurrentIndex(
  69. )
  70. /*++
  71. Routine Description:
  72. Obtains the current index
  73. Arguments:
  74. None
  75. Return Value:
  76. ULONG - The current index
  77. --*/
  78. {
  79. return _CurrentIndex;
  80. }
  81. #endif // _ARRAY_ITERATOR_