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.

158 lines
4.7 KiB

  1. //+------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1991 - 1997
  4. //
  5. // File: idxentry.hxx
  6. //
  7. // Contents: Document filter interface
  8. //
  9. // Classes: CIndexNotificationEntry
  10. //
  11. // History: 24-Feb-97 SitaramR Created
  12. //
  13. // Notes: The implementation uses the regular memory allocator,
  14. // and it makes a copy of every text string and property
  15. // that is added. A better approach may be to define a
  16. // custom memory allocator that allocates portions as
  17. // needed from say a 4K block of memory.
  18. //
  19. //-------------------------------------------------------------------
  20. #pragma once
  21. #include <ciintf.h>
  22. #include "idxnotif.hxx"
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Class: CChunkEntry
  26. //
  27. // Purpose: Entry in a list of chunks
  28. //
  29. // History: 24-Feb-97 SitaramR Created
  30. //
  31. //----------------------------------------------------------------------------
  32. class CChunkEntry
  33. {
  34. public:
  35. CChunkEntry( STAT_CHUNK const * pStatChunk, WCHAR const * pwszText );
  36. CChunkEntry( STAT_CHUNK const * pStatChunk, PROPVARIANT const * pPropVar );
  37. ~CChunkEntry();
  38. CChunkEntry * GetNextChunkEntry() { return _pChunkEntryNext; }
  39. void SetNextChunkEntry( CChunkEntry *pChunkEntry ) { _pChunkEntryNext = pChunkEntry; }
  40. STAT_CHUNK * GetStatChunk() { return &_statChunk; }
  41. WCHAR * GetTextBuffer() { return _pwszText; }
  42. CStorageVariant * GetVariant() { return _pStgVariant; }
  43. private:
  44. STAT_CHUNK _statChunk;
  45. union
  46. {
  47. WCHAR * _pwszText; // Either an entry has text
  48. CStorageVariant * _pStgVariant; // Or, an entry has property
  49. };
  50. CChunkEntry * _pChunkEntryNext; // Link to next chunk in list
  51. };
  52. //+---------------------------------------------------------------------------
  53. //
  54. // Class: CIndexNotificationEntry
  55. //
  56. // Purpose: Filter interface for documents
  57. //
  58. // History: 24-Feb-97 SitaramR Created
  59. //
  60. //----------------------------------------------------------------------------
  61. class CIndexNotificationEntry : INHERIT_VIRTUAL_UNWIND,
  62. public ICiIndexNotificationEntry
  63. {
  64. INLINE_UNWIND( CIndexNotificationEntry );
  65. public:
  66. //
  67. // From IUnknown
  68. //
  69. virtual SCODE STDMETHODCALLTYPE QueryInterface( REFIID riid, void **ppvObject );
  70. virtual ULONG STDMETHODCALLTYPE AddRef();
  71. virtual ULONG STDMETHODCALLTYPE Release();
  72. //
  73. // From ICiIndexNotificationEntry
  74. //
  75. virtual SCODE STDMETHODCALLTYPE AddText( STAT_CHUNK const * pStatChunk,
  76. WCHAR const * pwszText );
  77. virtual SCODE STDMETHODCALLTYPE AddProperty( STAT_CHUNK const * pStatChunk,
  78. PROPVARIANT const *pPropVariant );
  79. virtual SCODE STDMETHODCALLTYPE AddCompleted( ULONG fAbort );
  80. //
  81. // Local methods
  82. //
  83. CIndexNotificationEntry( WORKID wid,
  84. CI_UPDATE_TYPE eUpdateType,
  85. XInterface<CIndexNotificationTable> & xNotifTable,
  86. XInterface<ICiCIndexNotificationStatus> & xNotifStatus,
  87. CCiManager * pCiManager,
  88. USN usn );
  89. void Commit() { _xNotifStatus->Commit(); }
  90. void Abort() { _xNotifStatus->Abort(); }
  91. USN Usn() { return _usn; }
  92. CChunkEntry * GetFirstChunk();
  93. CChunkEntry * GetNextChunk();
  94. void PurgeFilterData();
  95. void Shutdown()
  96. {
  97. _fShutdown = TRUE;
  98. Abort();
  99. }
  100. private :
  101. virtual ~CIndexNotificationEntry( );
  102. XInterface<CIndexNotificationTable> _xNotifTable;
  103. XInterface<ICiCIndexNotificationStatus> _xNotifStatus;
  104. CCiManager * _pCiManager;
  105. WORKID _wid;
  106. CI_UPDATE_TYPE _eUpdateType; // Update type
  107. BOOL _fAddCompleted; // Have all text/props been added ?
  108. BOOL _fShutdown; // Are we shutting down ?
  109. BOOL _fFilterDataPurged; // Has filter data been purged ?
  110. USN _usn; // Usn of this notification
  111. CChunkEntry * _pChunkEntryHead; // Head of chunk entry list
  112. CChunkEntry * _pChunkEntryTail; // Tail of chunk entry list
  113. CChunkEntry * _pChunkEntryIter; // Marker when iterating thru list
  114. ULONG _cRefs; // Ref count
  115. };