Add exceptions to the system.
[tairon.git] / src / core / exceptions.h
blob81e68ff4a922a8a3543626c85888deea97e5b5bd
1 /***************************************************************************
2 * *
3 * Copyright (C) 2006 David Brodsky *
4 * *
5 * This library is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU Library General Public *
7 * License as published by the Free Software Foundation and appearing *
8 * in the file LICENSE.LGPL included in the packaging of this file. *
9 * *
10 * This library is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 * Library General Public License for more details. *
14 * *
15 ***************************************************************************/
17 #ifndef _tairon_core_exceptions_h
18 #define _tairon_core_exceptions_h
20 #include "string.h"
22 namespace Tairon
25 namespace Core
28 /** \brief Basic class for all Tairon-related exceptions.
30 class Exception
32 public:
33 /** Constructor that takes as an argument only description of the exception.
35 Exception(const String &desc);
37 /** Does nothing.
39 virtual ~Exception() {};
41 /** Cast operator.
43 virtual operator const String &();
45 protected:
46 /** Description of the exception.
48 String description;
51 /** \brief Exception thrown when a given key is invalid.
53 class KeyException : public Exception
55 public:
56 /** Standard constructor.
58 KeyException(const String &desc) : Exception(desc) {};
60 /** Default destructor.
62 virtual ~KeyException() {};
65 }; // namespace Core
67 }; // namespace Tairon
70 #endif
72 // vim: ai sw=4 ts=4 noet fdm=marker