diff --git a/include/wx/versioninfo.h b/include/wx/versioninfo.h index 277e3e146a..436fcbbba6 100644 --- a/include/wx/versioninfo.h +++ b/include/wx/versioninfo.h @@ -23,15 +23,21 @@ public: int major = 0, int minor = 0, int micro = 0, + int revision = 0, const wxString& description = wxString(), const wxString& copyright = wxString()) - : m_name(name) - , m_description(description) - , m_copyright(copyright) { - m_major = major; - m_minor = minor; - m_micro = micro; + Init(name, major, minor, micro, revision, description, copyright); + } + + // This constructor exists for backward compatibility (before the revision + // part was added). + wxVersionInfo(const wxString& name, + int major, int minor, int micro, + const wxString& description, + const wxString& copyright = wxString()) + { + Init(name, major, minor, micro, 0, description, copyright); } // Default copy ctor, assignment operator and dtor are ok. @@ -42,6 +48,7 @@ public: int GetMajor() const { return m_major; } int GetMinor() const { return m_minor; } int GetMicro() const { return m_micro; } + int GetRevision() const { return m_revision; } wxString ToString() const { @@ -52,8 +59,12 @@ public: { wxString str; str << m_name << ' ' << GetMajor() << '.' << GetMinor(); - if ( GetMicro() ) + if ( GetMicro() || GetRevision() ) + { str << '.' << GetMicro(); + if ( GetRevision() ) + str << '.' << GetRevision(); + } return str; } @@ -65,13 +76,28 @@ public: const wxString& GetCopyright() const { return m_copyright; } private: + void Init(const wxString& name, + int major, int minor, int micro, int revision, + const wxString& description, + const wxString& copyright) + { + m_name = name; + m_description = description; + m_copyright = copyright; + m_major = major; + m_minor = minor; + m_micro = micro; + m_revision = revision; + } + wxString m_name, m_description, m_copyright; int m_major, m_minor, - m_micro; + m_micro, + m_revision; }; #endif // _WX_VERSIONINFO_H_ diff --git a/interface/wx/versioninfo.h b/interface/wx/versioninfo.h index ff733b0fb5..b2e9ff5e88 100644 --- a/interface/wx/versioninfo.h +++ b/interface/wx/versioninfo.h @@ -35,6 +35,9 @@ public: @param major The major version component. @param minor The minor version component. @param micro The micro version component, 0 by default. + @param revision The revision version component, also known as "build + number". This component is also 0 by default and is only available + since wxWidgets 3.2.0. @param description Free form description of this version, none by default. @param copyright Copyright string, none by default. @@ -43,6 +46,7 @@ public: int major = 0, int minor = 0, int micro = 0, + int revision = 0, const wxString& description = wxString(), const wxString& copyright = wxString()); @@ -70,10 +74,23 @@ public: /** Get the micro version, or release number. + This is the third component of the version. + @return Micro version, or release number. */ int GetMicro() const; + /** + Get the revision version, or build number. + + This is the fourth component of the version. + + @return Revision version, or build number. + + @since 3.2.0 + */ + int GetRevision() const; + /** Get the string representation of this version object. @@ -87,9 +104,11 @@ public: /** Get the string representation. - The micro component of the version is ignored/not used if it is 0. + The micro and revision components of the version are ignored/not used + if they are both zero. If the revision component is non-zero all four + parts will be used even if the micro component is zero. - @return The version string in the form "name major.minor[.micro]". + @return The version string in the form "name major.minor[.micro[.revision]]". */ wxString GetVersionString() const;