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.

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