From 4250893d2f73a85d319d421b20dcd8fa833daaea Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 17 Apr 2002 00:22:38 +0000 Subject: [PATCH] doc updates, arbitrary arity constructors [SVN r13511] --- doc/v2/call.html | 9 +- doc/v2/make_function.html | 2 +- doc/v2/reference.html | 251 ++++++++++++++++++++++----------- test/Jamfile | 1 + test/multi_arg_constructor.cpp | 22 +++ test/multi_arg_constructor.py | 16 +++ 6 files changed, 214 insertions(+), 87 deletions(-) create mode 100644 test/multi_arg_constructor.cpp create mode 100644 test/multi_arg_constructor.py diff --git a/doc/v2/call.html b/doc/v2/call.html index eb3e706c..4ba3dd96 100644 --- a/doc/v2/call.html +++ b/doc/v2/call.html @@ -21,7 +21,6 @@

Contents

Introduction
-
Functions
call
@@ -32,11 +31,15 @@

Introduction

-

{{Introductory text}}

+

+ <boost/python/call.hpp> defines the call family of overloaded function + templates, used to invoke Python callable objects from C++.

Functions

-call
+template <class R, class A1, class A2, ... class An>
+result-type call(PyObject* callable, A1 const&, A2 const&, ... An const&)
 
Requires: {{text}}
diff --git a/doc/v2/make_function.html b/doc/v2/make_function.html index 7f40703b..4e3c0bd1 100644 --- a/doc/v2/make_function.html +++ b/doc/v2/make_function.html @@ -51,7 +51,7 @@

Functions

 template <class F>
-objects::function* make_function(F f)</a>
+objects::function* make_function(F f)
 
 template <class F, class Policies>
 objects::function* make_function(F f, Policies const& policies)
diff --git a/doc/v2/reference.html b/doc/v2/reference.html
index 5f82fe4d..78505ff6 100644
--- a/doc/v2/reference.html
+++ b/doc/v2/reference.html
@@ -24,9 +24,11 @@
     
High Level Components -
Framework Elements +
Models of CallPolicies -
Utilities +
Models of ReturnHandlerGenerator + +
To/From Python Type Conversion
Index By Name
@@ -41,6 +43,31 @@

General Purpose

+ +
call.hpp +
+
+
Functions + +
+
+
call +
+
+ +
call_method.hpp +
+
+
Functions + +
+
+
call_method +
+
+
class.hpp/class_fwd.hpp
@@ -57,6 +84,22 @@
+
data_members.hpp + +
+
+
Functions + +
+
+
make_getter + +
make_setter +
+
+
errors.hpp
@@ -140,89 +183,8 @@
- -

To/From Python Type Conversion

-
-
from_python.hpp - -
-
-
Classes - -
-
-
from_python -
-
- -
to_python_converter.hpp - -
-
-
Classes - -
-
-
to_python_converter -
-
- -
to_python_indirect.hpp - -
-
-
Classes - -
-
-
to_python_indirect -
-
- -
to_python_value.hpp - -
-
-
Classes - -
-
-
to_python_value -
-
- -
type_from_python.hpp - -
-
-
Classes - -
-
-
type_from_python -
-
- -
value_from_python.hpp - -
-
-
Classes - -
-
-
value_from_python -
-
-

Models of CallPolicies

@@ -369,6 +331,129 @@ + + + +

To/From Python Type Conversion

+ +
+
from_python.hpp + +
+
+
Classes + +
+
+
from_python +
+
+ +
has_back_reference.hpp + +
+
+
Classes + +
+
+
has_back_reference +
+
+ +
implicit.hpp + +
+
+
Functions + +
+
+
implicitly_convertible +
+
+ +
ptr.hpp + +
+
+
Classes + +
+
+
ptr +
+
+ +
to_python_converter.hpp + +
+
+
Classes + +
+
+
to_python_converter +
+
+ +
to_python_indirect.hpp + +
+
+
Classes + +
+
+
to_python_indirect +
+
+ +
to_python_value.hpp + +
+
+
Classes + +
+
+
to_python_value +
+
+ +
type_from_python.hpp + +
+
+
Classes + +
+
+
type_from_python +
+
+ +
value_from_python.hpp + +
+
+
Classes + +
+
+
value_from_python +
+
+
+
diff --git a/test/Jamfile b/test/Jamfile index 6e7ce5ea..36b9a476 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -63,6 +63,7 @@ bpl-test data_members ; bpl-test bienstman1 ; bpl-test bienstman2 ; bpl-test bienstman3 ; +bpl-test multi_arg_constructor ; if $(TEST_BIENSTMAN_NON_BUGS) { bpl-test bienstman4 ; diff --git a/test/multi_arg_constructor.cpp b/test/multi_arg_constructor.cpp new file mode 100644 index 00000000..50710519 --- /dev/null +++ b/test/multi_arg_constructor.cpp @@ -0,0 +1,22 @@ +#include +#include + +struct A +{ + A(const double, const double, const double, const double, const double, const double, const double) {} +}; + +BOOST_PYTHON_MODULE_INIT(multi_arg_constructor_ext) +{ + using namespace boost::python; + using boost::shared_ptr; + + module("multi_arg_constructor_ext") + + .add(class_ >("A") + .def_init(args()) + ) + ; + +} + diff --git a/test/multi_arg_constructor.py b/test/multi_arg_constructor.py new file mode 100644 index 00000000..d6d1ef37 --- /dev/null +++ b/test/multi_arg_constructor.py @@ -0,0 +1,16 @@ +''' +>>> from multi_arg_constructor_ext import * +>>> a = A(1.0, 2, 3, 4, 5, 6, 7.0) +''' +def run(args = None): + import sys + import doctest + + if args is not None: + sys.argv = args + return doctest.testmod(sys.modules.get(__name__)) + +if __name__ == '__main__': + print "running..." + import sys + sys.exit(run()[0])