From 321bea59fbe6f17e1f0c41bc9117ca60856500c7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 1 Nov 2004 00:21:27 +0000 Subject: [PATCH] tidy [SVN r26026] --- doc/v2/reference.html | 326 ++++++++++++++++++++++++------------------ doc/v2/wrapper.html | 125 ++++++++-------- 2 files changed, 252 insertions(+), 199 deletions(-) diff --git a/doc/v2/reference.html b/doc/v2/reference.html index 24704847..62a7efd9 100644 --- a/doc/v2/reference.html +++ b/doc/v2/reference.html @@ -13,7 +13,7 @@ p.c3 {font-style: italic} h2.c2 {text-align: center} h1.c1 {text-align: center} - + @@ -96,172 +96,217 @@

High Level Components

- -
-
class.hpp/class_fwd.hpp
-
-
-
Classes
-
+
+
class.hpp/class_fwd.hpp
+ +
-
class_
-
bases
+
Classes
+ +
+
+
class_
+ +
bases
+
+
-
-
-
def.hpp
-
-
-
Functions
-
-
-
def
+ +
def.hpp
+ +
+
+
Functions
+ +
+
+
def
+
+
-
-
-
def_visitor.hpp
-
-
-
Classes
-
-
-
enum.hpp
-
-
-
Classes
-
+ +
def_visitor.hpp
+ +
-
enum_
+
Classes
-
-
-
errors.hpp
-
-
-
Classes
-
+ +
enum.hpp
+ +
-
Classes
+ +
+
+
enum_
+
+
+
+
+ +
errors.hpp
+ +
+
+
Classes
+ +
+
+
error_already_set
-
-
-
Functions
-
-
-
+
+ +
Functions
+ +
+
+
handle_exception
-
expect_non_null
-
throw_error_already_set
+
+
-
-
-
exception_translator.hpp
-
-
+
exception_translator.hpp
+ +
+
+
Functions
-
-
-
+
+
register_exception_translator
+
+
-
-
-
init.hpp
-
-
-
Classes
-
+ +
init.hpp
+ +
-
init
-
optional
+
Classes
+ +
+
+
init
+ +
optional
+
+
-
-
-
iterator.hpp
-
-
-
Classes
-
+ +
iterator.hpp
+ +
-
iterator
-
iterators
+
Classes
+ +
+
+
iterator
+ +
iterators
+
+
+ +
Functions
+ +
+
+
range
+
+
-
Functions
-
+ +
module.hpp
+ +
-
range
-
-
-
-
-
module.hpp
-
-
-
Macros
-
-
-
Macros
+ +
+
+
BOOST_PYTHON_MODULE
+
+
-
-
-
operators.hpp
-
-
-
Classes
-
-
-
self_t
-
other
-
operator_
-
-
-
Objects
-
-
-
self
-
-
-
-
-
scope.hpp
-
-
-
Classes
-
-
-
scope
-
-
-
-
-
wrapper.hpp
-
-
-
Classes
-
+
operators.hpp
+ +
-
override
-
wrapper
+
Classes
+ +
+
+
self_t
+ +
other
+ +
operator_
+
+
+ +
Objects
+ +
+
+
self
+
+
+
+
+ +
scope.hpp
+ +
+
+
Classes
+ +
+
+
scope
+
+
+
+
+ +
wrapper.hpp
+ +
+
+
Classes
+ +
+
+
override
+ +
wrapper
+
+
-
- -

Object Wrappers

@@ -371,6 +416,7 @@
+
slice.hpp
@@ -992,17 +1038,19 @@

Topics

- -
-
Calling Python Functions and Methods
-
Pickle Support
- Indexing Support
-
+
+
Calling Python Functions and + Methods
+ +
Pickle Support
+ Indexing Support
+

Revised - 19 July, 2003 + 31 October, 2004 +

© Copyright Contents

-
Introduction +
Introduction
-
Classes +
Classes
-
Class template override +
Class template + override
-
Class override synopsis - -
Class override observer functions +
Class + override synopsis
+
Class + override observer functions
+
-
Class template wrapper +
Class template + wrapper
-
Class wrapper synopsis - -
Class wrapper observer functions +
Class wrapper + synopsis
+
Class + wrapper observer functions
- +
+
-
Example(s) +
Example(s)

Introduction

-

To wrap a class T such that its virtual functions - can be "overridden in Python"—so that the corresponding - method of a Python derived class will be called when the virtual - function is invoked from C++—you must create a C++ wrapper - class derived from ``T`` that overrides those virtual functions so - that they call into Python. This header contains classes that can - be used to make that job easier. +

