Chris@16: // Copyright David Abrahams 2001. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef CLASS_DWA20011214_HPP Chris@16: # define CLASS_DWA20011214_HPP Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: namespace boost { namespace python { Chris@16: Chris@16: namespace objects { Chris@16: Chris@16: struct BOOST_PYTHON_DECL class_base : python::api::object Chris@16: { Chris@16: // constructor Chris@16: class_base( Chris@16: char const* name // The name of the class Chris@16: Chris@16: , std::size_t num_types // A list of class_ids. The first is the type Chris@16: , type_info const*const types // this is wrapping. The rest are the types of Chris@16: // any bases. Chris@16: Chris@16: , char const* doc = 0 // Docstring, if any. Chris@16: ); Chris@16: Chris@16: Chris@16: // Implementation detail. Hiding this in the private section would Chris@16: // require use of template friend declarations. Chris@16: void enable_pickling_(bool getstate_manages_dict); Chris@16: Chris@16: protected: Chris@16: void add_property( Chris@16: char const* name, object const& fget, char const* docstr); Chris@16: void add_property(char const* name, Chris@16: object const& fget, object const& fset, char const* docstr); Chris@16: Chris@16: void add_static_property(char const* name, object const& fget); Chris@16: void add_static_property(char const* name, object const& fget, object const& fset); Chris@16: Chris@16: // Retrieve the underlying object Chris@16: void setattr(char const* name, object const&); Chris@16: Chris@16: // Set a special attribute in the class which tells Boost.Python Chris@16: // to allocate extra bytes for embedded C++ objects in Python Chris@16: // instances. Chris@16: void set_instance_size(std::size_t bytes); Chris@16: Chris@16: // Set an __init__ function which throws an appropriate exception Chris@16: // for abstract classes. Chris@16: void def_no_init(); Chris@16: Chris@16: // Effects: Chris@16: // setattr(self, staticmethod(getattr(self, method_name))) Chris@16: void make_method_static(const char *method_name); Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::python::objects Chris@16: Chris@16: #endif // CLASS_DWA20011214_HPP