diff options
| author | Adam <Adam@Anope.org> | 2010-06-25 20:00:21 -0400 |
|---|---|---|
| committer | Adam <Adam@Anope.org> | 2010-06-25 20:00:21 -0400 |
| commit | 03fbc7d281f5039a97c851970dea3cd8cfaefd64 (patch) | |
| tree | c527046a41b97751b1a52ba7046e36337f0d0373 /include/services.h | |
| parent | cbcead4e89b3dc0dfb236fff9cb3e62b1b0707c0 (diff) | |
Changed the versioning system to use git
Diffstat (limited to 'include/services.h')
| -rw-r--r-- | include/services.h | 28 |
1 files changed, 27 insertions, 1 deletions
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 <iostream> +#include <sstream> #include <string> #include <map> #include <exception> @@ -355,6 +357,19 @@ template<typename T> class Flags /*************************************************************************/ +template<typename T> +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<Message *> FindMessage(const std::string &name); - }; /*************************************************************************/ |
