Revision: 1429
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1429&view=rev
Author: roman_yakovenko
Date: 2008-10-12 07:08:30 +0000 (Sun, 12 Oct 2008)
Log Message:
-----------
remove duplicated "how to ... ?"
Modified Paths:
--------------
pyplusplus_dev/docs/documentation/how_to/how_to.rest
Modified: pyplusplus_dev/docs/documentation/how_to/how_to.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/how_to.rest 2008-10-10 21:35:04 UTC (rev 1428)
+++ pyplusplus_dev/docs/documentation/how_to/how_to.rest 2008-10-12 07:08:30 UTC (rev 1429)
@@ -24,61 +24,7 @@
.. _`Generated file name is too long` : ./file_name_too_long.html
--------------------------------------------------------
-How to expose function, which has hand-written wrapper?
--------------------------------------------------------
-.. code-block:: C++
- struct window_t{
- ...
- void get_size( int& height, int& widht ) const;
- };
-
-You can not expose ``get_size`` function as is - ``int`` is immutable type in
-Python. So, we need to create a wrapper to the function:
-
-.. code-block:: C++
-
- boost::python::tuple get_size_wrapper( const window_t& win ){
- int height(0), width( 0 );
- win.get_size( height, widht );
- return boost::python::make_tuple( height, width );
- }
-
-.. code-block:: C++
-
- class_<window_t>( ... )
- .def( "get_size", &get_size_wrapper )
- ...
- ;
-
-Now, after you know how this problem is solved. I will show how this solution
-could be integrated with `Py++`_.
-
-.. code-block:: Python
-
- wrapper_code = \
- """
- static boost::python::tuple get_size( const window_t& win ){
- int height(0), width( 0 );
- win.get_size( height, width );
- return boost::python::make_tuple( height, width );
- }
- """
-
-.. code-block:: Python
-
- mb = module_builder_t( ... )
- window = mb.class_( "window_t" )
- window.member_function( "get_size" ).exclude()
- window.add_wrapper_code( wrapper_code )
- registration_code = 'def( "get_size", &%s::get_size )' % window.wrapper_alias
- window.registration_code( registration_code )
-
-That's all.
-
-
-
.. _`Py++` : ./../../pyplusplus.html
.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
.. _`Python`: http://www.python.org
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|