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.

178 lines
4.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 2000.
  5. //
  6. // File: Cursor.Hxx
  7. //
  8. // Contents: Cursor classes
  9. //
  10. // Classes: CCursor - 'The mother of all cursors'
  11. //
  12. // History: 15-Apr-91 KyleP Created.
  13. // 26-Sep-91 BartoszM Rewrote
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. #ifdef DISPLAY_INCLUDES
  18. #pragma message( "#include <" __FILE__ ">..." )
  19. #endif
  20. #define rankInvalid (MAX_QUERY_RANK+1)
  21. //+---------------------------------------------------------------------------
  22. //
  23. // Class: CCursor
  24. //
  25. // Purpose: The root class for all cursors
  26. //
  27. // Interface:
  28. //
  29. // History: 15-Apr-91 KyleP Created.
  30. // 26-Sep-91 BartoszM Rewrote
  31. // 26-Feb-92 AmyA Added HitCount().
  32. // 13-Mar-92 AmyA Added Rank().
  33. //
  34. //----------------------------------------------------------------------------
  35. class CCursor
  36. {
  37. public:
  38. CCursor ( INDEXID iid, PROPID pid );
  39. CCursor ( INDEXID iid );
  40. CCursor ();
  41. virtual ~CCursor();
  42. INDEXID IndexId ();
  43. PROPID Pid ();
  44. virtual ULONG WorkIdCount();
  45. virtual WORKID WorkId() = 0;
  46. virtual WORKID NextWorkId() = 0;
  47. virtual ULONG HitCount() = 0;
  48. virtual LONG Rank() = 0;
  49. LONG GetWeight() { return _weight; }
  50. void SetWeight(LONG wt) { _weight = wt; }
  51. virtual ULONG GetRankVector( LONG * plVector, ULONG cElements );
  52. virtual LONG Hit() { return rankInvalid; }
  53. virtual LONG NextHit() { return rankInvalid; }
  54. virtual BOOL IsEmpty() { return WorkId() == widInvalid; }
  55. virtual void RatioFinished ( ULONG& denom, ULONG& num ) = 0;
  56. BOOL IsUnfilteredOnly() const
  57. {
  58. return _fUnfilteredOnly;
  59. }
  60. void SetUnfilteredOnly( BOOL fUnfilteredOnly = TRUE )
  61. {
  62. _fUnfilteredOnly = fUnfilteredOnly;
  63. }
  64. #ifdef CIEXTMODE
  65. void CiExtDump(void *ciExtSelf);
  66. #endif
  67. protected:
  68. PROPID _pid;
  69. INDEXID _iid;
  70. LONG _weight;
  71. BOOL _fUnfilteredOnly;
  72. };
  73. DECLARE_SMARTP( Cursor )
  74. //+---------------------------------------------------------------------------
  75. //
  76. // Member: CCursor::CCursor, public
  77. //
  78. // Synopsis:
  79. //
  80. // Arguments: [iid] -- index id
  81. // [pid] -- property id
  82. //
  83. // History: 27-Sep-91 BartoszM Created.
  84. // 23-Jun-92 MikeHew Added weight initialization.
  85. //
  86. //----------------------------------------------------------------------------
  87. inline CCursor::CCursor ( INDEXID iid, PROPID pid )
  88. : _iid(iid), _pid(pid), _weight(MAX_QUERY_RANK), _fUnfilteredOnly( FALSE )
  89. {}
  90. //+---------------------------------------------------------------------------
  91. //
  92. // Member: CCursor::CCursor, public
  93. //
  94. // Synopsis:
  95. //
  96. // Arguments: [iid] -- index id
  97. //
  98. // History: 27-Sep-91 BartoszM Created.
  99. // 23-Jun-92 MikeHew Added weight initialization.
  100. //
  101. //----------------------------------------------------------------------------
  102. inline CCursor::CCursor ( INDEXID iid )
  103. : _iid(iid), _weight(MAX_QUERY_RANK), _fUnfilteredOnly( FALSE ), _pid( pidInvalid )
  104. {}
  105. //+---------------------------------------------------------------------------
  106. //
  107. // Member: CCursor::CCursor, public
  108. //
  109. // History: 27-Sep-91 BartoszM Created.
  110. // 23-Jun-92 MikeHew Added weight initialization.
  111. //
  112. //----------------------------------------------------------------------------
  113. inline CCursor::CCursor ()
  114. : _weight(MAX_QUERY_RANK), _fUnfilteredOnly( FALSE ), _pid( pidInvalid )
  115. {}
  116. //+---------------------------------------------------------------------------
  117. //
  118. // Member: CCursor::~CCursor, public
  119. //
  120. // History: 27-Sep-91 BartoszM Created.
  121. //
  122. //----------------------------------------------------------------------------
  123. inline CCursor::~CCursor() { };
  124. //+---------------------------------------------------------------------------
  125. //
  126. // Member: CCursor::IndexId, public
  127. //
  128. // History: 27-Sep-91 BartoszM Created.
  129. //
  130. //----------------------------------------------------------------------------
  131. inline INDEXID CCursor::IndexId () { return _iid; }
  132. //+---------------------------------------------------------------------------
  133. //
  134. // Member: CCursor::Pid, public
  135. //
  136. // Returns: The property id of the current property
  137. //
  138. // History: 27-Sep-91 BartoszM Created.
  139. //
  140. //----------------------------------------------------------------------------
  141. inline PROPID CCursor::Pid () { return _pid; }