2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

- New page about smart pointers, and misc fixes

[SVN r18055]
This commit is contained in:
Bruno da Silva de Oliveira
2003-03-22 18:16:01 +00:00
parent 8a15fefc6c
commit a4fa261b77
4 changed files with 51 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
<title>Exporting All Declarations from a Header</title>
<link rel="stylesheet" href="theme/style.css" type="text/css">
<link rel="prev" href="wrappers.html">
<link rel="next" href="smart_pointers.html">
</head>
<body>
<table width="100%" height="48" border="0" cellspacing="2">
@@ -20,7 +21,7 @@
<tr>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
<td width="30"><a href="wrappers.html"><img src="theme/l_arr.gif" border="0"></a></td>
<td width="20"><img src="theme/r_arr_disabled.gif" border="0"></td>
<td width="20"><a href="smart_pointers.html"><img src="theme/r_arr.gif" border="0"></a></td>
</tr>
</table>
<p>
@@ -63,7 +64,7 @@ the members of the header object like this:</p>
<tr>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
<td width="30"><a href="wrappers.html"><img src="theme/l_arr.gif" border="0"></a></td>
<td width="20"><img src="theme/r_arr_disabled.gif" border="0"></td>
<td width="20"><a href="smart_pointers.html"><img src="theme/r_arr.gif" border="0"></a></td>
</tr>
</table>
<br>

View File

@@ -81,6 +81,8 @@ where options are:
use explicit declarations instead
--pyste-ns=<name> set the namespace where new types will be declared;
default is "pyste"
-h, --help print this help and exit
-v, --version print version information
'''
]
@@ -94,8 +96,8 @@ generated cpp, using the namespace boost::python explicitly in all declarations.
Use only if you're having a name conflict in one of the files.
Use [^--pyste-ns] to change the namespace where new types are declared (for
instance, the virtual wrappers). Use only if one of your header files declare a
namespace named "pyste" and this is causing conflicts.
instance, the virtual wrappers). Use only if you are having any problems. By
default, Pyste uses the empty namespace.
So, the usage is simple enough:
@@ -368,3 +370,38 @@ the members of the header object like this:
rename(hello.World.greet, "Greet")
exclude(hello.World.set, "Set")
[page:1 Smart Pointers]
Pyste for now has manual support for smart pointers. Suppose:
struct C
{
int value;
};
boost::shared_ptr<C> newC(int value)
{
boost::shared_ptr<C> c( new C() );
c->value = value;
return c;
}
void printC(boost::shared_ptr<C> c)
{
std::cout << c->value << std::endl;
}
To make [^newC] and [^printC] work correctly, you have to tell Pyste that a
conversor for [^boost::shared_ptr<C>] is needed.
C = Class('C', 'C.h')
use_shared_ptr(C)
Function('newC', 'C.h')
Function('printC', 'C.h')
For [^std::auto_ptr]'s, use the function [^use_auto_ptr].
This system is temporary, and in the future the conversors will automatically be
exported if needed, without the need to tell Pyste about them explicitly.

View File

@@ -57,6 +57,8 @@ where options are:
use explicit declarations instead
--pyste-ns=&lt;name&gt; set the namespace where new types will be declared;
default is &quot;pyste&quot;
-h, --help print this help and exit
-v, --version print version information
</pre></code><p>
Options explained:</p>
@@ -69,8 +71,8 @@ generated cpp, using the namespace boost::python explicitly in all declarations.
Use only if you're having a name conflict in one of the files.</p>
<p>
Use <tt>--pyste-ns</tt> to change the namespace where new types are declared (for
instance, the virtual wrappers). Use only if one of your header files declare a
namespace named &quot;pyste&quot; and this is causing conflicts.</p>
instance, the virtual wrappers). Use only if you are having any problems. By
default, Pyste uses the empty namespace.</p>
<p>
So, the usage is simple enough:</p>
<code><pre>&gt;python pyste.py --module=mymodule file.pyste file2.pyste ...</pre></code><p>

View File

@@ -60,6 +60,11 @@
<a href="doc/exporting_all_declarations_from_a_header.html">Exporting All Declarations from a Header</a>
</td>
</tr>
<tr>
<td class="toc_cells_L1">
<a href="doc/smart_pointers.html">Smart Pointers</a>
</td>
</tr>
</table>
<br>
<hr size="1"><p class="copyright">Copyright &copy; 2003 Bruno da Silva de Oliveira<br>Copyright &copy; 2002-2003 Joel de Guzman<br><br>