Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
VersionId Class Referencefinal

A class, that supports base manipulation with version number. More...

#include <VersionId.h>

Public Member Functions

 VersionId ()=default
 Creates an zero version object. More...
 
 VersionId (int version, int release, int revision)
 
wxString GetString () const
 Make string with version by MakeString() from instance values. More...
 
bool operator== (const VersionId &other)
 
bool operator!= (const VersionId &other)
 
bool operator< (const VersionId &other)
 
bool operator> (const VersionId &other)
 

Static Public Member Functions

static wxString MakeString (int version, int release, int revision)
 Creates version string like "1.2.3" by parameters. More...
 
static VersionId ParseFromString (wxString &versionString)
 Parse and return version object from version string like "1.2.3". More...
 

Private Attributes

int mVersion { 0 }
 
int mRelease { 0 }
 
int mRevision { 0 }
 

Detailed Description

A class, that supports base manipulation with version number.

By default initialized by zero version number (Version = 0, Release = 0, Revision = 0), that not allow us to update.

Definition at line 18 of file VersionId.h.

Constructor & Destructor Documentation

◆ VersionId() [1/2]

VersionId::VersionId ( )
default

Creates an zero version object.

Referenced by ParseFromString().

Here is the caller graph for this function:

◆ VersionId() [2/2]

VersionId::VersionId ( int  version,
int  release,
int  revision 
)

Definition at line 11 of file VersionId.cpp.

12 : mVersion(version),
13 mRelease(release),
14 mRevision(revision)
15{}
int mRevision
Definition: VersionId.h:42
int mRelease
Definition: VersionId.h:41
int mVersion
Definition: VersionId.h:40

Member Function Documentation

◆ GetString()

wxString VersionId::GetString ( ) const

Make string with version by MakeString() from instance values.

Definition at line 46 of file VersionId.cpp.

47{
49}
static wxString MakeString(int version, int release, int revision)
Creates version string like "1.2.3" by parameters.
Definition: VersionId.cpp:17

References MakeString(), mRelease, mRevision, and mVersion.

Referenced by UpdatePopupDialog::AddHtmlContent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeString()

wxString VersionId::MakeString ( int  version,
int  release,
int  revision 
)
static

Creates version string like "1.2.3" by parameters.

Definition at line 17 of file VersionId.cpp.

18{
19 return std::to_string(version)
20 + "." + std::to_string(release)
21 + "." + std::to_string(revision);
22}

Referenced by GetString().

Here is the caller graph for this function:

◆ operator!=()

bool VersionId::operator!= ( const VersionId other)

Definition at line 57 of file VersionId.cpp.

58{
59 return !(*this == other);
60}

◆ operator<()

bool VersionId::operator< ( const VersionId other)

Definition at line 62 of file VersionId.cpp.

63{
64 return std::tie(mVersion, mRelease, mRevision) <
65 std::tie(other.mVersion, other.mRelease, other.mRevision);
66}

References mRelease, mRevision, and mVersion.

◆ operator==()

bool VersionId::operator== ( const VersionId other)

Definition at line 51 of file VersionId.cpp.

52{
53 return std::tie(mVersion, mRelease, mRevision) ==
54 std::tie(other.mVersion, other.mRelease, other.mRevision);
55}

References mRelease, mRevision, and mVersion.

◆ operator>()

bool VersionId::operator> ( const VersionId other)

Definition at line 68 of file VersionId.cpp.

69{
70 return !(*this < other) && (*this != other);
71}

◆ ParseFromString()

VersionId VersionId::ParseFromString ( wxString &  versionString)
static

Parse and return version object from version string like "1.2.3".

Definition at line 24 of file VersionId.cpp.

25{
26 auto versionStringParts = wxSplit(versionString, '.');
27
28 // If we have corrupted version string,
29 // then return the zero version number, that not allow us to update.
30 if (versionStringParts.size() != 3)
31 return VersionId{};
32
33 for (auto& v : versionStringParts)
34 {
35 if (v.empty() || !v.IsNumber())
36 return VersionId{};
37 }
38
39 return VersionId(
40 std::stoi(versionStringParts[0].ToStdString()),
41 std::stoi(versionStringParts[1].ToStdString()),
42 std::stoi(versionStringParts[2].ToStdString())
43 );
44}
A class, that supports base manipulation with version number.
Definition: VersionId.h:19
VersionId()=default
Creates an zero version object.

References VersionId().

Referenced by UpdateDataParser::HandleXMLContent().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mRelease

int VersionId::mRelease { 0 }
private

Definition at line 41 of file VersionId.h.

Referenced by GetString(), operator<(), and operator==().

◆ mRevision

int VersionId::mRevision { 0 }
private

Definition at line 42 of file VersionId.h.

Referenced by GetString(), operator<(), and operator==().

◆ mVersion

int VersionId::mVersion { 0 }
private

Definition at line 40 of file VersionId.h.

Referenced by GetString(), operator<(), and operator==().


The documentation for this class was generated from the following files: