1
2
3
4
5
6 """defines class that configure class definition and class declaration exposing"""
7
8 import os
9 import user_text
10 import properties
11 import decl_wrapper
12 import scopedef_wrapper
13 from pyplusplus import messages
14 from pygccxml import declarations
15 import indexing_suite1 as isuite1
16 import indexing_suite2 as isuite2
17
18 ACCESS_TYPES = declarations.ACCESS_TYPES
19 VIRTUALITY_TYPES = declarations.VIRTUALITY_TYPES
27
28
29 always_expose_using_scope_documentation = \
30 """boolean, configures how Py++ should generate code for class.
31 Py can generate code using IDL like syntax:
32
33 class_< ... >( ... )
34 .def( ... );
35
36 Or it can generate code using more complex form:
37
38 typedef bp::class_< my_class > my_class_exposer_t;
39 my_class_exposer_t my_class_exposer = my_class_exposer_t( "my_class" );
40 boost::python::scope my_class_scope( my_class_exposer );
41 my_class_exposer.def( ... );
42
43 Also, the second way is much longer, it solves few problems:
44
45 - you can not expose enums and internal classes defined within the class using first method
46 - you will get much better compilation errors
47 - the code looks like regular C++ code after all :-)
48
49 By default, this property is set to False. Also, Py++ knows pretty well
50 when it have to ignore this property and generate right code
51 """
54 """defines few properties that are common to
55 L{class declaration<pygccxml.declarations.class_declaration_t>} and
56 L{definition<pygccxml.declarations.class_t>} classes
57 """
59 object.__init__( self )
60 self._always_expose_using_scope = None
61 self._indexing_suite = None
62 self._equality_comparable = None
63 self._less_than_comparable = None
64 self._isuite_version = 1
65 self._opaque = False
66
68 return self._isuite_version
70 assert version in ( 1, 2 )
71 if self._isuite_version != version:
72 self._isuite_version = version
73 self._indexing_suite = None
74 indexing_suite_version = property( _get_indexing_suite_version, _set_indexing_suite_version
75 , doc="indexing suite version")
76
77 @property
79 """reference to indexing suite configuration class.
80
81 If the class is not STD container, this property will contain None"
82 """
83 if self._indexing_suite is None:
84 if self.container_traits:
85 if self._isuite_version == 1:
86 self._indexing_suite = isuite1.indexing_suite1_t( self )
87 else:
88 self._indexing_suite = isuite2.indexing_suite2_t( self )
89 return self._indexing_suite
90
97
108
110 self._always_expose_using_scope = value
111 always_expose_using_scope = property( _get_always_expose_using_scope, _set_always_expose_using_scope
112 , doc="please see L{class_wrapper.always_expose_using_scope_documentation} variable for documentation." )
113
115 if None is self._equality_comparable:
116 self._equality_comparable = declarations.has_public_equal( self )
117 return self._equality_comparable
118
120 self._equality_comparable = value
121
122 equality_comparable = property( _get_equality_comparable, _set_equality_comparable
123 , doc="indicates existence of public operator=" \
124 +"Default value is calculated, based on information presented in the declarations tree" )
125
127 if None is self._less_than_comparable:
128 self._less_than_comparable = declarations.has_public_less( self )
129 return self._less_than_comparable
130
132 self._less_than_comparable = value
133
134 less_than_comparable = property( _get_less_than_comparable, _set_less_than_comparable
135 , doc="indicates existence of public operator<. " \
136 +"Default value is calculated, based on information presented in the declarations tree" )
137
140
144
145