2010-01-02 12:06:37 +00:00
|
|
|
#ifndef __STR_EXCEPTION_H
|
|
|
|
#define __STR_EXCEPTION_H
|
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
#include <string>
|
|
|
|
|
2010-06-25 13:20:04 +00:00
|
|
|
/** @brief A simple exception that takes and holds a string
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
throw str_exception("message");
|
|
|
|
|
|
|
|
*/
|
2010-01-02 12:06:37 +00:00
|
|
|
class str_exception : public std::exception
|
|
|
|
{
|
|
|
|
std::string msg;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
str_exception(const std::string &m) : msg(m) {}
|
|
|
|
~str_exception() throw() {}
|
|
|
|
const char* what() const throw() { return msg.c_str(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|