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.

135 lines
4.2 KiB

  1. #ifndef __STATS_H
  2. #define __STATS_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: stats.h
  5. Description: These classes provide temporary storage of quota
  6. information for a given volume/user pair. Creation of the object
  7. automatically gathers the necessary quota and user information.
  8. Clients then query the objects to retrieve quota statistics when
  9. desired.
  10. CStatistics
  11. CStatisticsList
  12. +----------+
  13. +--->| CVolume |
  14. | +----------+
  15. +-----------------+ +-------------+<---+
  16. | CStatisticsList |<-->>| CStatistics | contains
  17. +-----------------+ +-------------+<---+
  18. | +-------------+
  19. +--->| CVolumeUser |
  20. +-------------+
  21. Revision History:
  22. Date Description Programmer
  23. -------- --------------------------------------------------- ----------
  24. 07/01/97 Initial creation. BrianAu
  25. */
  26. ///////////////////////////////////////////////////////////////////////////////
  27. #ifndef _WINDOWS_
  28. # include <windows.h>
  29. #endif
  30. #ifndef __VOLUSER_H
  31. # include "voluser.h"
  32. #endif
  33. #ifndef __VOLUME_H
  34. # include "volume.h"
  35. #endif
  36. class CStatistics
  37. {
  38. public:
  39. CStatistics(TCHAR chVolLetter,
  40. LPCTSTR pszVolDisplayName,
  41. LPBYTE pUserSid);
  42. ~CStatistics(VOID) { };
  43. BOOL SameVolume(const CStatistics& rhs) const
  44. { return m_vol == rhs.m_vol; }
  45. TCHAR GetVolumeLetter(VOID) const
  46. { return m_vol.GetLetter(); }
  47. VOID GetVolumeDisplayName(CString& strOut) const
  48. { m_vol.GetDisplayName(strOut); }
  49. LPCTSTR GetVolumeDisplayName(VOID) const
  50. { return m_vol.GetDisplayName(); }
  51. BOOL QuotasEnabled(VOID) const
  52. { return m_bQuotaEnabled; }
  53. BOOL WarnAtThreshold(VOID) const
  54. { return m_bWarnAtThreshold; }
  55. BOOL DenyAtLimit(VOID) const
  56. { return m_bDenyAtLimit; }
  57. VOID GetUserDisplayName(CString& strOut) const
  58. { m_volUser.GetDisplayName(strOut); }
  59. LPCTSTR GetUserDisplayName(VOID) const
  60. { return m_volUser.GetDisplayName(); }
  61. VOID GetUserEmailName(CString& strOut) const
  62. { m_volUser.GetEmailName(strOut); }
  63. LPCTSTR GetUserEmailName(VOID) const
  64. { return m_volUser.GetEmailName(); }
  65. LARGE_INTEGER GetUserQuotaThreshold(VOID) const
  66. { return m_volUser.GetQuotaThreshold(); }
  67. LARGE_INTEGER GetUserQuotaLimit(VOID) const
  68. { return m_volUser.GetQuotaLimit(); }
  69. LARGE_INTEGER GetUserQuotaUsed(VOID) const
  70. { return m_volUser.GetQuotaUsed(); }
  71. BOOL IsValid(VOID) const
  72. { return m_bValid; }
  73. BOOL IncludeInReport(VOID) const;
  74. private:
  75. CVolume m_vol; // Volume-specific info.
  76. CVolumeUser m_volUser; // User-specific info.
  77. BOOL m_bQuotaEnabled; // Are quotas enabled?
  78. BOOL m_bWarnAtThreshold; // Warn user at threshold?
  79. BOOL m_bDenyAtLimit; // Deny disk space at limit?
  80. BOOL m_bValid; // Is this object valid?
  81. //
  82. // Prevent copy.
  83. //
  84. CStatistics(const CStatistics& rhs);
  85. CStatistics& operator = (const CStatistics& rhs);
  86. };
  87. class CStatisticsList
  88. {
  89. public:
  90. CStatisticsList(VOID);
  91. ~CStatisticsList(VOID);
  92. INT Count(VOID)
  93. { return m_List.Count(); }
  94. const CStatistics *GetEntry(INT iEntry);
  95. HRESULT AddEntry(TCHAR chVolLetter,
  96. LPCTSTR pszVolDisplayName,
  97. LPBYTE pUserSid);
  98. private:
  99. CArray<CStatistics *> m_List;
  100. };
  101. #endif //__STATS_H