From 74e8a4a4e07238d7aefab9dc038aeb9339a69515 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 24 Jul 2009 09:13:28 +0000 Subject: Added exception throwing info. --- server/src/versionstr.cc | 8 +++----- server/src/versionstr.h | 10 +++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/server/src/versionstr.cc b/server/src/versionstr.cc index bfa8bb4..6069dce 100644 --- a/server/src/versionstr.cc +++ b/server/src/versionstr.cc @@ -27,8 +27,6 @@ */ #include "versionstr.h" -#include "exception.h" - #include #include @@ -43,7 +41,7 @@ #undef patch #endif -VersionStr::VersionStr(std::string v) +VersionStr::VersionStr(std::string v) throw(Exception) { memset(version, 0, sizeof(version)); set(v); @@ -56,7 +54,7 @@ VersionStr::VersionStr(size_t major, size_t minor, size_t patch) version[2] = patch; } -void VersionStr::set(std::string v) +void VersionStr::set(std::string v) throw(Exception) { std::string num; size_t idx = 0; @@ -87,7 +85,7 @@ VersionStr::operator std::string() const return v; } -void VersionStr::operator=(std::string v) +void VersionStr::operator=(std::string v) throw(Exception) { set(v); } diff --git a/server/src/versionstr.h b/server/src/versionstr.h index ceed42f..f54bf8d 100644 --- a/server/src/versionstr.h +++ b/server/src/versionstr.h @@ -30,6 +30,8 @@ #include +#include "exception.h" + // Workaround - major, minor and patch are defined as macros when using _GNU_SOURCES #ifdef major #undef major @@ -50,9 +52,10 @@ class VersionStr { public: /** * Constructor. + * Throws an exeption if the string does not parse. * @param v A std::string containing a version string on the form a.b or a.b.c */ - VersionStr(std::string v); + VersionStr(std::string v) throw(Exception); /** * Constructor. @@ -72,8 +75,9 @@ public: /** * Assignment from std::string operator. * Same as in the VersionStr(std::string v) constructor. + * Throws an exeption if the string does not parse. */ - void operator=(std::string v); + void operator=(std::string v) throw(Exception); /** * Comparison operator. @@ -98,7 +102,7 @@ public: size_t patch() const; private: - void set(std::string v); + void set(std::string v) throw(Exception); size_t version[3]; }; -- cgit v1.2.3