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.

115 lines
2.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 2000.
  5. //
  6. // File: SIGNORE.hxx
  7. //
  8. // Contents: Class to keep a list of scopes which shouldn't be filtered.
  9. //
  10. // History: 21-Nov-96 dlee created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <timlimit.hxx>
  15. #include <fa.hxx>
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Class: CScopesIgnored
  19. //
  20. // Purpose: The ignored scope table
  21. //
  22. // History: 21-Nov-96 dlee created
  23. //
  24. //----------------------------------------------------------------------------
  25. class CScopesIgnored
  26. {
  27. public:
  28. CScopesIgnored() : _tl(0,0) { }
  29. BOOL Enumerate(WCHAR * pwcRoot, unsigned cwc, unsigned & iBmk );
  30. void RemoveElement(WCHAR const * pwcScope);
  31. BOOL Update( WCHAR const * pwcScope,
  32. BOOL fIsIndexed )
  33. {
  34. // return TRUE if a change was made to the table, FALSE otherwise
  35. XPtr<CLowcaseBuf> xElem = new CLowcaseBuf( pwcScope );
  36. CWriteAccess lock( _rwLock );
  37. for ( unsigned i = 0; i < _aElems.Count(); i++ )
  38. {
  39. // look for the path in the array
  40. if ( xElem->AreEqual( *_aElems[i] ) )
  41. {
  42. // if it wasn't indexed before and it is now, remove it.
  43. if ( fIsIndexed )
  44. {
  45. delete _aElems.AcquireAndShrink(i);
  46. ConstructDFAObject();
  47. return TRUE;
  48. }
  49. else
  50. {
  51. // no change -- wasn't indexed before and isn't now.
  52. return FALSE;
  53. }
  54. }
  55. }
  56. // add the new entry if it shouldn't be indexed
  57. if ( !fIsIndexed )
  58. {
  59. _aElems.Add( xElem.GetPointer(), _aElems.Count() );
  60. xElem.Acquire();
  61. ConstructDFAObject();
  62. return TRUE;
  63. }
  64. return FALSE;
  65. } //Update
  66. BOOL RegExFind( CLowcaseBuf const & bufToFind );
  67. #if CIDBG==1
  68. void Dump()
  69. {
  70. CReadAccess lock( _rwLock );
  71. ciDebugOut(( DEB_ERROR, "========= Start IgnoredScopes Table =============\n" ));
  72. for ( unsigned i = 0; i < _aElems.Count(); i++ )
  73. {
  74. ciDebugOut(( DEB_ERROR, "IgnoredScopes: %ws\n",_aElems[i]->Get() ));
  75. }
  76. ciDebugOut(( DEB_ERROR, "========= End IgnoredScopes Table =============\n" ));
  77. }
  78. #endif
  79. private:
  80. void ConstructDFAObject(void);
  81. CCountedDynArray<CLowcaseBuf> _aElems;
  82. CReadWriteAccess _rwLock;
  83. XPtr<CDFA> _xDFA;
  84. CTimeLimit _tl;
  85. };