|
TrueReality
v0.1.1912
|
A utility to read and control the engines version numbers. More...
#include <VersionUtil.h>

Public Member Functions | |
| VersionUtil () | |
| ctor. More... | |
| VersionUtil (std::string fileName) | |
| Constructor. More... | |
| VersionUtil (std::string fileName, std::string filePath) | |
| Constructor. More... | |
| VersionUtil (std::string fileName, std::string filePath, std::string repoPath) | |
| Constructor. More... | |
| ~VersionUtil () | |
| dtor. More... | |
| void | SaveVersionFile () |
| Saves the version file currently in RAM to default location. More... | |
| void | SetVersion (int maj, int min, std::string yymm, int build) |
| Sets the version numbers. More... | |
| void | SetVersion (int maj, int min, int yymm, int build) |
| Sets the version numbers. More... | |
| void | GenerateVersionStructure () |
| Generates a copy of the version file in RAM. More... | |
| void | IncrementVersion () |
| Increments the version number of the build by one and sets the YYMM to current date. More... | |
| void | SetMajorVersion (int maj) |
| Sets the Major part of the version string. More... | |
| int | GetMajorVersion () |
| Gets the Major part of the version string. More... | |
| void | SetMinorVersion (int min) |
| Sets the Minor part of the version string. More... | |
| int | GetMinorVersion () |
| Gets the Minor part of the version string. More... | |
| std::string | GetYYMMVersion () |
| Gets the Year/Month part of the version string. More... | |
| void | SetYYMMVersion (std::string yymm) |
| Sets the Year/Month part of the version string. More... | |
| void | SetYYMMVersion (int yymm) |
| Sets the Year/Month part of the version string. More... | |
| void | SetBuildVersion (int build) |
| Sets the Build part of the version string. More... | |
| int | GetBuildVersion () |
| Gets the Build part of the version string. More... | |
| std::string | GetVersionString () |
| Returns the full version string. More... | |
| void | UpdateVersion () |
| Updates the version file to the most recent HG/Git Revision and YTMM. More... | |
Static Public Attributes | |
| static const std::string | VERSION_FILE_NAME = std::string("Version.trver") |
| static const std::string | MAJ_VERSION = std::string("Major") |
| static const std::string | MIN_VERSION = std::string("Minor") |
| static const std::string | YYMM_VERSION = std::string("YYMM") |
| static const std::string | BUILD_VERSION = std::string("Build") |
Private Member Functions | |
| std::string | GetTodaysVersionDate () |
| Returns todays date in the YYMM format as string. More... | |
| int | GetCurrentCommitNum () |
| Returns the current system HG/Git revision number. More... | |
Private Attributes | |
| JSON::File | mVersion |
| std::string | mRepoPath = trUtil::StringUtils::STR_BLANK |
A utility to read and control the engines version numbers.
Definition at line 45 of file VersionUtil.h.
| trUtil::VersionUtil::VersionUtil | ( | ) |
ctor.
Definition at line 45 of file VersionUtil.cpp.
| trUtil::VersionUtil::VersionUtil | ( | std::string | fileName | ) |
Constructor.
| fileName | Filename of the custom version file. |
Definition at line 49 of file VersionUtil.cpp.
| trUtil::VersionUtil::VersionUtil | ( | std::string | fileName, |
| std::string | filePath | ||
| ) |
Constructor.
| fileName | Filename of the custom version file. |
| filePath | Full path to where the version file is located. |
Definition at line 53 of file VersionUtil.cpp.
| trUtil::VersionUtil::VersionUtil | ( | std::string | fileName, |
| std::string | filePath, | ||
| std::string | repoPath | ||
| ) |
Constructor.
| fileName | Filename of the file. |
| filePath | Full pathname of the file. |
| repoPath | Full pathname of the repo. |
Definition at line 57 of file VersionUtil.cpp.
References trUtil::JSON::File::FileExists(), GenerateVersionStructure(), trUtil::JSON::File::GetFilePath(), LOG_W, mRepoPath, mVersion, trUtil::JSON::File::ReadFromFile(), SaveVersionFile(), trUtil::JSON::File::SetFileName(), and trUtil::JSON::File::SetFilePath().

