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.

61 lines
1.1 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: MetaUtil object
  6. File: ChkMeta.cpp
  7. Owner: t-BrianM
  8. This file contains the headers for the objects related to the
  9. CheckSchema and CheckKey methods.
  10. ===================================================================*/
  11. #include "stdafx.h"
  12. #include "MetaUtil.h"
  13. #include "MUtilObj.h"
  14. #define NAME_TABLE_HASH_SIZE 1559
  15. class CNameTable;
  16. class CNameTableEntry {
  17. friend CNameTable;
  18. public:
  19. CNameTableEntry() : m_tszName(NULL),
  20. m_pCHashNext(NULL) { }
  21. HRESULT Init(LPCTSTR tszName);
  22. ~CNameTableEntry() {
  23. if (m_tszName != NULL) {
  24. delete m_tszName;
  25. }
  26. }
  27. private:
  28. LPTSTR m_tszName;
  29. CNameTableEntry *m_pCHashNext;
  30. };
  31. class CNameTable {
  32. public:
  33. CNameTable();
  34. ~CNameTable();
  35. BOOL IsCaseSenDup(LPCTSTR tszName);
  36. BOOL IsCaseInsenDup(LPCTSTR tszName);
  37. HRESULT Add(LPCTSTR tszName);
  38. private:
  39. CNameTableEntry *m_rgpNameTable[NAME_TABLE_HASH_SIZE];
  40. int Hash(LPCTSTR tszName);
  41. };