os/ossrv/ossrv_pub/boost_apis/boost/python/object/class.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright David Abrahams 2001.
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 CLASS_DWA20011214_HPP
sl@0
     6
# define CLASS_DWA20011214_HPP
sl@0
     7
sl@0
     8
# include <boost/python/detail/prefix.hpp>
sl@0
     9
# include <boost/utility.hpp>
sl@0
    10
# include <boost/python/object_core.hpp>
sl@0
    11
# include <boost/python/type_id.hpp>
sl@0
    12
# include <cstddef>
sl@0
    13
sl@0
    14
namespace boost { namespace python {
sl@0
    15
sl@0
    16
namespace objects { 
sl@0
    17
sl@0
    18
struct BOOST_PYTHON_DECL class_base : python::api::object
sl@0
    19
{
sl@0
    20
    // constructor
sl@0
    21
    class_base(
sl@0
    22
        char const* name              // The name of the class
sl@0
    23
        
sl@0
    24
        , std::size_t num_types         // A list of class_ids. The first is the type
sl@0
    25
        , type_info const*const types    // this is wrapping. The rest are the types of
sl@0
    26
                                        // any bases.
sl@0
    27
        
sl@0
    28
        , char const* doc = 0           // Docstring, if any.
sl@0
    29
        );
sl@0
    30
sl@0
    31
sl@0
    32
    // Implementation detail. Hiding this in the private section would
sl@0
    33
    // require use of template friend declarations.
sl@0
    34
    void enable_pickling_(bool getstate_manages_dict);
sl@0
    35
sl@0
    36
 protected:
sl@0
    37
    void add_property(
sl@0
    38
        char const* name, object const& fget, char const* docstr);
sl@0
    39
    void add_property(char const* name, 
sl@0
    40
        object const& fget, object const& fset, char const* docstr);
sl@0
    41
sl@0
    42
    void add_static_property(char const* name, object const& fget);
sl@0
    43
    void add_static_property(char const* name, object const& fget, object const& fset);
sl@0
    44
    
sl@0
    45
    // Retrieve the underlying object
sl@0
    46
    void setattr(char const* name, object const&);
sl@0
    47
sl@0
    48
    // Set a special attribute in the class which tells Boost.Python
sl@0
    49
    // to allocate extra bytes for embedded C++ objects in Python
sl@0
    50
    // instances.
sl@0
    51
    void set_instance_size(std::size_t bytes);
sl@0
    52
sl@0
    53
    // Set an __init__ function which throws an appropriate exception
sl@0
    54
    // for abstract classes.
sl@0
    55
    void def_no_init();
sl@0
    56
sl@0
    57
    // Effects:
sl@0
    58
    //  setattr(self, staticmethod(getattr(self, method_name)))
sl@0
    59
    void make_method_static(const char *method_name);
sl@0
    60
};
sl@0
    61
sl@0
    62
}}} // namespace boost::python::objects
sl@0
    63
sl@0
    64
#endif // CLASS_DWA20011214_HPP