-/* $Id$
-
-This file is part of libmspstrings
-Copyright © 2006-2008 Mikko Rasa
-Distributed under the LGPL
-*/
-
#ifndef MSP_STRINGS_LEXICALCAST_H_
#define MSP_STRINGS_LEXICALCAST_H_
#include <sstream>
#include <string>
-#include <msp/core/except.h>
+#include <stdexcept>
#include "fmt.h"
namespace Msp {
/**
Thrown for errors in lexical conversions
*/
-class LexicalError: public Exception
+class lexical_error: public std::runtime_error
+{
+public:
+ lexical_error(const std::string &w): runtime_error(w) { }
+ virtual ~lexical_error() throw() { }
+};
+
+
+class format_mismatch: public lexical_error
{
public:
- LexicalError(const std::string &w_): Exception(w_) { }
+ format_mismatch(const std::string &w): lexical_error(w) { }
+ virtual ~format_mismatch() throw() { }
};
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