From 03fbc7d281f5039a97c851970dea3cd8cfaefd64 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Jun 2010 20:00:21 -0400 Subject: Changed the versioning system to use git --- include/services.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'include/services.h') diff --git a/include/services.h b/include/services.h index 900c8d49c..c945c10d4 100644 --- a/include/services.h +++ b/include/services.h @@ -16,6 +16,7 @@ /*************************************************************************/ +#include "version.h" #include "sysconf.h" #define BUFSIZE 1024 @@ -202,6 +203,7 @@ extern "C" void __pfnBkCheck() {} /* Pull in the various bits of STL */ #include +#include #include #include #include @@ -355,6 +357,19 @@ template class Flags /*************************************************************************/ +template +inline const std::string stringify(const T &x) +{ + std::stringstream stream; + + if (!(stream << x)) + throw CoreException("Stringify fail"); + + return stream.str(); +} + +/*************************************************************************/ + /* forward declarations, mostly used by older code */ class User; class ChannelInfo; @@ -1036,7 +1051,19 @@ struct Message; // XXX class CoreExport Anope { + private: + static const char * const compiled; public: + static inline const std::string Version() + { + return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA " (" + stringify(VERSION_BUILD) + ")"; + } + + static inline const std::string Build() + { + return "build #" + stringify(BUILD) + ", compiled " + compiled; + } + /** Check whether two strings match. * @param str The string to check against the pattern (e.g. foobar) * @param mask The pattern to check (e.g. foo*bar) @@ -1064,7 +1091,6 @@ class CoreExport Anope * @return a vector with pointers to the messagehandlers (you can bind more than one handler to a message) */ static std::vector FindMessage(const std::string &name); - }; /*************************************************************************/ -- cgit