Chris@16
|
1 // Copyright David Abrahams 2001.
|
Chris@16
|
2 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
3 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5 #ifndef CLASS_DWA20011214_HPP
|
Chris@16
|
6 # define CLASS_DWA20011214_HPP
|
Chris@16
|
7
|
Chris@16
|
8 # include <boost/python/detail/prefix.hpp>
|
Chris@16
|
9 # include <boost/python/object_core.hpp>
|
Chris@16
|
10 # include <boost/python/type_id.hpp>
|
Chris@16
|
11 # include <cstddef>
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost { namespace python {
|
Chris@16
|
14
|
Chris@16
|
15 namespace objects {
|
Chris@16
|
16
|
Chris@16
|
17 struct BOOST_PYTHON_DECL class_base : python::api::object
|
Chris@16
|
18 {
|
Chris@16
|
19 // constructor
|
Chris@16
|
20 class_base(
|
Chris@16
|
21 char const* name // The name of the class
|
Chris@16
|
22
|
Chris@16
|
23 , std::size_t num_types // A list of class_ids. The first is the type
|
Chris@16
|
24 , type_info const*const types // this is wrapping. The rest are the types of
|
Chris@16
|
25 // any bases.
|
Chris@16
|
26
|
Chris@16
|
27 , char const* doc = 0 // Docstring, if any.
|
Chris@16
|
28 );
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 // Implementation detail. Hiding this in the private section would
|
Chris@16
|
32 // require use of template friend declarations.
|
Chris@16
|
33 void enable_pickling_(bool getstate_manages_dict);
|
Chris@16
|
34
|
Chris@16
|
35 protected:
|
Chris@16
|
36 void add_property(
|
Chris@16
|
37 char const* name, object const& fget, char const* docstr);
|
Chris@16
|
38 void add_property(char const* name,
|
Chris@16
|
39 object const& fget, object const& fset, char const* docstr);
|
Chris@16
|
40
|
Chris@16
|
41 void add_static_property(char const* name, object const& fget);
|
Chris@16
|
42 void add_static_property(char const* name, object const& fget, object const& fset);
|
Chris@16
|
43
|
Chris@16
|
44 // Retrieve the underlying object
|
Chris@16
|
45 void setattr(char const* name, object const&);
|
Chris@16
|
46
|
Chris@16
|
47 // Set a special attribute in the class which tells Boost.Python
|
Chris@16
|
48 // to allocate extra bytes for embedded C++ objects in Python
|
Chris@16
|
49 // instances.
|
Chris@16
|
50 void set_instance_size(std::size_t bytes);
|
Chris@16
|
51
|
Chris@16
|
52 // Set an __init__ function which throws an appropriate exception
|
Chris@16
|
53 // for abstract classes.
|
Chris@16
|
54 void def_no_init();
|
Chris@16
|
55
|
Chris@16
|
56 // Effects:
|
Chris@16
|
57 // setattr(self, staticmethod(getattr(self, method_name)))
|
Chris@16
|
58 void make_method_static(const char *method_name);
|
Chris@16
|
59 };
|
Chris@16
|
60
|
Chris@16
|
61 }}} // namespace boost::python::objects
|
Chris@16
|
62
|
Chris@16
|
63 #endif // CLASS_DWA20011214_HPP
|