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. * fdir.h -- Interface for the class: CFontDir
  3. *
  4. *
  5. * Copyright (C) 1992-93 ElseWare Corporation. All rights reserved.
  6. ***************************************************************************/
  7. #if !defined(__FDIR_H__)
  8. #define __FDIR_H__
  9. #include "vecttmpl.h"
  10. #define MAX_DIR_LEN MAX_PATH /* MAX_PATH_LEN */
  11. typedef TCHAR DIRNAME[ MAX_DIR_LEN + 1 ];
  12. class CFontDir {
  13. public:
  14. CFontDir();
  15. virtual ~CFontDir();
  16. BOOL bInit( LPCTSTR lpPath, int iLen);
  17. BOOL bSameDir( LPTSTR lpStr, int iLen );
  18. BOOL bOnSysDir() { return m_bSysDir; };
  19. VOID vOnSysDir( BOOL b ) { m_bSysDir = b; };
  20. LPTSTR lpString();
  21. private:
  22. int m_iLen;
  23. BOOL m_bSysDir;
  24. DIRNAME m_oPath;
  25. };
  26. //
  27. // Class representing a dynamic array of CFontDir object ptrs.
  28. // Implemented as a singleton object through the static member
  29. // function GetSingleton.
  30. //
  31. // History:
  32. // In the original font folder code (as written for Win95),
  33. // this directory list was implemented as a simple derivation
  34. // from CIVector<CFontDir> with a single instance allocated
  35. // on the heap and attached to the static member variable
  36. // CFontClass::s_poDirList. There was no code to delete
  37. // this instance so we had a memory leak. To fix this I've
  38. // replaced this instance with a true Singleton object.
  39. // Class CFontDirList is that singleton. Memory management
  40. // is now correct.
  41. // [brianau - 2/27/01]
  42. //
  43. class CFontDirList
  44. {
  45. public:
  46. ~CFontDirList(void);
  47. void Clear(void);
  48. BOOL Add(CFontDir *poDir);
  49. CFontDir *Find(LPTSTR pszPath, int iLen, BOOL bAdd = FALSE);
  50. BOOL IsEmpty(void) const;
  51. int Count(void) const;
  52. CFontDir *GetAt(int index) const;
  53. //
  54. // Singleton access function.
  55. //
  56. static BOOL GetSingleton(CFontDirList **ppDirList);
  57. private:
  58. //
  59. // Dynamic vector holding CFontDir ptrs.
  60. //
  61. CIVector<CFontDir> *m_pVector;
  62. //
  63. // Ctor is private to enforce singleton usage.
  64. //
  65. CFontDirList(void);
  66. };
  67. #endif // __FDIR_H__