Tidy up BuildInfo documentation

This commit is contained in:
Vinnie Falco
2013-07-30 18:08:49 -07:00
parent 5959c4e312
commit db08a5946f
2 changed files with 32 additions and 19 deletions

View File

@@ -17,12 +17,10 @@ String const& BuildInfo::getVersionString ()
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
; ;
struct StaticInitializer struct SanityChecker
{ {
StaticInitializer () SanityChecker ()
{ {
// Sanity checking on the raw text
Version v; Version v;
if (! v.parse (rawText) || v.print () != rawText) if (! v.parse (rawText) || v.print () != rawText)
@@ -34,39 +32,54 @@ String const& BuildInfo::getVersionString ()
String versionString; String versionString;
}; };
static StaticInitializer value; static SanityChecker value;
return value.versionString; return value.versionString;
} }
// The protocol version we speak and prefer.
//
BuildInfo::Protocol const& BuildInfo::getCurrentProtocol () BuildInfo::Protocol const& BuildInfo::getCurrentProtocol ()
{ {
static Protocol currentProtocol (1, 2); static Protocol currentProtocol (
//--------------------------------------------------------------------------
//
// The protocol version we speak and prefer (edit this if necessary)
//
1, // major
2 // minor
//
//--------------------------------------------------------------------------
);
return currentProtocol; return currentProtocol;
} }
// The oldest protocol version we will accept.
//
BuildInfo::Protocol const& BuildInfo::getMinimumProtocol () BuildInfo::Protocol const& BuildInfo::getMinimumProtocol ()
{ {
static Protocol minimumProtocol (1, 2); static Protocol minimumProtocol (
//--------------------------------------------------------------------------
//
// The oldest protocol version we will accept. (edit this if necessary)
//
1, // major
2 // minor
//
//--------------------------------------------------------------------------
);
return minimumProtocol; return minimumProtocol;
} }
// Don't touch anything below this line // Don't touch anything below this line
//
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
char const* BuildInfo::getFullVersionString () char const* BuildInfo::getFullVersionString ()
{ {
struct StaticInitializer struct PrettyPrinter
{ {
StaticInitializer () PrettyPrinter ()
{ {
String s; String s;
@@ -78,7 +91,7 @@ char const* BuildInfo::getFullVersionString ()
std::string fullVersionString; std::string fullVersionString;
}; };
static StaticInitializer value; static PrettyPrinter value;
return value.fullVersionString.c_str (); return value.fullVersionString.c_str ();
} }

View File

@@ -20,7 +20,7 @@ struct BuildInfo
The version string is formatted thusly: The version string is formatted thusly:
<major> '.' <minor> '.' ['-' <suffix>] <major> '.' <minor> ['-' <suffix>]
The minor version number is always padded with leading zeroes The minor version number is always padded with leading zeroes
to bring the number of characters up to exactly three. For example, to bring the number of characters up to exactly three. For example,