To wrap a class T such that its virtual functions can be + "overridden in Python"—so that the corresponding method of a Python + derived class will be called when the virtual function is invoked from + C++—you must create a C++ wrapper class derived from ``T`` that + overrides those virtual functions so that they call into Python. This + header contains classes that can be used to make that job easier.

Classes

Class override

-

Encapsulates a Python override of a C++ virtual function. - An override object either holds a callable Python - object or None. +

Encapsulates a Python override of a C++ virtual function. An + override object either holds a callable Python object or + None.

-

Class override synopsis

+

Class override + synopsis

 namespace boost
 {
@@ -91,8 +97,8 @@ namespace boost
 };
 
-

Class override observer - functions

+

Class override + observer functions

 unspecified operator() const;
 template <class A0>
@@ -105,26 +111,27 @@ template <class A0, class A1, ...class An>
 
-
Effects: If *this holds a callable - Python object, it is invoked with the specified arguments in - the manner specified here. Otherwise, throws -error_already_set -. +
Effects: If *this holds a callable Python + object, it is invoked with the specified arguments in the manner + specified here. Otherwise, throws error_already_set + .
-
Returns: An object of unspecified type that holds the - Python result of the invocation and, when converted to a C++ - type R, attempts to convert that result object - to R. If that conversion fails, throws -error_already_set -. +
Returns: An object of unspecified type that holds the Python + result of the invocation and, when converted to a C++ type + R, attempts to convert that result object to + R. If that conversion fails, throws error_already_set + .

Class template wrapper

Deriving your wrapper class from both ``T`` and - ``wrapper<T> makes writing that derived class easier. + ``wrapper<T> makes writing that derived class easier.

-

Class template wrapper synopsis

+

Class template + wrapper synopsis

 namespace boost
 {
@@ -136,27 +143,24 @@ namespace boost
 };
 
-

Class wrapper observer - functions

+

Class wrapper + observer functions

 override get_override(char const* name) const;
 
-
Requires: name is a ntbs. +
Requires: name is a ntbs.
Returns: If *this is the C++ base class - subobject of a Python derived class instance that overrides - the named function, returns an override object - that delegates to the Python override. Otherwise, - returns an -override - -object that holds None. + subobject of a Python derived class instance that overrides the named + function, returns an override object that delegates to the + Python override. Otherwise, returns an override object + that holds None.

Example

-
 #include <boost/python/module.hpp>
 #include <boost/python/class.hpp>
@@ -170,7 +174,7 @@ struct P
 {
     virtual ~P(){}
     virtual char const* f() = 0;
-    char const* g() { return "P::g()"; }
+    char const* g() { return "P::g()"; }
 };
 
 struct PCallback : P, wrapper<P>
@@ -178,9 +182,9 @@ struct PCallback : P, wrapper<P>
     char const* f()
     {
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // Workaround for vc6/vc7
-        return call<char const*>(this->get_override("f").ptr());
+        return call<char const*>(this->get_override("f").ptr());
 #else 
-        return this->get_override("f")();
+        return this->get_override("f")();
 #endif 
     }
 };
@@ -189,14 +193,14 @@ struct PCallback : P, wrapper<P>
 struct A
 {
     virtual ~A(){}
-    virtual char const* f() { return "A::f()"; }
+    virtual char const* f() { return "A::f()"; }
 };
 
 struct ACallback :  A, wrapper<A>
 {
     char const* f()
     {
-        if (override f = this->get_override("f"))
+        if (override f = this->get_override("f"))
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // Workaround for vc6/vc7
             return call<char const*>(f.ptr());
 #else 
@@ -211,19 +215,20 @@ struct ACallback :  A, wrapper<A>
 
 BOOST_PYTHON_MODULE_INIT(polymorphism)
 {
-    class_<PCallback,boost::noncopyable>("P")
-        .def("f", pure_virtual(&P::f))
+    class_<PCallback,boost::noncopyable>("P")
+        .def("f", pure_virtual(&P::f))
         ;
 
-    class_<ACallback,boost::noncopyable>("A")
-        .def("f", &A::f, &ACallback::default_f)
+    class_<ACallback,boost::noncopyable>("A")
+        .def("f", &A::f, &ACallback::default_f)
         ;
 }
 
+

Revised - 31 October, 2004 - + 31 October, 2004 +

© Copyright Dave