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.

177 lines
4.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: ObjCur.Hxx
  7. //
  8. // Contents: Object cursor + ancillary support for generic ViewTable
  9. //
  10. // Classes:
  11. //
  12. // History: 07-Sep-92 KyleP Created from portions of IDSMgr\NewQuery
  13. //
  14. //--------------------------------------------------------------------------
  15. #pragma once
  16. class CXpr;
  17. class CCursor;
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Class: CRetriever
  21. //
  22. // Purpose: Accesses properties of an object (**not** necessarily
  23. // through the official property mechanism.
  24. //
  25. // Interface:
  26. //
  27. // History: 07-Sep-92 KyleP Created
  28. // 20 Jun 94 Alanw Added WorkId() method for large tables.
  29. //
  30. //--------------------------------------------------------------------------
  31. enum GetValueResult
  32. {
  33. GVRSuccess, // Call successful
  34. GVRNotEnoughSpace, // Out of space in output buffer.
  35. GVRNotSupported, // Unsupported access mode
  36. GVRNotAvailable, // Requested property not available
  37. GVRSharingViolation // Sharing violation, no result
  38. };
  39. //+---------------------------------------------------------------------------
  40. //----------------------------------------------------------------------------
  41. class CRetriever
  42. {
  43. public:
  44. virtual ~CRetriever();
  45. virtual GetValueResult GetPropertyValue( PROPID pid,
  46. PROPVARIANT * pbData,
  47. ULONG * pcb ) = 0;
  48. virtual WORKID WorkId() = 0;
  49. virtual WORKID NextWorkId() = 0;
  50. virtual WORKID SetWorkId(WORKID widNew) = 0;
  51. static NTSTATUS NtStatusFromGVR( GetValueResult gvr );
  52. virtual void Quiesce() = 0;
  53. };
  54. DECLARE_SMARTP( Retriever );
  55. //+---------------------------------------------------------------------------
  56. //
  57. // Function: NtStatusFromGVR
  58. //
  59. // Synopsis: Returns an NtStatus for a given GVR value.
  60. //
  61. // Arguments: [gvr] - Input - the gvr to be transformed
  62. //
  63. // Returns: An NTSTATUS that corresponds to the gvr.
  64. //
  65. // History: 4-27-95 srikants Created
  66. //
  67. // Notes:
  68. //
  69. //----------------------------------------------------------------------------
  70. inline NTSTATUS CRetriever::NtStatusFromGVR( GetValueResult gvr )
  71. {
  72. NTSTATUS status = STATUS_UNSUCCESSFUL;
  73. switch (gvr )
  74. {
  75. case GVRSuccess:
  76. status = STATUS_SUCCESS;
  77. break;
  78. case GVRNotEnoughSpace:
  79. status = STATUS_NO_MEMORY;
  80. break;
  81. case GVRNotSupported:
  82. status = STATUS_NOT_SUPPORTED;
  83. break;
  84. case GVRNotAvailable:
  85. status = STATUS_NOT_FOUND;
  86. break;
  87. case GVRSharingViolation:
  88. status = STATUS_SHARING_VIOLATION;
  89. break;
  90. }
  91. return status;
  92. }
  93. //+-------------------------------------------------------------------------
  94. //
  95. // Class: CValueXpr
  96. //
  97. // Purpose: Used to fetch property values. May (potentially) be
  98. // expressions more complex that just fetching simple
  99. // value.
  100. //
  101. // History: 08-Sep-92 KyleP Created
  102. //
  103. //--------------------------------------------------------------------------
  104. class CValueXpr
  105. {
  106. public:
  107. virtual ~CValueXpr() {};
  108. virtual GetValueResult GetValue( CRetriever & obj,
  109. PROPVARIANT * p,
  110. ULONG * pcb ) = 0;
  111. };
  112. inline CRetriever::~CRetriever()
  113. {
  114. }
  115. #if defined( DOCGEN )
  116. //+-------------------------------------------------------------------------
  117. //
  118. // Member: CRetriever::GetPropertyValue, public
  119. //
  120. // Synopsis: Retrieves a property value of the current object.
  121. //
  122. // Arguments: [propinfo] -- Static helper information used to retrieve
  123. // a specific property.
  124. // [pProperty] -- Points to buffer into which the SPropValue
  125. // will be written. Any additional data (such
  126. // as a string) is written directly after the
  127. // SPropValue. Pointers in the SPropValue
  128. // should be absolute, not based on the starting
  129. // address of [pProperty].
  130. // [pcb] -- Maximum size of data that can be written to
  131. // [pProperty]. If there is not enough space
  132. // then GVRNotEnoughSpace should be returned and
  133. // *[pcb] contains the required size.
  134. //
  135. // Returns: Status code.
  136. //
  137. // History: 07-Sep-92 KyleP Created
  138. //
  139. //--------------------------------------------------------------------------
  140. GetValueResult CRetriever::GetPropertyValue( void * propinfo,
  141. SPropValue * pbData,
  142. ULONG * pcb )
  143. {
  144. }
  145. #endif // DOCGEN