FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pybind11/include/pybind11/options.h at native_enum_sh · rwgk/pybind11 · GitHub
rwgk
pybind11
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pybind11
/
include
/
pybind11
/
options.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
92 lines (68 loc) · 2.67 KB
Breadcrumbs
pybind11
/
include
/
pybind11
/
options.h
Copy path
File metadata and controls
92 lines (68 loc) · 2.67 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
/*
pybind11/options.h: global settings that are configurable at runtime.
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
*/
#
pragma
once
#
include
"
detail/common.h
"
PYBIND11_NAMESPACE_BEGIN
(
PYBIND11_NAMESPACE
)
class
options
{
public:
//
Default RAII constructor, which leaves settings as they currently are.
options
() : previous_state(global_state()) {}
//
Class is non-copyable.
options
(
const
options &) =
delete
;
options &
operator
=(
const
options &) =
delete
;
//
Destructor, which restores settings that were in effect before.
~options
() {
global_state
() = previous_state; }
//
Setter methods (affect the global state):
options &
disable_user_defined_docstrings
() & {
global_state
().
show_user_defined_docstrings
=
false
;
return
*
this
;
}
options &
enable_user_defined_docstrings
() & {
global_state
().
show_user_defined_docstrings
=
true
;
return
*
this
;
}
options &
disable_function_signatures
() & {
global_state
().
show_function_signatures
=
false
;
return
*
this
;
}
options &
enable_function_signatures
() & {
global_state
().
show_function_signatures
=
true
;
return
*
this
;
}
options &
disable_enum_members_docstring
() & {
global_state
().
show_enum_members_docstring
=
false
;
return
*
this
;
}
options &
enable_enum_members_docstring
() & {
global_state
().
show_enum_members_docstring
=
true
;
return
*
this
;
}
//
Getter methods (return the global state):
static
bool
show_user_defined_docstrings
() {
return
global_state
().
show_user_defined_docstrings
;
}
static
bool
show_function_signatures
() {
return
global_state
().
show_function_signatures
; }
static
bool
show_enum_members_docstring
() {
return
global_state
().
show_enum_members_docstring
;
}
//
This type is not meant to be allocated on the heap.
void
*
operator
new
(
size_t
) =
delete
;
private:
struct
state
{
bool
show_user_defined_docstrings =
true
;
//
< Include user-supplied texts in docstrings.
bool
show_function_signatures =
true
;
//
< Include auto-generated function signatures
//
in docstrings.
bool
show_enum_members_docstring =
true
;
//
< Include auto-generated member list in enum
//
docstrings.
};
static
state &
global_state
() {
static
state instance;
return
instance;
}
state previous_state;
};
PYBIND11_NAMESPACE_END
(
PYBIND11_NAMESPACE
)
Back
|
FazBrowse Home
|
New Git URL