]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/doc/reference/args.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / python / doc / reference / args.qbk
1 [section boost/python/args.hpp]
2 [section Introduction]
3 Supplies a family of overloaded functions for specifying argument keywords for wrapped C++ functions.
4 [section keyword-expressions]
5 A keyword-expression results in an object which holds a sequence of [link ntbs]\ es, and whose type encodes the number of keywords specified. The keyword-expression may contain default values for some or all of the keywords it holds
6 [endsect]
7 [endsect]
8 [section Class `arg`]
9 The objects of class arg are keyword-expressions holding one keyword ( size one )
10 ``
11 namespace boost { namespace python
12 {
13 struct arg
14 {
15 template <class T>
16 arg &operator = (T const &value);
17 explicit arg (char const *name){elements[0].name = name;}
18 };
19
20 }}
21 ``
22 [endsect]
23 [section Class `arg` constructor]
24 ``arg(char const* name);``
25 [variablelist
26 [[Requires][The argument must be a [link ntbs].]]
27 [[Effects][Constructs an arg object holding a keyword with name name.]]
28 ]
29 [endsect]
30 [section Class `arg` operator=]
31 ``template <class T> arg &operator = (T const &value);``
32 [variablelist
33 [[Requires][The argument must convertible to python.]]
34 [[Effects][Assigns default value for the keyword.]]
35 [[Returns][Reference to `this`.]]
36 ]
37 [endsect]
38 [section Keyword-expression operator,]
39 ``
40 keyword-expression operator , (keyword-expression, const arg &kw) const
41 keyword-expression operator , (keyword-expression, const char *name) const;
42 ``
43 [variablelist
44 [[Requires][The argument name must be a [link ntbs].]]
45 [[Effects][Extends the keyword-expression argument with one more keyword.]]
46 [[Returns][The extended keyword-expression.]]
47 ]
48 [endsect]
49 [section Example]
50 ``
51 #include <boost/python/def.hpp>
52 using namespace boost::python;
53
54 int f(double x, double y, double z=0.0, double w=1.0);
55
56 BOOST_PYTHON_MODULE(xxx)
57 {
58 def("f", f, (arg("x"), "y", arg("z")=0.0, arg("w")=1.0));
59 }
60 ``
61 [endsect]
62 [endsect]