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.

136 lines
3.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: pidremap.hxx
  7. //
  8. // Contents: Maps Fake pids <--> Real Pids.
  9. //
  10. // History: 21-Jan-93 KyleP Created
  11. // 03-Jan-97 SrikantS Split from pidmap.hxx
  12. //
  13. //--------------------------------------------------------------------------
  14. #pragma once
  15. #include <ciintf.h>
  16. #include <pidmap.hxx>
  17. //+-------------------------------------------------------------------------
  18. //
  19. // Class: CPidRemapper
  20. //
  21. // Purpose: Maps 'fake' pid --> 'real' pid
  22. //
  23. // History: 12-Feb-93 KyleP Created
  24. //
  25. //--------------------------------------------------------------------------
  26. class CPidRemapper : INHERIT_UNWIND, public ICiQueryPropertyMapper
  27. {
  28. INLINE_UNWIND(CPidRemapper)
  29. public:
  30. //
  31. // From IUnknown
  32. //
  33. virtual SCODE STDMETHODCALLTYPE QueryInterface( REFIID riid, void **ppvObject );
  34. virtual ULONG STDMETHODCALLTYPE AddRef();
  35. virtual ULONG STDMETHODCALLTYPE Release();
  36. //
  37. // From ICiQueryPropertyMapper
  38. //
  39. virtual SCODE STDMETHODCALLTYPE PropertyToPropid( FULLPROPSPEC const *pFullPropSpec,
  40. PROPID *pPropId);
  41. virtual SCODE STDMETHODCALLTYPE PropidToProperty( PROPID pid,
  42. FULLPROPSPEC const **ppPropSpec);
  43. //
  44. // Local methods
  45. //
  46. CPidRemapper( const CPidMapper & pidmap,
  47. XInterface<IPropertyMapper> & xPropMapper,
  48. CRestriction * prst = 0,
  49. CColumnSet * pcol = 0,
  50. CSortSet * pso = 0 );
  51. CPidRemapper( XInterface<IPropertyMapper> & xPropMapper );
  52. ~CPidRemapper();
  53. CFullPropSpec const * RealToName( PROPID pid ) const;
  54. inline PROPID NameToReal( DBID const * Property );
  55. PROPID NameToReal( CFullPropSpec const * Property );
  56. void RemapPropid( CRestriction * prst );
  57. void RemapPropid( CColumnSet * pcol );
  58. void RemapPropid( CSortSet * pso );
  59. inline PROPID FakeToReal( PROPID pid ) const;
  60. inline unsigned Count( ) const;
  61. void ReBuild( const CPidMapper & pidMap );
  62. void Set( XArray<PROPID> & aPids );
  63. BOOL AnyStatProps() const { return _fAnyStatProps; }
  64. BOOL ContainsContentProp() const { return _fContentProp; }
  65. BOOL ContainsRankVectorProp() const { return _fRankVectorProp; }
  66. # ifdef CIEXTMODE
  67. void CiExtDump(void *ciExtSelf) const;
  68. # endif
  69. protected:
  70. BOOL _fAnyStatProps;
  71. BOOL _fContentProp;
  72. BOOL _fRankVectorProp;
  73. XInterface<IPropertyMapper> _xPropMapper;
  74. XArray<PROPID> _xaPidReal;
  75. unsigned _cpidReal;
  76. CPropNameArray _propNames;
  77. ULONG _cRefs; // Refcount
  78. };
  79. DECLARE_SMARTP( PidRemapper );
  80. inline PROPID CPidRemapper::NameToReal( DBID const * Property )
  81. {
  82. return( NameToReal( (CFullPropSpec const *)Property ) );
  83. }
  84. //+-------------------------------------------------------------------------
  85. //--------------------------------------------------------------------------
  86. inline PROPID CPidRemapper::FakeToReal( PROPID pid ) const
  87. {
  88. if ( pid < _cpidReal )
  89. return( _xaPidReal[pid] );
  90. else
  91. return( pidInvalid );
  92. }
  93. //+-------------------------------------------------------------------------
  94. //--------------------------------------------------------------------------
  95. inline unsigned CPidRemapper::Count( ) const
  96. {
  97. return _cpidReal;
  98. }