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