versioninfo.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/versioninfo.h
  3. // Purpose: declaration of wxVersionInfo class
  4. // Author: Troels K
  5. // Created: 2010-11-22
  6. // Copyright: (c) 2010 wxWidgets team
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_VERSIONINFO_H_
  10. #define _WX_VERSIONINFO_H_
  11. #include "wx/string.h"
  12. // ----------------------------------------------------------------------------
  13. // wxVersionInfo: represents version information
  14. // ----------------------------------------------------------------------------
  15. class wxVersionInfo
  16. {
  17. public:
  18. wxVersionInfo(const wxString& name = wxString(),
  19. int major = 0,
  20. int minor = 0,
  21. int micro = 0,
  22. const wxString& description = wxString(),
  23. const wxString& copyright = wxString())
  24. {
  25. m_name = name;
  26. m_major = major;
  27. m_minor = minor;
  28. m_micro = micro;
  29. m_description = description;
  30. m_copyright = copyright;
  31. }
  32. // Default copy ctor, assignment operator and dtor are ok.
  33. const wxString& GetName() const { return m_name; }
  34. int GetMajor() const { return m_major; }
  35. int GetMinor() const { return m_minor; }
  36. int GetMicro() const { return m_micro; }
  37. wxString ToString() const
  38. {
  39. return HasDescription() ? GetDescription() : GetVersionString();
  40. }
  41. wxString GetVersionString() const
  42. {
  43. wxString str;
  44. str << m_name << ' ' << GetMajor() << '.' << GetMinor();
  45. if ( GetMicro() )
  46. str << '.' << GetMicro();
  47. return str;
  48. }
  49. bool HasDescription() const { return !m_description.empty(); }
  50. const wxString& GetDescription() const { return m_description; }
  51. bool HasCopyright() const { return !m_copyright.empty(); }
  52. const wxString& GetCopyright() const { return m_copyright; }
  53. private:
  54. wxString m_name,
  55. m_description,
  56. m_copyright;
  57. int m_major,
  58. m_minor,
  59. m_micro;
  60. };
  61. #endif // _WX_VERSIONINFO_H_