data: Saving application version to storage and refresh when version changes
The version string of the application is stored on every parse. The utility class Version is used to parse the version string and compare application and stored string. The third number in the version string is now the storage refresh number, the project will be refreshed when it changes. (0.2.1 -> 0.2.2)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class Version
|
||||
{
|
||||
public:
|
||||
static Version fromString(const std::string& versionString);
|
||||
|
||||
static void setApplicationVersion(const Version& version);
|
||||
static const Version& getApplicationVersion();
|
||||
|
||||
Version();
|
||||
|
||||
bool operator<(const Version& other);
|
||||
bool isOlderStorageVersionThan(const Version& other);
|
||||
|
||||
std::string toString() const;
|
||||
std::string toDisplayString() const;
|
||||
|
||||
private:
|
||||
static Version s_version;
|
||||
|
||||
int m_majorNumber;
|
||||
int m_minorNumber;
|
||||
int m_refreshNumber;
|
||||
int m_commitNumber;
|
||||
|
||||
std::string m_commitHash;
|
||||
};
|
||||
|
||||
#endif // VERSION_H
|
||||
Reference in New Issue
Block a user