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.

143 lines
3.7 KiB

  1. /*-----------------------------------------------------------------------------
  2. Microsoft Confidential
  3. Copyright 1995-2000 Microsoft Corporation. All Rights Reserved.
  4. Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
  5. Copyright (c) 1994
  6. Hewlett-Packard Company
  7. Permission to use, copy, modify, distribute and sell this
  8. software and its documentation for any purpose is hereby
  9. granted without fee, provided that the above copyright notice
  10. appear in all copies and that both that copyright notice and
  11. this permission notice appear in supporting documentation.
  12. Hewlett-Packard Company makes no representations about the
  13. suitability of this software for any purpose. It is provided
  14. "as is" without express or implied warranty.
  15. @doc external
  16. @module CFusionPointerIterator
  17. @owner a-JayK
  18. -----------------------------------------------------------------------------*/
  19. #if !defined(FUSION_INC_CPOINTER_ITERATOR_H_INCLUDED_) // {
  20. #define FUSION_INC_CPOINTER_ITERATOR_H_INCLUDED_
  21. #pragma once
  22. /*
  23. Name: CFusionPointerIterator
  24. @class
  25. This is copied from std::_Ptrit, and cleaned up.
  26. @hung i or it for iterator
  27. @owner a-JayK
  28. */
  29. template
  30. <
  31. typename T, // @tcarg the type pointed to
  32. typename Distance, // @tcarg usually ptrdiff_t, which is usually long or __int64
  33. typename Pointer, // @tcarg const or mutable
  34. typename Reference, // @tcarg const or mutable
  35. typename MutablePointer, // @tcarg never const
  36. typename MutableReference // @tcarg never const
  37. >
  38. class CFusionPointerIterator
  39. //FUTURE : public std::iterator<std::random_access_iterator_tag, T, Distance, Pointer, Reference>
  40. {
  41. public:
  42. // @cmember
  43. CFusionPointerIterator(Pointer p = Pointer()) throw();
  44. // @cmember
  45. CFusionPointerIterator
  46. (
  47. const CFusionPointerIterator
  48. <
  49. T,
  50. Distance,
  51. MutablePointer,
  52. MutableReference,
  53. MutablePointer,
  54. MutableReference
  55. >&
  56. ) throw();
  57. // @cmember
  58. Pointer PtBase() const throw();
  59. // @cmember
  60. Reference operator*() const throw();
  61. // @cmember
  62. Pointer operator->() const throw();
  63. // @cmember
  64. CFusionPointerIterator& operator++() throw();
  65. // @cmember
  66. CFusionPointerIterator operator++(int) throw();
  67. // @cmember
  68. CFusionPointerIterator& operator--() throw();
  69. // @cmember
  70. CFusionPointerIterator operator--(int) throw();
  71. // Why is this in xutility
  72. //bool operator==(int y) const throw();
  73. // @cmember
  74. bool operator==(const CFusionPointerIterator& y) const throw();
  75. // @cmember
  76. bool operator!=(const CFusionPointerIterator& y) const throw();
  77. // @cmember
  78. CFusionPointerIterator& operator+=(Distance n) throw();
  79. // @cmember
  80. CFusionPointerIterator operator+(Distance n) const throw();
  81. // @cmember
  82. CFusionPointerIterator& operator-=(Distance n) throw();
  83. // @cmember
  84. CFusionPointerIterator operator-(Distance n) const throw();
  85. // @cmember
  86. Reference operator[](Distance n) const throw();
  87. // @cmember
  88. // @cmember
  89. bool operator<(const CFusionPointerIterator& y) const throw();
  90. // @cmember
  91. bool operator>(const CFusionPointerIterator& y) const throw();
  92. // @cmember
  93. bool operator<=(const CFusionPointerIterator& y) const throw();
  94. // @cmember
  95. bool operator>=(const CFusionPointerIterator& y) const throw();
  96. // @cmember
  97. Distance operator-(const CFusionPointerIterator& y) const throw();
  98. protected:
  99. // @cmember
  100. Pointer m_current;
  101. };
  102. // @func
  103. template
  104. <
  105. typename T, // @tfarg
  106. typename Distance, // @tfarg
  107. typename Pointer, // @tfarg
  108. typename Reference, // @tfarg
  109. typename MutablePointer, // @tfarg
  110. typename MutableReference // @tfarg
  111. >
  112. inline CFusionPointerIterator<T, Distance, Pointer, Reference, MutablePointer, MutableReference>
  113. operator+
  114. (
  115. Distance n,
  116. const CFusionPointerIterator
  117. <
  118. T,
  119. Distance,
  120. Pointer,
  121. Reference,
  122. MutablePointer,
  123. MutableReference
  124. >&
  125. ) throw();
  126. #include "CFusionPointerIterator.inl"
  127. #endif // }