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