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.

133 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 2000.
  5. //
  6. // File: PLANG.HXX
  7. //
  8. // Contents: Protocols used in language dependent filter pipeline
  9. //
  10. // Classes: PNoiseList, PKeyRepository
  11. //
  12. // History: 15-Jul-91 BartoszM Created
  13. //
  14. // Notes: The language dependent filtering pipeline.
  15. // The filter sees it encapsulated in the form of
  16. // DataRepository protocol which hides the
  17. // (language dependent) Key Maker and Value Normalizer
  18. // The input driven pipeline consists of:
  19. //
  20. // Word Breaker
  21. // Stemmer (optional)
  22. // Normalizer (protocol PWordRepository)
  23. // Noise List
  24. // Key Repository (the final sink for keys)
  25. //
  26. //----------------------------------------------------------------------------
  27. #pragma once
  28. #include <pfilter.hxx>
  29. class CFullPropSpec;
  30. class CStorageVariant;
  31. class CDataRepository;
  32. // Gap in occurrence number for phrase breaks.
  33. const int iOccPhraseGap = 7;
  34. //+---------------------------------------------------------------------------
  35. //
  36. // Class: PNoiseList
  37. //
  38. // Purpose: Filtering pipeline stage between word repository
  39. // and Key repository.
  40. // Discard most frequent words from the input stream
  41. //
  42. // History: 02-May-91 BartoszM Created stub.
  43. // 15-Jul-91 BartoszM converted to protocol
  44. //
  45. //----------------------------------------------------------------------------
  46. class PNoiseList
  47. {
  48. public:
  49. virtual void GetBuffers( unsigned** ppcbInBuf, BYTE** ppbInBuf ) = 0;
  50. virtual void GetFlags ( BOOL** ppRange, CI_RANK** ppRank )
  51. {
  52. *ppRange = 0;
  53. *ppRank = 0;
  54. }
  55. virtual void PutAltWord( unsigned hash ) = 0;
  56. virtual void PutWord( unsigned hash ) = 0;
  57. virtual void StartAltPhrase() { }
  58. virtual void EndAltPhrase() { }
  59. virtual void SkipNoiseWords( ULONG cWords) { }
  60. virtual void SetOccurrence( OCCURRENCE occ ) { }
  61. virtual BOOL FoundNoise() { return FALSE; }
  62. // CNoiseListInit returns a dummy value
  63. virtual OCCURRENCE GetOccurrence() { return 1; }
  64. };
  65. //+---------------------------------------------------------------------------
  66. //
  67. // Class: PKeyRepository
  68. //
  69. // Purpose: Key repository protocol: last stage of filtering pipeline
  70. //
  71. // History: 30-May-1991 t-WadeR Created.
  72. // 09-July-1991 t-WadeR Added PutPropId, PutWorkId
  73. // 13-Sep-1994 BartoszM Added extended GetBuffers call
  74. //
  75. //----------------------------------------------------------------------------
  76. class PKeyRepository
  77. {
  78. public:
  79. virtual ~PKeyRepository() {}
  80. virtual BOOL PutPropId( PROPID pid ) = 0;
  81. virtual void PutWorkId( WORKID wid ) = 0;
  82. virtual void PutKey( ULONG cNoiseWordsSkipped = 0 ) = 0;
  83. virtual void GetBuffers( unsigned** ppcbWordBuf,
  84. BYTE** ppbWordBuf, OCCURRENCE** ppocc ) = 0;
  85. virtual void GetSourcePosBuffers( ULONG** pSrcPos, ULONG** pSrcLen)
  86. {
  87. *pSrcPos = 0;
  88. *pSrcLen = 0;
  89. }
  90. virtual void GetFlags ( BOOL** ppRange, CI_RANK** ppRank ) = 0;
  91. virtual const ULONG GetFilteredBlockCount() const = 0;
  92. virtual void InitFilteredBlockCount( ULONG ulMaxFilteredBlocks ) { Win4Assert( !"Method should be overridden in child class" ); }
  93. virtual void StartAltPhrase( ULONG cNoiseWordsSkipped ) { Win4Assert( !"Method should be overridden in child class" ); }
  94. virtual void EndAltPhrase( ULONG cNoiseWordsSkipped ) { Win4Assert( !"Method should be overridden in child class" ); }
  95. virtual BOOL StoreValue( CFullPropSpec const & prop, CStorageVariant const & var );
  96. virtual BOOL StoreSecurity ( PSECURITY_DESCRIPTOR pSD, ULONG cbSD );
  97. virtual void FixUp( CDataRepository & drep ) {}
  98. };
  99. inline BOOL PKeyRepository::StoreValue(
  100. CFullPropSpec const & prop,
  101. CStorageVariant const & var )
  102. {
  103. // No storage allowed, by default.
  104. return FALSE;
  105. }
  106. inline BOOL PKeyRepository::StoreSecurity(
  107. PSECURITY_DESCRIPTOR pSD,
  108. ULONG cbSD )
  109. {
  110. // No storage allowed, by default.
  111. return FALSE;
  112. }