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.

82 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: schemacache.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _SCHEMA_CACHE_H_
  11. #define _SCHEMA_CACHE_H_
  12. #include <SnapBase.h>
  13. #include "adsiedit.h"
  14. #include "editor.h"
  15. //+--------------------------------------------------------------------------
  16. //
  17. // Class: CADSIEditClassCacheItemBase
  18. //
  19. // Purpose: Object for storing and retrieving schema class information
  20. //
  21. // History: 27-Nov-2000 JeffJon Created
  22. //
  23. //---------------------------------------------------------------------------
  24. class CADSIEditClassCacheItemBase
  25. {
  26. public:
  27. CADSIEditClassCacheItemBase(PCWSTR pszClass,
  28. bool bIsContainer)
  29. : m_bIsContainer(bIsContainer),
  30. m_szClass(pszClass)
  31. {}
  32. ~CADSIEditClassCacheItemBase() {}
  33. bool IsContainer() { return m_bIsContainer; }
  34. PCWSTR GetClass() { return m_szClass; }
  35. private:
  36. bool m_bIsContainer;
  37. CString m_szClass;
  38. };
  39. //+--------------------------------------------------------------------------
  40. //
  41. // Class: CADSIEditSchemaCache
  42. //
  43. // Purpose: Object for caching the schema information keyed by the
  44. // objectClass
  45. //
  46. // History: 27-Nov-2000 JeffJon Created
  47. //
  48. //---------------------------------------------------------------------------
  49. typedef CMap <CString, PCWSTR, CADSIEditClassCacheItemBase*, CADSIEditClassCacheItemBase*> CADSIEditSchemaCacheMap;
  50. class CADSIEditSchemaCache
  51. {
  52. public:
  53. CADSIEditSchemaCache() {}
  54. ~CADSIEditSchemaCache() {}
  55. CADSIEditClassCacheItemBase* FindClassCacheItem(CCredentialObject* pCredObject,
  56. PCWSTR pszClass,
  57. PCWSTR pszSchemaPath);
  58. BOOL Lookup(PCWSTR pszClass, CADSIEditClassCacheItemBase*& refpItem);
  59. HRESULT Initialize();
  60. HRESULT Destroy();
  61. void Clear();
  62. private:
  63. void _Cleanup();
  64. void _Lock() { ::EnterCriticalSection(&m_cs);}
  65. void _Unlock() { ::LeaveCriticalSection(&m_cs);}
  66. CRITICAL_SECTION m_cs;
  67. CADSIEditSchemaCacheMap m_Map;
  68. };
  69. #endif // _SCHEMA_CACHE_H_