GG
Classes | Namespaces | Defines

Exception.h File Reference

Contains the GG::Exception base class and macros that ease declaring subclasses. More...

#include <GG/Export.h>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Classes

class  GG::ExceptionBase
 The base class for all GG exceptions. More...

Namespaces

namespace  GG

Defines

#define GG_EXCEPTION(name)
#define GG_ABSTRACT_EXCEPTION(name)
#define GG_CONCRETE_EXCEPTION(name, class_name, superclass)

Detailed Description

Contains the GG::Exception base class and macros that ease declaring subclasses.

Definition in file Exception.h.


Define Documentation

#define GG_EXCEPTION (   name)
Value:
class GG_API name : public ExceptionBase                            \
    {                                                                   \
    public:                                                             \
        name () throw() : ExceptionBase() {}                            \
        name (const std::string& msg) throw() : ExceptionBase(msg) {}   \
        virtual const char* type() const throw()                        \
            {return "GG::" # name ;}                                    \
    };

Declares a GG exception class. This should be used to declare GG exceptions at namespace scope.

Definition at line 61 of file Exception.h.

#define GG_ABSTRACT_EXCEPTION (   name)
Value:
class GG_API name : public ExceptionBase                            \
    {                                                                   \
    public:                                                             \
        name () throw() : ExceptionBase() {}                            \
        name (const std::string& msg) throw() : ExceptionBase(msg) {}   \
        virtual const char* type() const throw() = 0;                   \
    };

Declares an abstract base for further GG exception class inheritance. This should be used along with GG_CONCRETE_EXCEPTION to group all exceptions from a single GG class under one subhierarchy.

Definition at line 74 of file Exception.h.

#define GG_CONCRETE_EXCEPTION (   name,
  class_name,
  superclass 
)
Value:
class GG_API name : public superclass                               \
    {                                                                   \
    public:                                                             \
        name () throw() : superclass () {}                              \
        name (const std::string& msg) throw() : superclass (msg) {}     \
        virtual const char* type() const throw()                        \
            {return # class_name "::" # name ;}                         \
    };

Declares a concrete exception class derived from superclass. This should be used along with GG_ABSTRACT_EXCEPTION to group all exceptions from a single GG class under one subhierarchy.

Definition at line 86 of file Exception.h.