~ivantis/armagetronad/sty+ct+ivantis

« back to all changes in this revision

Viewing changes to src/tools/tException.h

  • Committer: ivantis
  • Date: 2008-09-09 21:33:18 UTC
  • Revision ID: ivantis@ivantis.net-20080909213318-k43y6yuq0zd6wbsa
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
*************************************************************************
 
4
 
 
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
 
6
Copyright (C) 2005  by Manuel Moos (z-man@users.sf.net)
 
7
and the AA DevTeam (see the file AUTHORS(.txt) in the main source directory)
 
8
 
 
9
**************************************************************************
 
10
 
 
11
This program is free software; you can redistribute it and/or
 
12
modify it under the terms of the GNU General Public License
 
13
as published by the Free Software Foundation; either version 2
 
14
of the License, or (at your option) any later version.
 
15
 
 
16
This program is distributed in the hope that it will be useful,
 
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
GNU General Public License for more details.
 
20
 
 
21
You should have received a copy of the GNU General Public License
 
22
along with this program; if not, write to the Free Software
 
23
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
24
  
 
25
***************************************************************************
 
26
 
 
27
*/
 
28
 
 
29
#ifndef ArmageTron_tEXCEPTION_H
 
30
#define ArmageTron_tEXCEPTION_H
 
31
 
 
32
#include "tString.h"
 
33
 
 
34
//! Base class for all exceptions
 
35
class tException
 
36
{
 
37
public:
 
38
    tString GetName()           const;                      //!< returns the name of the exception
 
39
    tString GetDescription()    const;                      //!< returns a detailed description
 
40
 
 
41
protected:
 
42
    virtual ~tException();                                  //!< destructor
 
43
 
 
44
private:
 
45
    virtual tString DoGetName()         const = 0;          //!< returns the name of the exception
 
46
    virtual tString DoGetDescription()  const;              //!< returns a detailed description
 
47
};
 
48
 
 
49
//! Simple, generic exception class for locally fatal errors (that abort a function,
 
50
//  but not the program)
 
51
class tGenericException: public tException
 
52
{
 
53
public:
 
54
    virtual ~tGenericException();                                             //!< destructor
 
55
    tGenericException( char const * description, char const * name = NULL );  //!< constructor from description and name
 
56
private:
 
57
    virtual tString DoGetName()         const;              //!< returns the name of the exception
 
58
    virtual tString DoGetDescription()  const;              //!< returns a detailed description
 
59
 
 
60
    tString description_;   //!< exception description
 
61
    tString name_;          //!< exception name
 
62
};
 
63
 
 
64
#endif