| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #pragma once |
| |
|
| | #include "detail/common.h" |
| |
|
| | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) |
| |
|
| | class options { |
| | public: |
| | |
| | options() : previous_state(global_state()) {} |
| |
|
| | |
| | options(const options &) = delete; |
| | options &operator=(const options &) = delete; |
| |
|
| | |
| | ~options() { global_state() = previous_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; |
| | } |
| |
|
| | |
| |
|
| | 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; |
| | } |
| |
|
| | |
| | void *operator new(size_t) = delete; |
| |
|
| | private: |
| | struct state { |
| | bool show_user_defined_docstrings = true; |
| | bool show_function_signatures = true; |
| | |
| | bool show_enum_members_docstring = true; |
| | |
| | }; |
| |
|
| | static state &global_state() { |
| | static state instance; |
| | return instance; |
| | } |
| |
|
| | state previous_state; |
| | }; |
| |
|
| | PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) |
| |
|