3131#ifndef __VERSION_H__
3232#define __VERSION_H__
3333
34+ #include < time.h>
35+
3436/* *
3537 * The Version class formats the version number into integer and string
3638 * values for different parts of the game.
3739 * @todo: increment build number on compile, and stamp exe with username
3840 */
41+ // TheSuperHackers @tweak The Version class now also provides Git information
42+ // alongside the original Version information.
3943class Version
4044{
4145public:
4246 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; }
5582 void setShowFullVersion ( Bool val ) { m_showFullVersion = val; }
5683
5784 void setVersion (Int major, Int minor, Int buildNum,
5885 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 ();
6097
6198private:
6299 Int m_major;
@@ -67,9 +104,15 @@ class Version
67104 AsciiString m_buildUser;
68105 AsciiString m_buildTime;
69106 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;
70113 Bool m_showFullVersion;
71114};
72115
73- extern Version *TheVersion; // /< The Version singleton
116+ extern Version *TheVersion;
74117
75118#endif // __VERSION_H__
0 commit comments