X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstrings%2Flexicalcast.h;h=b41654d1537a822f8a13af2d1a0616a4761d0e2f;hb=4a38eb20402936497cbb75527dd7a7b321f51415;hp=3bfc342a1f584e91cc218eb24b226c7a29c777da;hpb=b56eb5ec1da675da0c66abc53c1e4f6c4e4cccbd;p=libs%2Fcore.git diff --git a/source/strings/lexicalcast.h b/source/strings/lexicalcast.h index 3bfc342..b41654d 100644 --- a/source/strings/lexicalcast.h +++ b/source/strings/lexicalcast.h @@ -10,7 +10,7 @@ Distributed under the LGPL #include #include -#include +#include #include "fmt.h" namespace Msp { @@ -18,10 +18,19 @@ namespace Msp { /** Thrown for errors in lexical conversions */ -class LexicalError: public Exception +class lexical_error: public std::runtime_error { public: - LexicalError(const std::string &w_): Exception(w_) { } + lexical_error(const std::string &w): runtime_error(w) { } + virtual ~lexical_error() throw() { } +}; + + +class format_mismatch: public lexical_error +{ +public: + format_mismatch(const std::string &w): lexical_error(w) { } + virtual ~format_mismatch() throw() { } }; @@ -101,7 +110,7 @@ void operator>>(const LexicalConverter &c, T &v) ss.setf(std::ios_base::fmtflags(0), std::ios_base::skipws); ss>>v; if(ss.fail() || !ss.eof()) - throw LexicalError("Conversion failure"); + throw lexical_error("conversion failure"); } // The main interface to the lexical conversion machinery