Trees | Indices | Help |
|
---|
|
1 # Copyright 2004-2008 Roman Yakovenko. 2 # Distributed under the Boost Software License, Version 1.0. (See 3 # accompanying file LICENSE_1_0.txt or copy at 4 # http://www.boost.org/LICENSE_1_0.txt) 5 6 import types 7 from pygccxml.declarations import * 85311 decl_visitor_t.__init__(self) 12 type_visitor_t.__init__(self) 13 object.__init__(self) 14 15 self.__decls = decls 16 self.__types = types 17 self.__access = access 18 self.__membership = membership 19 self.__files = files 20 self.__inst = None 21 22 self.__compiler = None 23 if self.__decls: 24 for d in self.__decls.itervalues(): 25 self.__compiler = d.compiler 26 break2731 self.__inst = inst 32 #use inst, to reduce attribute access time 33 if isinstance( inst, declaration_t ) and inst.location: 34 inst.location.file_name = self.__files[inst.location.file_name]35 instance = property( _get_inst, _set_inst ) 3638 if type_id is None: 39 return None #in some situations type_id is None, return_type of constructor or destructor 40 elif self.__types.has_key( type_id ): 41 return self.__types[type_id] 42 elif self.__decls.has_key( type_id ): 43 base = declarated_t( declaration=self.__decls[ type_id ] ) 44 self.__types[type_id] = base 45 return base 46 elif '...' == type_id: 47 return ellipsis_t() 48 else: 49 return unknown_t()50 52 self.__inst.base = self.__link_type( self.__inst.base )55 if not self.__membership.has_key( id(self.__inst) ): 56 return 57 for member in self.__membership[ id(self.__inst) ]: 58 if not self.__access.has_key( member ): 59 continue 60 access = self.__access[member] 61 if not self.__decls.has_key( member ): 62 continue 63 decl = self.__decls[member] 64 if isinstance( self.__inst, class_t ): 65 self.__inst.adopt_declaration( decl, access ) 66 else: 67 self.__inst.adopt_declaration( decl )6870 self.__inst.return_type = self.__link_type( self.__inst.return_type ) 71 if isinstance( self.__inst, type_t ): 72 linked_args = [ self.__link_type( arg ) for arg in self.__inst.arguments_types ] 73 self.__inst.arguments_types = linked_args 74 else: 75 for arg in self.__inst.arguments: 76 arg.type = self.__link_type(arg.type) 77 for index in range( len( self.__inst.exceptions ) ): 78 try: 79 self.__inst.exceptions[index] = self.__decls[ self.__inst.exceptions[index] ] 80 except KeyError: 81 self.__inst.exceptions[index] = self.__link_type( self.__inst.exceptions[index] )82 85 88 91 94 97 #will be fixed by patcher. It is needed because of demangled name taken into account 98 #self.__inst._name = 'operator ' + self.__inst.return_type.decl_string 99 102 105 108110 self.__link_members() 111 #GCC-XML sometimes generates constructors with names that does not match 112 #class name. I think this is because those constructors are compiler 113 #generated. I need to find out more about this and to talk with Brad 114 115 new_name = self.__inst._name 116 if templates.is_instantiation( new_name ): 117 new_name = templates.name( new_name ) 118 119 for decl in self.__inst.declarations: 120 if not isinstance( decl, constructor_t ): 121 continue 122 if '.' in decl._name or '$' in decl._name: 123 decl._name = new_name 124 125 bases = self.__inst.bases.split() 126 self.__inst.bases = [] 127 for base in bases: 128 #it could be "_5" or "protected:_5" 129 data = base.split(':') 130 base_decl = self.__decls[ data[-1] ] 131 access = ACCESS_TYPES.PUBLIC 132 if 2 == len( data ): 133 access = data[0] 134 self.__inst.bases.append( hierarchy_info_t( base_decl, access ) ) 135 base_decl.derived.append( hierarchy_info_t( self.__inst, access ) )136 139 142 145 148 151 154 157 160 163 166 169 172 175 178 181 184 187 190 193 196 199 202 205 208 211 214 217 220 223 226 229 232 235 238240 if '0.9' in self.__compiler and isinstance( self.__inst.base, member_variable_type_t ): 241 original_inst = self.__inst 242 self.__inst = self.__inst.base 243 self.visit_member_variable_type() 244 self.__inst = original_inst 245 else: 246 self.__link_compound_type()247 250 253 256258 self.__link_calldef() 259 if isinstance( self.__inst, type_t ): 260 self.__inst.class_inst = self.__link_type( self.__inst.class_inst )261263 self.__inst.variable_type = self.__link_type( self.__inst.variable_type ) 264 self.__link_compound_type()265267 if isinstance( self.__inst.declaration, types.StringTypes ): 268 self.__inst.declaration = self.__decls[self.__inst.declaration]269 272
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 20 08:51:40 2008 | http://epydoc.sourceforge.net |