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