File: args.qbk

package info (click to toggle)
boost1.83 1.83.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 545,632 kB
  • sloc: cpp: 3,857,086; xml: 125,552; ansic: 34,414; python: 25,887; asm: 5,276; sh: 4,799; ada: 1,681; makefile: 1,629; perl: 1,212; pascal: 1,139; sql: 810; yacc: 478; ruby: 102; lisp: 24; csh: 6
file content (62 lines) | stat: -rw-r--r-- 1,905 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[section boost/python/args.hpp]
[section Introduction]
Supplies a family of overloaded functions for specifying argument keywords for wrapped C++ functions.
[section keyword-expressions]
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
[endsect]
[endsect]
[section Class `arg`]
The objects of class arg are keyword-expressions holding one keyword ( size one )
``
namespace boost { namespace python
{
        struct arg 
        {
          template <class T>
                  arg &operator = (T const &value);
          explicit arg (char const *name){elements[0].name = name;}
        };

}}
``
[endsect]
[section Class `arg` constructor]
``arg(char const* name);``
[variablelist
[[Requires][The argument must be a [link ntbs].]]
[[Effects][Constructs an arg object holding a keyword with name name.]]
]
[endsect]
[section Class `arg` operator=]
``template <class T> arg &operator = (T const &value);``
[variablelist
[[Requires][The argument must convertible to python.]]
[[Effects][Assigns default value for the keyword.]]
[[Returns][Reference to `this`.]]
]
[endsect]
[section Keyword-expression operator,]
``
keyword-expression operator , (keyword-expression, const arg &kw) const
keyword-expression operator , (keyword-expression, const char *name) const;
``
[variablelist
[[Requires][The argument name must be a [link ntbs].]]
[[Effects][Extends the keyword-expression argument with one more keyword.]]
[[Returns][The extended keyword-expression.]]
]
[endsect]
[section Example]
``
#include <boost/python/def.hpp>
using namespace boost::python;

int f(double x, double y, double z=0.0, double w=1.0);

BOOST_PYTHON_MODULE(xxx)
{
  def("f", f, (arg("x"), "y", arg("z")=0.0, arg("w")=1.0));
}
``
[endsect]
[endsect]