| trUtil::VersionUtil::~VersionUtil | ( | ) |
dtor.
Definition at line 81 of file VersionUtil.cpp.
| void trUtil::VersionUtil::GenerateVersionStructure | ( | ) |
Generates a copy of the version file in RAM.
Definition at line 110 of file VersionUtil.cpp.
References GetCurrentCommitNum(), GetTodaysVersionDate(), and SetVersion().
Referenced by VersionUtil().


| int trUtil::VersionUtil::GetBuildVersion | ( | ) |
Gets the Build part of the version string.
Definition at line 172 of file VersionUtil.cpp.
References BUILD_VERSION, trUtil::JSON::File::GetInt(), and mVersion.
Referenced by GetVersionString(), and IncrementVersion().


|
private |
Returns the current system HG/Git revision number.
Note that the revision number is not the commit hash and could be different on individual systems. The best place to use this is on a build server. This needs TR_ROOT to be set, and .hg or .git folder to be in TR_ROOT.
Definition at line 220 of file VersionUtil.cpp.
References BRIGHT_RED, DEFAULT, trUtil::StringUtils::FindAndReplace(), trUtil::FileUtils::GetInstance(), LOG_E, trUtil::Exception::LogException(), mRepoPath, trUtil::FileUtils::RunCommand(), trUtil::StringUtils::STR_BLANK(), and trUtil::Console::TextColor().
Referenced by GenerateVersionStructure(), and UpdateVersion().


| int trUtil::VersionUtil::GetMajorVersion | ( | ) |
Gets the Major part of the version string.
Definition at line 130 of file VersionUtil.cpp.
References trUtil::JSON::File::GetInt(), MAJ_VERSION, and mVersion.
Referenced by GetVersionString(), trUtil::Console::Logo(), and UpdateVersion().


| int trUtil::VersionUtil::GetMinorVersion | ( | ) |
Gets the Minor part of the version string.
Definition at line 142 of file VersionUtil.cpp.
References trUtil::JSON::File::GetInt(), MIN_VERSION, and mVersion.
Referenced by GetVersionString(), trUtil::Console::Logo(), and UpdateVersion().


|
private |
Returns todays date in the YYMM format as string.
Definition at line 191 of file VersionUtil.cpp.
References trUtil::DateTime::GetMonth(), and trUtil::DateTime::GetYear().
Referenced by GenerateVersionStructure(), IncrementVersion(), and UpdateVersion().


| std::string trUtil::VersionUtil::GetVersionString | ( | ) |
Returns the full version string.
Definition at line 177 of file VersionUtil.cpp.
References GetBuildVersion(), GetMajorVersion(), GetMinorVersion(), GetYYMMVersion(), and LOG_E.
Referenced by IncremenetVersion(), trUtil::Console::Logo(), main(), SetVersion(), and UpdateVersion().


| std::string trUtil::VersionUtil::GetYYMMVersion | ( | ) |
Gets the Year/Month part of the version string.
Definition at line 160 of file VersionUtil.cpp.
References trUtil::JSON::File::GetString(), mVersion, and YYMM_VERSION.
Referenced by GetVersionString().


| void trUtil::VersionUtil::IncrementVersion | ( | ) |
Increments the version number of the build by one and sets the YYMM to current date.
Definition at line 117 of file VersionUtil.cpp.
References GetBuildVersion(), GetTodaysVersionDate(), SetBuildVersion(), and SetYYMMVersion().
Referenced by IncremenetVersion().


| void trUtil::VersionUtil::SaveVersionFile | ( | ) |
Saves the version file currently in RAM to default location.
Definition at line 86 of file VersionUtil.cpp.
References mVersion, and trUtil::JSON::File::WriteToFile().
Referenced by IncremenetVersion(), main(), SetVersion(), UpdateVersion(), and VersionUtil().


