FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/test/keywords.cpp at python · boostorg/python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
boostorg
/
python
Public
Notifications
You must be signed in to change notification settings
Fork
223
Star
537
Code
Issues
173
Pull requests
34
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
test
/
keywords.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
118 lines (93 loc) · 2.23 KB
Breadcrumbs
python
/
test
/
keywords.cpp
Copy path
File metadata and controls
118 lines (93 loc) · 2.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//
Copyright David Abrahams 2002.
//
Distributed under the Boost Software License, Version 1.0. (See
//
accompanying file LICENSE_1_0.txt or copy at
//
http://www.boost.org/LICENSE_1_0.txt)
#
include
<
boost/python.hpp
>
#
include
<
string
>
struct
Foo
{
Foo
(
int
a =
0
,
double
b =
0
,
const
std::string &n = std::string()
) :
a_
(a)
, b_(b)
, n_(n)
{}
void
set
(
int
a=
0
,
double
b=
0
,
const
std::string &n=std::string())
{
a_ = a;
b_ = b;
n_ = n;
}
int
geta
()
const
{
return
a_; }
double
getb
()
const
{
return
b_; }
std::string
getn
()
const
{
return
n_; }
private:
int
a_;
double
b_;
std::string n_;
};
struct
Bar
{
Bar
(
int
a =
0
,
double
b =
0
,
const
std::string &n = std::string()
) :
a_
(a)
, b_(b)
, n_(n)
{}
void
set
(
int
a=
0
,
double
b=
0
,
const
std::string &n=std::string())
{
a_ = a;
b_ = b;
n_ = n;
}
void
seta
(
int
a)
{
a_ = a;
}
int
geta
()
const
{
return
a_; }
double
getb
()
const
{
return
b_; }
std::string
getn
()
const
{
return
n_; }
private:
int
a_;
double
b_;
std::string n_;
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
(bar_set, Bar::set,
0
,
3
)
using
namespace
boost
::python
;
BOOST_PYTHON_MODULE
(keywords)
{
#
if
BOOST_WORKAROUND(__GNUC__, == 2)
using
boost::python::arg;
#
endif
class_<Foo>(
"
Foo
"
, init<
int
,
double
,
const
std::string&>(
(
arg
(
"
a
"
) =
0
,
arg
(
"
b
"
) =
0.0
,
arg
(
"
n
"
) =
std::string
()
)
))
.
def
(
"
set
"
, &Foo::set, (
arg
(
"
a
"
) =
0
,
arg
(
"
b
"
) =
0.0
,
arg
(
"
n
"
) =
std::string
()) )
.
def
(
"
set2
"
, &Foo::set, (
arg
(
"
a
"
),
"
b
"
,
"
n
"
) )
.
def
(
"
a
"
, &Foo::geta)
.
def
(
"
b
"
, &Foo::getb)
.
def
(
"
n
"
, &Foo::getn)
;
class_<Bar>(
"
Bar
"
, init<optional<
int
,
double
,
const
std::string &> >()
)
.
def
(
"
set
"
, &Bar::set,
bar_set
())
.
def
(
"
set2
"
, &Bar::set,
bar_set
(
"
set2's docstring
"
))
.
def
(
"
seta
"
, &Bar::seta,
arg
(
"
a
"
))
.
def
(
"
a
"
, &Bar::geta)
.
def
(
"
b
"
, &Bar::getb)
.
def
(
"
n
"
, &Bar::getn)
;
}
#
include
"
module_tail.cpp
"
Back
|
FazBrowse Home
|
New Git URL