1// Copyright Ralf W. Grosse-Kunstleve 2006.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef DOCSTRING_OPTIONS_RWGK20060111_HPP
6# define DOCSTRING_OPTIONS_RWGK20060111_HPP
7
8#include <boost/python/object/function.hpp>
9
10namespace boost { namespace python {
11
12// Note: the static data members are defined in object/function.cpp
13
14class BOOST_PYTHON_DECL docstring_options : boost::noncopyable
15{
16 public:
17 docstring_options(bool show_all=true)
18 {
19 previous_show_user_defined_ = show_user_defined_;
20 previous_show_py_signatures_ = show_py_signatures_;
21 previous_show_cpp_signatures_ = show_cpp_signatures_;
22 show_user_defined_ = show_all;
23 show_cpp_signatures_ = show_all;
24 show_py_signatures_ = show_all;
25 }
26
27 docstring_options(bool show_user_defined, bool show_signatures)
28 {
29 previous_show_user_defined_ = show_user_defined_;
30 previous_show_cpp_signatures_ = show_cpp_signatures_;
31 previous_show_py_signatures_ = show_py_signatures_;
32 show_user_defined_ = show_user_defined;
33 show_cpp_signatures_ = show_signatures;
34 show_py_signatures_ = show_signatures;
35 }
36
37 docstring_options(bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures)
38 {
39 previous_show_user_defined_ = show_user_defined_;
40 previous_show_cpp_signatures_ = show_cpp_signatures_;
41 previous_show_py_signatures_ = show_py_signatures_;
42 show_user_defined_ = show_user_defined;
43 show_cpp_signatures_ = show_cpp_signatures;
44 show_py_signatures_ = show_py_signatures;
45 }
46
47 ~docstring_options()
48 {
49 show_user_defined_ = previous_show_user_defined_;
50 show_cpp_signatures_ = previous_show_cpp_signatures_;
51 show_py_signatures_ = previous_show_py_signatures_;
52 }
53
54 void
55 disable_user_defined() { show_user_defined_ = false; }
56
57 void
58 enable_user_defined() { show_user_defined_ = true; }
59
60 void
61 disable_py_signatures()
62 {
63 show_py_signatures_ = false;
64 }
65
66 void
67 enable_py_signatures()
68 {
69 show_py_signatures_ = true;
70 }
71
72 void
73 disable_cpp_signatures()
74 {
75 show_cpp_signatures_ = false;
76 }
77
78 void
79 enable_cpp_signatures()
80 {
81 show_cpp_signatures_ = true;
82 }
83
84 void
85 disable_signatures()
86 {
87 show_cpp_signatures_ = false;
88 show_py_signatures_ = false;
89 }
90
91 void
92 enable_signatures()
93 {
94 show_cpp_signatures_ = true;
95 show_py_signatures_ = true;
96 }
97
98 void
99 disable_all()
100 {
101 show_user_defined_ = false;
102 show_cpp_signatures_ = false;
103 show_py_signatures_ = false;
104 }
105
106 void
107 enable_all()
108 {
109 show_user_defined_ = true;
110 show_cpp_signatures_ = true;
111 show_py_signatures_ = true;
112 }
113
114 friend struct objects::function;
115
116 private:
117 static volatile bool show_user_defined_;
118 static volatile bool show_cpp_signatures_;
119 static volatile bool show_py_signatures_;
120 bool previous_show_user_defined_;
121 bool previous_show_cpp_signatures_;
122 bool previous_show_py_signatures_;
123};
124
125}} // namespace boost::python
126
127#endif // DOCSTRING_OPTIONS_RWGK20060111_HPP
128

source code of boost/boost/python/docstring_options.hpp