μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
options.h
Go to the documentation of this file.
1/*
2 pybind11/options.h: global settings that are configurable at runtime.
3
4 Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
6 All rights reserved. Use of this source code is governed by a
7 BSD-style license that can be found in the LICENSE file.
8*/
9
10#pragma once
11
12#include "detail/common.h"
13
15
16class options {
17public:
18 // Default RAII constructor, which leaves settings as they currently are.
20
21 // Class is non-copyable.
22 options(const options &) = delete;
23 options &operator=(const options &) = delete;
24
25 // Destructor, which restores settings that were in effect before.
27
28 // Setter methods (affect the global state):
29
32 return *this;
33 }
34
37 return *this;
38 }
39
42 return *this;
43 }
44
47 return *this;
48 }
49
52 return *this;
53 }
54
57 return *this;
58 }
59
60 // Getter methods (return the global state):
61
64 }
65
67
70 }
71
72 // This type is not meant to be allocated on the heap.
73 void *operator new(size_t) = delete;
74
75private:
76 struct state {
77 bool show_user_defined_docstrings = true; //< Include user-supplied texts in docstrings.
78 bool show_function_signatures = true; //< Include auto-generated function signatures
79 // in docstrings.
80 bool show_enum_members_docstring = true; //< Include auto-generated member list in enum
81 // docstrings.
82 };
83
84 static state &global_state() {
85 static state instance;
86 return instance;
87 }
88
89 state previous_state;
90};
91
options(const options &)=delete
options & disable_function_signatures() &
Definition: options.h:40
options & enable_function_signatures() &
Definition: options.h:45
options()
Definition: options.h:19
static bool show_enum_members_docstring()
Definition: options.h:68
options & operator=(const options &)=delete
options & enable_enum_members_docstring() &
Definition: options.h:55
state previous_state
Definition: options.h:73
options & disable_enum_members_docstring() &
Definition: options.h:50
options & disable_user_defined_docstrings() &
Definition: options.h:30
static state & global_state()
Definition: options.h:68
~options()
Definition: options.h:26
static bool show_function_signatures()
Definition: options.h:66
static bool show_user_defined_docstrings()
Definition: options.h:62
options & enable_user_defined_docstrings() &
Definition: options.h:35
std::size_t size_t
Definition: common.h:461
#define PYBIND11_NAMESPACE_END(name)
Definition: common.h:21
#define PYBIND11_NAMESPACE_BEGIN(name)
Definition: common.h:20
The 'instance' type which needs to be standard layout (need to be able to use 'offsetof')
Definition: common.h:554
bool show_function_signatures
Definition: options.h:64
bool show_enum_members_docstring
Definition: options.h:80
bool show_user_defined_docstrings
Definition: options.h:63