Fixed a few issues, everything now works again.
[fail.git] / src / services / lua / error.h
blob09d2f454e2b995bd870ae3a2bfb5b18a5dce20ad
1 /*
2 Fail game engine
3 Copyright 2007 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Fail.
7 Fail is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Fail is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef FAIL_LUA_ERROR_H
20 #define FAIL_LUA_ERROR_H
22 #include <stdexcept>
24 namespace fail { namespace LuaImpl
26 namespace Error
28 class FLSERVICES_LUA_EXPORT Base
30 public:
31 virtual ~Base() {}
32 virtual void ConvertToLua( lua_State* pLS ) const = 0;
35 class FLSERVICES_LUA_EXPORT NotEnoughParams : public Base
37 public:
38 NotEnoughParams( int NumGot_, int NumExpected_ ) throw() :
39 m_NumGot( NumGot_ ),
40 m_NumExpected( NumExpected_ )
44 virtual void ConvertToLua( lua_State* pLS ) const;
46 private:
47 int m_NumGot;
48 int m_NumExpected;
51 class FLSERVICES_LUA_EXPORT TypeMismatch : public Base
53 public:
54 TypeMismatch( int Got_ = LUA_TNONE, int Expected_ = LUA_TNONE ) throw() :
55 m_Got( Got_ ),
56 m_Expected( Expected_ )
60 virtual void ConvertToLua( lua_State* pLS ) const;
62 protected:
63 int m_Got;
64 int m_Expected;
67 class FLSERVICES_LUA_EXPORT BadParameter : public TypeMismatch
69 public:
70 BadParameter( const TypeMismatch& TM_, int Index_, const char* pName_ ) throw() :
71 TypeMismatch( TM_ ),
72 m_Index( Index_ ),
73 m_pName( pName_ )
77 virtual void ConvertToLua( lua_State* pLS ) const;
79 private:
80 int m_Index;
81 const char* m_pName;
84 class FLSERVICES_LUA_EXPORT BadMethodCall : public Base
86 public:
87 virtual void ConvertToLua( lua_State* pLS ) const;
90 class FLSERVICES_LUA_EXPORT NoOverloadFound : public Base
92 public:
93 virtual void ConvertToLua( lua_State* pLS ) const;
96 class FLSERVICES_LUA_EXPORT NoSuchAttribute : public Base
98 public:
99 NoSuchAttribute( const char* pName_ ) :
100 m_Name( pName_ )
104 virtual void ConvertToLua( lua_State* pLS ) const;
106 private:
107 std::string m_Name;
110 class FLSERVICES_LUA_EXPORT BadSetAttribute : public TypeMismatch
112 public:
113 BadSetAttribute( const TypeMismatch& TM_, const char* pName_ ) throw() :
114 TypeMismatch( TM_ ),
115 m_pName( pName_ )
119 virtual void ConvertToLua( lua_State* pLS ) const;
121 private:
122 const char* m_pName;
127 #endif