os/ossrv/ossrv_pub/boost_apis/boost/python/docstring_options.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright Ralf W. Grosse-Kunstleve 2006.
sl@0
     2
// Distributed under the Boost Software License, Version 1.0. (See
sl@0
     3
// accompanying file LICENSE_1_0.txt or copy at
sl@0
     4
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
     5
#ifndef DOCSTRING_OPTIONS_RWGK20060111_HPP
sl@0
     6
# define DOCSTRING_OPTIONS_RWGK20060111_HPP
sl@0
     7
sl@0
     8
#include <boost/python/object/function.hpp>
sl@0
     9
sl@0
    10
namespace boost { namespace python {
sl@0
    11
sl@0
    12
// Note: the static data members are defined in object/function.cpp
sl@0
    13
sl@0
    14
class BOOST_PYTHON_DECL docstring_options : boost::noncopyable
sl@0
    15
{
sl@0
    16
  public:
sl@0
    17
      docstring_options(bool show_all=true)
sl@0
    18
      {
sl@0
    19
          previous_show_user_defined_ = show_user_defined_;
sl@0
    20
          previous_show_signatures_ = show_signatures_;
sl@0
    21
          show_user_defined_ = show_all;
sl@0
    22
          show_signatures_ = show_all;
sl@0
    23
      }
sl@0
    24
sl@0
    25
      docstring_options(bool show_user_defined, bool show_signatures)
sl@0
    26
      {
sl@0
    27
          previous_show_user_defined_ = show_user_defined_;
sl@0
    28
          previous_show_signatures_ = show_signatures_;
sl@0
    29
          show_user_defined_ = show_user_defined;
sl@0
    30
          show_signatures_ = show_signatures;
sl@0
    31
      }
sl@0
    32
sl@0
    33
      ~docstring_options()
sl@0
    34
      {
sl@0
    35
          show_user_defined_ = previous_show_user_defined_;
sl@0
    36
          show_signatures_ = previous_show_signatures_;
sl@0
    37
      }
sl@0
    38
sl@0
    39
      void
sl@0
    40
      disable_user_defined() { show_user_defined_ = false; }
sl@0
    41
sl@0
    42
      void
sl@0
    43
      enable_user_defined() { show_user_defined_ = true; }
sl@0
    44
sl@0
    45
      void
sl@0
    46
      disable_signatures() { show_signatures_ = false; }
sl@0
    47
sl@0
    48
      void
sl@0
    49
      enable_signatures() { show_signatures_ = true; }
sl@0
    50
sl@0
    51
      void
sl@0
    52
      disable_all()
sl@0
    53
      {
sl@0
    54
        show_user_defined_ = false;
sl@0
    55
        show_signatures_ = false;
sl@0
    56
      }
sl@0
    57
sl@0
    58
      void
sl@0
    59
      enable_all()
sl@0
    60
      {
sl@0
    61
        show_user_defined_ = true;
sl@0
    62
        show_signatures_ = true;
sl@0
    63
      }
sl@0
    64
sl@0
    65
      friend struct objects::function;
sl@0
    66
sl@0
    67
  private:
sl@0
    68
      static volatile bool show_user_defined_;
sl@0
    69
      static volatile bool show_signatures_;
sl@0
    70
      bool previous_show_user_defined_;
sl@0
    71
      bool previous_show_signatures_;
sl@0
    72
};
sl@0
    73
sl@0
    74
}} // namespace boost::python
sl@0
    75
sl@0
    76
#endif // DOCSTRING_OPTIONS_RWGK20060111_HPP