Update contrib.
1 // Copyright David Abrahams 2001.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef FUNCTION_DWA20011214_HPP
6 # define FUNCTION_DWA20011214_HPP
8 # include <boost/python/detail/prefix.hpp>
9 # include <boost/python/args_fwd.hpp>
10 # include <boost/python/handle.hpp>
11 # include <boost/function/function2.hpp>
12 # include <boost/python/object_core.hpp>
13 # include <boost/python/object/py_function.hpp>
15 namespace boost { namespace python { namespace objects {
17 struct BOOST_PYTHON_DECL function : PyObject
21 , python::detail::keyword const* names_and_defaults
22 , unsigned num_keywords);
26 PyObject* call(PyObject*, PyObject*) const;
28 // Add an attribute to the name_space with the given name. If it is
29 // a function object (this class), and an existing function is
30 // already there, add it as an overload.
31 static void add_to_namespace(
32 object const& name_space, char const* name, object const& attribute);
34 static void add_to_namespace(
35 object const& name_space, char const* name, object const& attribute, char const* doc);
37 object const& doc() const;
38 void doc(object const& x);
40 object const& name() const;
42 private: // helper functions
43 object signature(bool show_return_type=false) const;
44 object signatures(bool show_return_type=false) const;
45 void argument_error(PyObject* args, PyObject* keywords) const;
46 void add_overload(handle<function> const&);
48 private: // data members
50 handle<function> m_overloads;
55 unsigned m_nkeyword_values;
61 inline object const& function::doc() const
66 inline void function::doc(object const& x)
71 inline object const& function::name() const
76 }}} // namespace boost::python::objects
78 #endif // FUNCTION_DWA20011214_HPP