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.

62 lines
1.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: DIRTREE.HXX
  7. //
  8. // Contents: Directory Tree
  9. //
  10. // Classes: CDirTree
  11. //
  12. // History: 13-Aug-91 BartoszM Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class CKey;
  17. class CKeyBuf;
  18. //+---------------------------------------------------------------------------
  19. //
  20. // Class: CDirTree
  21. //
  22. // Purpose: Directory tree
  23. //
  24. // History: 13-Jun-91 BartoszM Created
  25. //
  26. //----------------------------------------------------------------------------
  27. class CDirTree
  28. {
  29. public:
  30. CDirTree(): _count(0) {
  31. _pKeys = new CKeyArray(1);
  32. }
  33. ~CDirTree() { delete _pKeys; }
  34. void Init ( unsigned count );
  35. void Init ( CKeyArray& keys, unsigned count );
  36. void Add ( unsigned i, const CKeyBuf& key );
  37. void Done( unsigned i );
  38. unsigned Seek ( const CKey& key ) const;
  39. unsigned CountLeaf() { return _count - _firstLeaf; }
  40. #ifdef CIEXTMODE
  41. void CiExtDump(void *ciExtSelf);
  42. #endif
  43. private:
  44. unsigned Index( unsigned i );
  45. unsigned _digits; // number of binary digits in _count
  46. unsigned _count;
  47. unsigned _firstLeaf;
  48. CKeyArray * _pKeys;
  49. };