| Version: 3.3.1

Public Member Functions | List of all members
wxVersionInfo Class Reference
Class List by Category » Data Structures

`#include <wx/versioninfo.h>`

## Detailed Description

wxVersionInfo contains version information.

This class is used by wxWidgets to provide version information about the libraries it uses and itself, but you can also apply it in user space, to provide version information about your own libraries, or other libraries that you use.

For example, if you are including Lua in your program, you can gather its library info as such:

wxVersionInfo luaLibInfo{ "Lua", LUA_VERSION_MAJOR_N, LUA_VERSION_MINOR_N,
LUA_VERSION_RELEASE_N, 0, wxString{}, LUA_COPYRIGHT };
// GetName(), GetCopyright(), GetNumericVersionString(), etc. can be called
// from the luaLibInfo object.
wxString
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:372
wxVersionInfo
wxVersionInfo contains version information.
Definition: versioninfo.h:53

##

Library: wxBase
Category: Data Structures

Since
  2.9.2

## Public Member Functions
| wxVersionInfo (const wxString &name=wxString(), int major=0, int minor=0, int micro=0, int revision=0, const wxString &description=wxString(), const wxString &copyright=wxString())
| Constructor. More...
bool | AtLeast (int major, int minor=0, int micro=0) const
| Return true if the version is at least equal to the given one. More...
bool | IsOk () const
| Return true if there is actually at least some version information. More...
const wxString & | GetName () const
| Get the name of the object (library). More...
int | GetMajor () const
| Get the major version number. More...
int | GetMinor () const
| Get the minor version number. More...
int | GetMicro () const
| Get the micro version, or release number. More...
int | GetRevision () const
| Get the revision version, or build number. More...
wxString | ToString () const
| Get the string representation of this version object. More...
wxString | GetNumericVersionString () const
| Get the string representation of only numeric version components. More...
wxString | GetVersionString () const
| Get the string representation. More...
bool | HasDescription () const
| Return true if a description string has been specified. More...
const wxString & | GetDescription ()
| Get the description string. More...
bool | HasCopyright () const
| Returns true if a copyright string has been specified. More...
const wxString & | GetCopyright () const
| Get the copyright string. More...

## Constructor & Destructor Documentation

## ◆ wxVersionInfo()

wxVersionInfo::wxVersionInfo | ( | const wxString & | name = `wxString()`,
|  | int | major = `0`,
|  | int | minor = `0`,
|  | int | micro = `0`,
|  | int | revision = `0`,
|  | const wxString & | description = `wxString()`,
|  | const wxString & | copyright = `wxString()`
| ) |  |

Constructor.

The version information objects need to be initialized with this constructor and are immutable once they are created.

Parameters

  name | The name of the library or other entity that this object pertains to.
  major | The major version component.
  minor | The minor version component.
  micro | The micro version component, 0 by default.
  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.
  description | Free form description of this version, none by default.
  copyright | Copyright string, none by default.

## Member Function Documentation

## ◆ AtLeast()

bool wxVersionInfo::AtLeast | ( | int | major,
|  | int | minor = `0`,
|  | int | micro = `0`
| ) |  | const

Return true if the version is at least equal to the given one.

Parameters

  major | Major version to compare with.
  minor | Optional minor version to compare with.
  micro | Optional micro version to compare with.

Returns
  true if this version is equal to or greater than the given one.

Since
  3.3.0

## ◆ GetCopyright()

const wxString& wxVersionInfo::GetCopyright | ( |  | ) | const

Get the copyright string.

The copyright string may be empty.

Returns
  The copyright string.

## ◆ GetDescription()

const wxString& wxVersionInfo::GetDescription | ( |  | ) |

Get the description string.

The description may be empty.

Returns
  The description string, free-form.

## ◆ GetMajor()

int wxVersionInfo::GetMajor | ( |  | ) | const

Get the major version number.

Returns
  Major version number.

## ◆ GetMicro()

int wxVersionInfo::GetMicro | ( |  | ) | const

Get the micro version, or release number.

This is the third component of the version.

Returns
  Micro version, or release number.

## ◆ GetMinor()

int wxVersionInfo::GetMinor | ( |  | ) | const

Get the minor version number.

Returns
  Minor version number.

## ◆ GetName()

const wxString& wxVersionInfo::GetName | ( |  | ) | const

Get the name of the object (library).

Returns
  Name string.

## ◆ GetNumericVersionString()

wxString wxVersionInfo::GetNumericVersionString | ( |  | ) | const

Get the string representation of only numeric version components.

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.

Returns
  The version string in the form "major.minor[.micro[.revision]]".

Since
  3.3.0

## ◆ GetRevision()

int wxVersionInfo::GetRevision | ( |  | ) | const

Get the revision version, or build number.

This is the fourth component of the version.

Returns
  Revision version, or build number.

Since
  3.2.0

## ◆ GetVersionString()

wxString wxVersionInfo::GetVersionString | ( |  | ) | const

Get the string representation.

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.

Note that this function includes the name of the object this version is defined for, if this is undesired, use GetNumericVersionString() instead.

Returns
  The version string in the form "name major.minor[.micro[.revision]]".

## ◆ HasCopyright()

bool wxVersionInfo::HasCopyright | ( |  | ) | const

Returns true if a copyright string has been specified.

See also
  GetCopyright()

## ◆ HasDescription()

bool wxVersionInfo::HasDescription | ( |  | ) | const

Return true if a description string has been specified.

See also
  GetDescription()

## ◆ IsOk()

bool wxVersionInfo::IsOk | ( |  | ) | const

Return true if there is actually at least some version information.

For the default-constructed object, this function returns false, allowing to distinguish it from any object filled with the version information.

Since
  3.3.0

## ◆ ToString()

wxString wxVersionInfo::ToString | ( |  | ) | const

Get the string representation of this version object.

This function returns the description if it is non-empty or GetVersionString() if there is no description.

See also
  GetDescription(), GetVersionString()