Initial commit, includes Lua with broken Luabind as a backup for branching purposes
[terrastrategy.git] / include / exception.h
blobe6dc2ef47a8b15490847208c402ec5ffff79261f
1 //
2 // Copyright (C) 2007 by Martin Moracek
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /**
20 * @file exception.h
22 * This file contains custom exception interface
24 * Contains declaration of the Exception class, derived from std::exception.
27 #pragma once
29 #include <exception>
30 #include <string>
32 /**
33 * @class Exception
35 * Custom exception class. Used for every non-standard exception.
37 class Exception : public std::exception {
38 public:
39 /** Gets description of the thrown exception. */
40 virtual const char * what() const throw()
42 return whatString.c_str();
45 /** Copy constructor. */
46 Exception(const std::string & str)
48 whatString = str;
51 virtual ~Exception() throw()
55 private:
56 /** String briefly describing the cause of the exception. */
57 std::string whatString;