33< html >
44 < head >
55 < meta name ="generator " content =
6- "HTML Tidy for Windows (vers 1st August 2002), see www.w3.org ">
6+ "HTML Tidy for Cygwin (vers 1st April 2002), see www.w3.org ">
77 < meta http-equiv ="Content-Type " content ="text/html; charset=iso-8859-1 ">
88 < link rel ="stylesheet " type ="text/css " href ="../boost.css ">
99
@@ -35,7 +35,31 @@ <h2>Contents</h2>
3535
3636 < dt > < a href ="#keyword-expression "> < i > keyword-expressions</ i > </ a > </ dt >
3737
38- < dt > < a href ="#functions "> Functions</ a > </ dt >
38+ < dt > < a href ="#classes "> Classes</ a > </ dt >
39+
40+ < dd >
41+ < dl class ="page-index ">
42+ < dt > < a href ="#arg-spec "> class < code > arg</ code > </ a > </ dt >
43+
44+ < dd >
45+ < dl class ="page-index ">
46+ < dt > < a href ="#arg-synopsis "> class < code > arg</ code >
47+ synopsis</ a > </ dt >
48+
49+ < dt > < a href ="#arg-ctor "> class < code > arg</ code >
50+ constructor</ a > </ dt >
51+
52+ < dt > < a href ="#arg-operator "> class < code > arg</ code > template
53+ < code > operator =</ code > </ a > </ dt >
54+ </ dl >
55+ </ dd >
56+ </ dl >
57+ </ dd >
58+
59+ < dt > < a href ="#keyword-expression-operators "> < i > Keyword-expression</ i >
60+ operator < code > ,</ code > </ a > </ dt >
61+
62+ < dt > < a href ="#functions "> Functions (deprecated)</ a > </ dt >
3963
4064 < dd >
4165 < dl class ="page-index ">
@@ -57,47 +81,117 @@ <h2><a name="keyword-expression"></a><i>keyword-expressions</i></h2>
5781
5882 < p > A < b > keyword-expression</ b > results in an object which holds a
5983 sequence of < a href ="definitions.html#ntbs "> ntbs</ a > es, and whose type
60- encodes the number of keywords specified.</ p >
84+ encodes the number of keywords specified. The < b > keyword-expression</ b >
85+ may contain default values for some or all of the keywords it holds</ p >
86+
87+ < h2 > < a name ="classes "> </ a > Classes</ h2 >
6188
62- < h2 > < a name ="functions "> </ a > Functions </ h2 >
89+ < h3 > < a name ="arg-spec "> </ a > < code > class arg; </ code > </ h3 >
6390
64- < h3 > < a name ="args-spec "> </ a > < code > args(</ code > ...< code > )</ code > </ h3 >
91+ < p > The objects of class arg are keyword-expressions holding one keyword (
92+ size one )</ p >
93+
94+ < h4 > < a name ="arg-synopsis "> </ a > Class < code > arg</ code > synopsis</ h4 >
95+ < pre >
96+ namespace boost { namespace python
97+ {
98+ struct arg
99+ {
100+ template <class T>
101+ arg &perator = (T const &value);
102+ explicit arg (char const *name){elements[0].name = name;}
103+ };
104+
105+ }}
106+ </ pre >
107+
108+ < h4 > < a name ="arg-ctor "> </ a > Class < code > arg</ code > constructor</ h4 >
65109< pre >
66- < i > unspecified1</ i > args(char const*);
67- < i > unspecified2</ i > args(char const*, char const*);
68- .
69- .
70- .
71- < i > unspecifiedN</ i > args(char const*, char const*, ... char const*);
110+ arg(char const* name);
72111</ pre >
73112
74113 < dl class ="function-semantics ">
75- < dt > < b > Requires:</ b > Every argument must be a < a href =
114+ < dt > < b > Requires:</ b > The argument must be a < a href =
76115 "definitions.html#ntbs "> ntbs</ a > .</ dt >
77116
78- < dt > < b > Returns:</ b > an object representing a < a href =
79- "#keyword-expression "> < i > keyword-expression</ i > </ a > encapsulating the
80- arguments passed.</ dt >
117+ < dt > < b > Effects:</ b > Constructs an < code > arg</ code > object holding a
118+ keyword with name < code > name</ code > .</ dt >
119+ </ dl >
120+
121+ < h4 > < a name ="arg-operator "> </ a > Class < code > arg</ code > operator =</ h4 >
122+ < pre >
123+ template <class T> arg &operator = (T const &value);
124+ </ pre >
125+
126+ < dl class ="function-semantics ">
127+ < dt > < b > Requires:</ b > The argument must convertible to python.</ dt >
128+
129+ < dt > < b > Effects:</ b > Assigns default value for the keyword.</ dt >
130+
131+ < dt > < b > Returns:</ b > Reference to < code > this</ code > .</ dt >
132+ </ dl >
133+
134+ < h2 > < a name ="keyword-expression-operators "> < i > Keyword-expression</ i >
135+ operator < code > ,</ code > </ a > </ h2 >
136+ < pre >
137+ < i > keyword-expression</ i > operator , (< i > keyword-expression</ i > , const arg &kw) const
138+ < i > keyword-expression</ i > operator , (< i > keyword-expression</ i > , const char *name) const;
139+ </ pre >
140+
141+ < dl class ="function-semantics ">
142+ < dt > < b > Requires:</ b > The argument < code > name</ code > must be a < a href =
143+ "definitions.html#ntbs "> ntbs</ a > .</ dt >
144+
145+ < dt > < b > Effects:</ b > Extends the < i > keyword-expression</ i > argument with
146+ one more keyword.</ dt >
147+
148+ < dt > < b > Returns:</ b > The extended < i > keyword-expression</ i > .</ dt >
149+ </ dl >
150+
151+ < h2 > < font color ="#7F7F7F "> < a name ="functions "> </ a > Functions
152+ (deprecated)</ font > </ h2 >
153+
154+ < h3 > < a name ="args-spec "> </ a > < code > < font color =
155+ "#7F7F7F "> args</ font > (</ code > ...< code > )</ code > </ h3 >
156+ < pre >
157+ < font color ="#7F7F7F "> < i > unspecified1</ i > args(char const*);
158+ < i > unspecified2</ i > args(char const*, char const*);
159+ .
160+ .
161+ .
162+ < i > unspecifiedN</ i > args(char const*, char const*, ... char const*);
163+ </ font >
164+ </ pre >
165+
166+ < dl class ="function-semantics ">
167+ < dt > < font color ="#7F7F7F "> < b > Requires:</ b > Every argument must be a < a
168+ href ="definitions.html#ntbs "> ntbs</ a > .</ font > </ dt >
169+
170+ < dt > < font color ="#7F7F7F "> < b > Returns:</ b > an object representing a < a
171+ href ="#keyword-expression "> < i > keyword-expression</ i > </ a > encapsulating
172+ the arguments passed.</ font > </ dt >
81173 </ dl >
82174
83175 < h2 > < a name ="examples "> </ a > Example</ h2 >
84176< pre >
85177#include <boost/python/def.hpp>
86178using namespace boost::python;
87179
88- int f(int x, int y, int z );
180+ int f(double x, double y, double z=0.0, double w=1.0 );
89181
90182BOOST_PYTHON_MODULE(xxx)
91183{
92- def("f", f, args("x", "y", "z"));
184+ def("f", f
185+ , ( arg("x"), "y", arg("z")=0.0, arg("w")=1.0 )
186+ );
93187}
94188</ pre >
95189
96- < p > Revised 05 November, 2001 </ p >
190+ < p > Revised 01 August, 2003 </ p >
97191
98192 < p > < i > © Copyright < a href =
99- "../../../../people/dave_abrahams.htm "> Dave Abrahams</ a > 2002. All Rights
100- Reserved.</ i > </ p >
193+ "../../../../people/dave_abrahams.htm "> Dave Abrahams</ a > 2002-2003 . All
194+ Rights Reserved.</ i > </ p >
101195 </ body >
102196</ html >
103197
0 commit comments