[29] | 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 | |
---|
| 10 | namespace boost { namespace python { |
---|
| 11 | |
---|
| 12 | // Note: the static data members are defined in object/function.cpp |
---|
| 13 | |
---|
| 14 | class 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_signatures_ = show_signatures_; |
---|
| 21 | show_user_defined_ = show_all; |
---|
| 22 | show_signatures_ = show_all; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | docstring_options(bool show_user_defined, bool show_signatures) |
---|
| 26 | { |
---|
| 27 | previous_show_user_defined_ = show_user_defined_; |
---|
| 28 | previous_show_signatures_ = show_signatures_; |
---|
| 29 | show_user_defined_ = show_user_defined; |
---|
| 30 | show_signatures_ = show_signatures; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | ~docstring_options() |
---|
| 34 | { |
---|
| 35 | show_user_defined_ = previous_show_user_defined_; |
---|
| 36 | show_signatures_ = previous_show_signatures_; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | void |
---|
| 40 | disable_user_defined() { show_user_defined_ = false; } |
---|
| 41 | |
---|
| 42 | void |
---|
| 43 | enable_user_defined() { show_user_defined_ = true; } |
---|
| 44 | |
---|
| 45 | void |
---|
| 46 | disable_signatures() { show_signatures_ = false; } |
---|
| 47 | |
---|
| 48 | void |
---|
| 49 | enable_signatures() { show_signatures_ = true; } |
---|
| 50 | |
---|
| 51 | void |
---|
| 52 | disable_all() |
---|
| 53 | { |
---|
| 54 | show_user_defined_ = false; |
---|
| 55 | show_signatures_ = false; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | void |
---|
| 59 | enable_all() |
---|
| 60 | { |
---|
| 61 | show_user_defined_ = true; |
---|
| 62 | show_signatures_ = true; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | friend struct objects::function; |
---|
| 66 | |
---|
| 67 | private: |
---|
| 68 | static volatile bool show_user_defined_; |
---|
| 69 | static volatile bool show_signatures_; |
---|
| 70 | bool previous_show_user_defined_; |
---|
| 71 | bool previous_show_signatures_; |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | }} // namespace boost::python |
---|
| 75 | |
---|
| 76 | #endif // DOCSTRING_OPTIONS_RWGK20060111_HPP |
---|