]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/test/cltree.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / python / test / cltree.cpp
CommitLineData
7c673cae
FG
1// Copyright David Abrahams 2005. Distributed under the Boost
2// Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#include <boost/python/module.hpp>
6#include <boost/python/def.hpp>
7#include <boost/python/class.hpp>
8#include <boost/utility.hpp>
9
10/* Non-modifiable definitions */
11
12class basic {
13public:
14 basic() { name = "cltree.basic"; }
15 std::string repr() { return name+"()"; }
16protected:
17 std::string name;
18};
19
20class constant: public basic {
21public:
22 constant() { name = "cltree.constant"; }
23};
24
25class symbol: public basic {
26public:
27 symbol() { name = "cltree.symbol"; }
28};
29
30class variable: public basic {
31public:
32 variable() { name = "cltree.variable"; }
33};
34
35/* EOF: Non-modifiable definitions */
36
37class symbol_wrapper: public symbol {
38public:
39 symbol_wrapper(PyObject* /*self*/): symbol() {
40 name = "cltree.wrapped_symbol";
41 }
42};
43
44class variable_wrapper: public variable {
45public:
46 variable_wrapper(PyObject* /*self*/): variable() {
47 name = "cltree.wrapped_variable";
48 }
49
50 // This constructor is introduced only because cannot use
51 // boost::noncopyable, see below.
52 variable_wrapper(PyObject* /*self*/,variable v): variable(v) {}
53
54};
55
56BOOST_PYTHON_MODULE(cltree)
57{
58 boost::python::class_<basic>("basic")
59 .def("__repr__",&basic::repr)
60 ;
61
62 boost::python::class_<constant, boost::python::bases<basic>, boost::noncopyable>("constant")
63 ;
64
65
66 boost::python::class_<symbol, symbol_wrapper, boost::noncopyable>("symbol")
67 ;
68
69 boost::python::class_<variable, boost::python::bases<basic>, variable_wrapper>("variable")
70 ;
71}
72
73#include "module_tail.cpp"
74