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.

137 lines
3.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1994.
  5. //
  6. // File: tablecur.hxx
  7. //
  8. // Contents: Large table cursor definitions
  9. //
  10. // Classes: CTableCursor - basic table cursor
  11. // CTableCursorSet - a set of table cursors
  12. //
  13. // Functions:
  14. //
  15. // History:
  16. //
  17. //--------------------------------------------------------------------------
  18. #pragma once
  19. class CTableRowAlloc;
  20. class CPidRemapper;
  21. class CTableSource;
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Class: CTableCursor
  25. //
  26. // Purpose: A pointer into a large table. Also holds a copy of the
  27. // column bindings and associated data.
  28. //
  29. // Notes:
  30. //
  31. // History: 02 Jun 94 AlanW Created
  32. //
  33. //----------------------------------------------------------------------------
  34. class CTableCursor
  35. {
  36. friend class CTableCursorSet;
  37. public:
  38. CTableCursor( );
  39. ~CTableCursor( void );
  40. SCODE SetBindings(
  41. ULONG cbRowLength,
  42. XPtr<CTableColumnSet> & NewColumns
  43. );
  44. //
  45. // Accessor functions
  46. //
  47. USHORT GetRowWidth(void) const
  48. { return _cbRowWidth; }
  49. const CTableColumnSet & GetBindings(void) const {
  50. return _BoundColumns.GetReference();
  51. }
  52. void ValidateBindings() const
  53. {
  54. // this should only happen if we've been hacked
  55. if ( _BoundColumns.IsNull() )
  56. {
  57. Win4Assert( !"are we being hacked?" );
  58. THROW( CException( E_FAIL ) );
  59. }
  60. }
  61. void SetSource(CTableSource *pSource)
  62. { _pSource = pSource; }
  63. CTableSource & GetSource()
  64. { return *_pSource; }
  65. private:
  66. // Check that a binding is legal.
  67. SCODE _CheckBinding(
  68. CTableColumn const & rCol,
  69. CTableRowAlloc & rRowAlloc,
  70. USHORT maxRow
  71. );
  72. // Check that a set of bindings is legal.
  73. SCODE _CheckBindings(
  74. CTableColumnSet const & rCols,
  75. CTableRowAlloc & rRowAlloc,
  76. USHORT maxRow
  77. );
  78. USHORT _hUnique; // unique portion of handle matched
  79. // on external calls
  80. USHORT _cbRowWidth; // width of output row
  81. XPtr<CTableColumnSet> _BoundColumns; // Bound output column description
  82. CTableSource * _pSource; // source associated with cursor
  83. };
  84. //+---------------------------------------------------------------------------
  85. //
  86. // Class: CTableCursorSet
  87. //
  88. // Purpose: A collection of CTableCursors.
  89. //
  90. // Notes:
  91. //
  92. // History: 02 Jun 94 AlanW Created
  93. //
  94. //----------------------------------------------------------------------------
  95. DECL_DYNARRAY( CTableCursorArray, CTableCursor )
  96. class CTableCursorSet : public CTableCursorArray
  97. {
  98. public:
  99. CTableCursorSet(void):
  100. _hKeyGenerator(0),
  101. CTableCursorArray(1)
  102. {
  103. }
  104. ~CTableCursorSet(void);
  105. CTableCursor& Lookup(ULONG hCursor);
  106. void Add( CTableCursor * const pCursorIn,
  107. ULONG &rhCursor );
  108. SCODE Release(ULONG hCursor);
  109. unsigned Count();
  110. private:
  111. USHORT _hKeyGenerator; // generator value for cursor handles
  112. };