diff options
| author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-26 01:39:11 -0400 |
|---|---|---|
| committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-26 01:39:11 -0400 |
| commit | 4e31757f1467b36034e1dcef10d78533ff302d57 (patch) | |
| tree | 1cc9e0ec4f450c7fa33ced1b0e39a3355fedd636 /include/services.h | |
| parent | 6dc3af5db41ecb24669b259c776c51964539d531 (diff) | |
| parent | c7cb8897b400f5df31d0ae12dcce892a2b0d1590 (diff) | |
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
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); - }; /*************************************************************************/ |
