Remove a lot of unused code.
[luabind.git] / src / class_info.cpp
blob15a73cd3ff5371aaec51e244b97c03aae9ae0eb6
1 // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the "Software"),
5 // to deal in the Software without restriction, including without limitation
6 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 // and/or sell copies of the Software, and to permit persons to whom the
8 // Software is furnished to do so, subject to the following conditions:
10 // The above copyright notice and this permission notice shall be included
11 // in all copies or substantial portions of the Software.
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
14 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
18 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21 // OR OTHER DEALINGS IN THE SOFTWARE.
23 #define LUABIND_BUILDING
25 #include <luabind/lua_include.hpp>
27 #include <luabind/luabind.hpp>
28 #include <luabind/class_info.hpp>
30 namespace luabind
32 class_info get_class_info(const object& o)
34 lua_State* L = o.interpreter();
36 class_info result;
38 o.push(L);
39 detail::object_rep* obj = static_cast<detail::object_rep*>(lua_touserdata(L, -1));
40 lua_pop(L, 1);
42 result.name = obj->crep()->name();
43 obj->crep()->get_table(L);
45 object methods(from_stack(L, -1));
47 methods.swap(result.methods);
48 lua_pop(L, 1);
50 result.attributes = newtable(L);
52 return result;
55 void bind_class_info(lua_State* L)
57 module(L)
59 class_<class_info>("class_info_data")
60 .def_readonly("name", &class_info::name)
61 .def_readonly("methods", &class_info::methods)
62 .def_readonly("attributes", &class_info::attributes),
64 def("class_info", &get_class_info)