31
31
#ifndef __VERSION_H__
32
32
#define __VERSION_H__
33
33
34
+ #include < time.h>
35
+
34
36
/* *
35
37
* The Version class formats the version number into integer and string
36
38
* values for different parts of the game.
37
39
* @todo: increment build number on compile, and stamp exe with username
38
40
*/
41
+ // TheSuperHackers @tweak The Version class now also provides Git information
42
+ // alongside the original Version information.
39
43
class Version
40
44
{
41
45
public:
42
46
Version ();
43
- UnsignedInt getVersionNumber ( void ); // /< Return a 4-byte integer suitable for WOLAPI
44
- AsciiString getAsciiVersion ( void ); // /< Return a human-readable version number
45
- UnicodeString getUnicodeVersion ( void ); // /< Return a human-readable version number
46
- UnicodeString getFullUnicodeVersion ( void ); // /< Return a human-readable version number
47
- AsciiString getAsciiBuildTime ( void ); // /< Return a formated date/time string for build time
48
- UnicodeString getUnicodeBuildTime ( void ); // /< Return a formated date/time string for build time
49
- AsciiString getAsciiBuildLocation ( void ); // /< Return a string with the build location
50
- UnicodeString getUnicodeBuildLocation ( void ); // /< Return a string with the build location
51
- AsciiString getAsciiBuildUser ( void ); // /< Return a string with the build user
52
- UnicodeString getUnicodeBuildUser ( void ); // /< Return a string with the build user
53
-
54
- Bool showFullVersion ( void ) { return m_showFullVersion; }
47
+
48
+ UnsignedInt getVersionNumber () const ; // /< Return a 4-byte integer suitable for WOLAPI
49
+
50
+ AsciiString getAsciiVersion () const ; // /< Return a human-readable version number
51
+ UnicodeString getUnicodeVersion () const ; // /< Return a human-readable version number. Is decorated with localized string
52
+
53
+ AsciiString getAsciiBuildTime () const ; // /< Return a formated date/time string for build time
54
+ UnicodeString getUnicodeBuildTime () const ; // /< Return a formated date/time string for build time. Is decorated with localized string
55
+
56
+ AsciiString getAsciiBuildLocation () const ; // /< Return a string with the build location
57
+ UnicodeString getUnicodeBuildLocation () const ; // /< Return a string with the build location. Is decorated with localized string
58
+
59
+ AsciiString getAsciiBuildUser () const ; // /< Return a string with the build user
60
+ UnicodeString getUnicodeBuildUser () const ; // /< Return a string with the build user. Is decorated with localized string
61
+
62
+ static Int getGitCommitCount (); // /< Returns the git commit count as a number
63
+ static time_t getGitCommitTime (); // /< Returns the git head commit time as a UTC timestamp
64
+ static const char * getGitCommitAuthorName (); // /< Returns the git head commit author name
65
+
66
+ AsciiString getAsciiGitCommitCount () const ; // /< Returns the git commit count. Is prefixed with ~ if there were uncommitted changes.
67
+ UnicodeString getUnicodeGitCommitCount () const ; // /< Returns the git commit count. Is prefixed with ~ if there were uncommitted changes.
68
+
69
+ AsciiString getAsciiGitTagOrHash () const ; // /< Returns the git head commit tag or hash. Is prefixed with ~ if there were uncommitted changes.
70
+ UnicodeString getUnicodeGitTagOrHash () const ; // /< Returns the git head commit tag or hash. Is prefixed with ~ if there were uncommitted changes.
71
+
72
+ AsciiString getAsciiGitCommitTime () const ; // /< Returns the git head commit time in YYYY-mm-dd HH:MM:SS format
73
+ UnicodeString getUnicodeGitCommitTime () const ; // /< Returns the git head commit time in YYYY-mm-dd HH:MM:SS format
74
+
75
+ AsciiString getAsciiGameAndGitVersion () const ; // /< Returns the game and git version
76
+ UnicodeString getUnicodeGameAndGitVersion () const ; // /< Returns the game and git version. Is decorated with localized string
77
+
78
+ AsciiString getAsciiBuildUserOrGitCommitAuthorName () const ;
79
+ UnicodeString getUnicodeBuildUserOrGitCommitAuthorName () const ; // /< Is decorated with localized string
80
+
81
+ Bool showFullVersion () const { return m_showFullVersion; }
55
82
void setShowFullVersion ( Bool val ) { m_showFullVersion = val; }
56
83
57
84
void setVersion (Int major, Int minor, Int buildNum,
58
85
Int localBuildNum, AsciiString user, AsciiString location,
59
- AsciiString buildTime, AsciiString buildDate); // /< Set version info
86
+ AsciiString buildTime, AsciiString buildDate);
87
+
88
+ private:
89
+ static AsciiString buildAsciiGitCommitCount ();
90
+ static UnicodeString buildUnicodeGitCommitCount ();
91
+
92
+ static AsciiString buildAsciiGitTagOrHash ();
93
+ static UnicodeString buildUnicodeGitTagOrHash ();
94
+
95
+ static AsciiString buildAsciiGitCommitTime ();
96
+ static UnicodeString buildUnicodeGitCommitTime ();
60
97
61
98
private:
62
99
Int m_major;
@@ -67,9 +104,15 @@ class Version
67
104
AsciiString m_buildUser;
68
105
AsciiString m_buildTime;
69
106
AsciiString m_buildDate;
107
+ AsciiString m_asciiGitCommitCount;
108
+ AsciiString m_asciiGitTagOrHash;
109
+ AsciiString m_asciiGitCommitTime;
110
+ UnicodeString m_unicodeGitCommitCount;
111
+ UnicodeString m_unicodeGitTagOrHash;
112
+ UnicodeString m_unicodeGitCommitTime;
70
113
Bool m_showFullVersion;
71
114
};
72
115
73
- extern Version *TheVersion; // /< The Version singleton
116
+ extern Version *TheVersion;
74
117
75
118
#endif // __VERSION_H__
0 commit comments