1
2
3
4
5
6 import os
7 import custom
8 import license
9 import include
10 import namespace
11 import compound
12 import algorithm
13 import module_body
14 import declaration_based
15 import include_directories
16 from pygccxml import utils
19 """This class represents the source code for the entire extension module.
20
21 The root of the code creator tree is always a module_t object.
22 """
29
30 @property
32 "reference to global_ns ( namespace_t ) declaration"
33 return self.__global_ns
34
51
53 include_dirs = self._get_include_dirs()
54 return include_dirs.std
55 std_directories = property( _get_std_directories )
56
58 include_dirs = self._get_include_dirs()
59 return include_dirs.user_defined
60 user_defined_directories = property( _get_user_defined_directories )
61
62 @property
64 """Return reference to L{module_body_t} code creator"""
65 if None is self.__body:
66 found = algorithm.creator_finder.find_by_class_instance( what=module_body.module_body_t
67 , where=self.creators
68 , recursive=False )
69 if found:
70 self.__body = found[0]
71 return self.__body
72
77
84 license = property( _get_license, _set_license,
85 doc="""License text.
86
87 The license text will always be the first children node.
88 @type: str or L{license_t}""")
89
91 """Return the children index of the last L{include_t} object.
92
93 An exception is raised when there is no include_t object among
94 the children creators.
95
96 @returns: Children index
97 @rtype: int
98 """
99 for i in range( len(self.creators) - 1, -1, -1 ):
100 if isinstance( self.creators[i], include.include_t ):
101 return i
102 else:
103 return 0
104
123
125 """Insert an L{include_t} object.
126
127 The include creator is inserted right after the last include file.
128
129 @param include_creator: Include creator object
130 @type include_creator: L{include_t}
131 """
132 lii = self.last_include_index()
133 if lii == 0:
134 if not self.creators:
135 lii = -1
136 elif not isinstance( self.creators[0], include.include_t ):
137 lii = -1
138 else:
139 pass
140 self.adopt_creator( include_creator, lii + 1 )
141