| void trUtil::VersionUtil::SetBuildVersion | ( | int | build | ) |
Sets the Build part of the version string.
| build | The build. |
Definition at line 166 of file VersionUtil.cpp.
References BUILD_VERSION, mVersion, and trUtil::JSON::File::SetInt().
Referenced by IncrementVersion(), main(), and SetVersion().


| void trUtil::VersionUtil::SetMajorVersion | ( | int | maj | ) |
Sets the Major part of the version string.
| maj | The maj. |
Definition at line 124 of file VersionUtil.cpp.
References MAJ_VERSION, mVersion, and trUtil::JSON::File::SetInt().
Referenced by main(), and SetVersion().


| void trUtil::VersionUtil::SetMinorVersion | ( | int | min | ) |
Sets the Minor part of the version string.
| min | The minimum. |
Definition at line 136 of file VersionUtil.cpp.
References MIN_VERSION, mVersion, and trUtil::JSON::File::SetInt().
Referenced by main(), and SetVersion().


| void trUtil::VersionUtil::SetVersion | ( | int | maj, |
| int | min, | ||
| std::string | yymm, | ||
| int | build | ||
| ) |
Sets the version numbers.
Fills in the version numbers.
| maj | The maj. |
| min | The minimum. |
| yymm | The yymm. |
| build | The build. |
Definition at line 92 of file VersionUtil.cpp.
References SetBuildVersion(), SetMajorVersion(), SetMinorVersion(), and SetYYMMVersion().
Referenced by GenerateVersionStructure(), SetVersion(), and UpdateVersion().


| void trUtil::VersionUtil::SetVersion | ( | int | maj, |
| int | min, | ||
| int | yymm, | ||
| int | build | ||
| ) |
Sets the version numbers.
Fills in the version numbers.
| maj | The maj. |
| min | The minimum. |
| yymm | The yymm. |
| build | The build. |
Definition at line 101 of file VersionUtil.cpp.
References SetBuildVersion(), SetMajorVersion(), SetMinorVersion(), and SetYYMMVersion().

| void trUtil::VersionUtil::SetYYMMVersion | ( | std::string | yymm | ) |
Sets the Year/Month part of the version string.
| yymm | The yymm. |
Definition at line 148 of file VersionUtil.cpp.
References mVersion, trUtil::JSON::File::SetString(), and YYMM_VERSION.
Referenced by IncrementVersion(), main(), and SetVersion().


| void trUtil::VersionUtil::SetYYMMVersion | ( | int | yymm | ) |
Sets the Year/Month part of the version string.
| yymm | The yymm. |
Definition at line 154 of file VersionUtil.cpp.
References mVersion, trUtil::JSON::File::SetInt(), and YYMM_VERSION.

| void trUtil::VersionUtil::UpdateVersion | ( | ) |
Updates the version file to the most recent HG/Git Revision and YTMM.
Definition at line 262 of file VersionUtil.cpp.
References GetCurrentCommitNum(), GetMajorVersion(), GetMinorVersion(), GetTodaysVersionDate(), and SetVersion().
Referenced by UpdateVersion().


|
static |
Definition at line 53 of file VersionUtil.h.
Referenced by GetBuildVersion(), and SetBuildVersion().
|
static |
Definition at line 50 of file VersionUtil.h.
Referenced by GetMajorVersion(), and SetMajorVersion().
|
static |
Definition at line 51 of file VersionUtil.h.
Referenced by GetMinorVersion(), and SetMinorVersion().
|
private |
Definition at line 244 of file VersionUtil.h.
Referenced by GetCurrentCommitNum(), and VersionUtil().
|
private |
Definition at line 242 of file VersionUtil.h.
Referenced by GetBuildVersion(), GetMajorVersion(), GetMinorVersion(), GetYYMMVersion(), SaveVersionFile(), SetBuildVersion(), SetMajorVersion(), SetMinorVersion(), SetYYMMVersion(), and VersionUtil().
|
static |
Definition at line 49 of file VersionUtil.h.
|
static |
Definition at line 52 of file VersionUtil.h.
Referenced by GetYYMMVersion(), and SetYYMMVersion().