[pygccxml-commit] source/pygccxml/declarations calldef.py,1.18,1.19
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <mb...@us...> - 2006-03-22 10:42:40
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2937 Modified Files: calldef.py Log Message: 1) Refined some doc strings. 2) Added specialized __str__() methods to member calldefs and free calldefs Index: calldef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/calldef.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** calldef.py 18 Dec 2005 06:36:58 -0000 1.18 --- calldef.py 22 Mar 2006 10:42:37 -0000 1.19 *************** *** 44,47 **** --- 44,53 ---- self._type = type + def __str__(self): + if self.default_value==None: + return "%s %s"%(self.type, self.name) + else: + return "%s %s=%s"%(self.type, self.name, self.default_value) + def __eq__(self, other): if not isinstance( other, self.__class__ ): *************** *** 66,70 **** self._name = name name = property( _get_name, _set_name ! , doc="name of argument" ) def _get_default_value(self): --- 72,77 ---- self._name = name name = property( _get_name, _set_name ! , doc="""Argument name. ! @type: str""" ) def _get_default_value(self): *************** *** 73,77 **** self._default_value = default_value default_value = property( _get_default_value, _set_default_value ! , doc="argument default value, could be None") def _get_type(self): --- 80,85 ---- self._default_value = default_value default_value = property( _get_default_value, _set_default_value ! , doc="""Argument's default value or None. ! @type: str""") def _get_type(self): *************** *** 80,84 **** self._type = type type = property( _get_type, _set_type ! , doc="argument L{type<type_t>}") class calldef_t( declaration.declaration_t ): --- 88,93 ---- self._type = type type = property( _get_type, _set_type ! , doc="""The type of the argument. ! @type: L{type_t}""") class calldef_t( declaration.declaration_t ): *************** *** 126,130 **** self._arguments = arguments arguments = property( _get_arguments, _set_arguments ! , doc="list of L{arguments<argument_t>}") def _get_exceptions(self): --- 135,140 ---- self._arguments = arguments arguments = property( _get_arguments, _set_arguments ! , doc="""The argument list. ! @type: list of L{argument_t}""") def _get_exceptions(self): *************** *** 133,137 **** self._exceptions = exceptions exceptions = property( _get_exceptions, _set_exceptions ! , doc="list of L{exceptions<declaration_t>}") def _get_return_type(self): --- 143,148 ---- self._exceptions = exceptions exceptions = property( _get_exceptions, _set_exceptions ! , doc="""The list of exceptions. ! @type: list of L{declaration_t}""") def _get_return_type(self): *************** *** 140,144 **** self._return_type = return_type return_type = property( _get_return_type, _set_return_type ! , doc='"callable" return L{type<type_t>}') def _get_overloads(self): --- 151,157 ---- self._return_type = return_type return_type = property( _get_return_type, _set_return_type ! , doc='''The type of the return value of the "callable" or None (constructors). ! @type: L{type_t} ! ''') def _get_overloads(self): *************** *** 157,161 **** return overloaded_funcs[:index] + overloaded_funcs[index+1:] overloads = property( _get_overloads ! , doc="""returns list of all L{"callable"'s<calldef_t>} with the same name within same scope""" ) def _get_has_extern(self): --- 170,175 ---- return overloaded_funcs[:index] + overloaded_funcs[index+1:] overloads = property( _get_overloads ! , doc="""A list of overloaded "callables" (i.e. other callables with the same name within the same scope. ! @type: list of L{calldef_t}""" ) def _get_has_extern(self): *************** *** 163,167 **** def _set_has_extern(self, has_extern): self._has_extern = has_extern ! has_extern = property( _get_has_extern, _set_has_extern ) #Second level in hierarchy of calldef --- 177,184 ---- def _set_has_extern(self, has_extern): self._has_extern = has_extern ! has_extern = property( _get_has_extern, _set_has_extern, ! doc="""Was this callable declared as "extern"? ! @type: bool ! """) #Second level in hierarchy of calldef *************** *** 174,177 **** --- 191,217 ---- self._has_static = has_static + def __str__(self): + # Get the full name of the calldef... + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + # Add the arguments... + args = map(lambda a: str(a), self.arguments) + res = "%s(%s)"%(name, ", ".join(args)) + # Add the return type... + if self.return_type!=None: + res = "%s %s"%(self.return_type, res) + # const? + if self.has_const: + res += " const" + # static? + if self.has_static: + res = "static "+res + # Append the declaration class + cls = self.__class__.__name__ + if cls[-2:]=="_t": + cls = cls[:-2] + return "%s [%s]"%(res, cls) + def _get__cmp__call_items(self): return [ self.virtuality, self.has_static, self.has_const ] *************** *** 190,199 **** self._virtuality = virtuality virtuality = property( _get_virtuality, _set_virtuality ! , doc="""describes "callable" L{virtuality type<VIRTUALITY_TYPES>}""") def _get_access_type(self): return self.parent.find_out_member_access_type( self ) access_type = property( _get_access_type ! , doc="""returns callable L{access type<ACCESS_TYPES>}""") def _get_has_const(self): --- 230,241 ---- self._virtuality = virtuality virtuality = property( _get_virtuality, _set_virtuality ! , doc="""Describes the "virtuality" of the member (as defined by the string constants in the class L{VIRTUALITY_TYPES}). ! @type: str""") def _get_access_type(self): return self.parent.find_out_member_access_type( self ) access_type = property( _get_access_type ! , doc="""Return the access type of the member (as defined by the string constants in the class L{ACCESS_TYPES}. ! @type: str""") def _get_has_const(self): *************** *** 202,206 **** self._has_const = has_const has_const = property( _get_has_const, _set_has_const ! , doc="""describes, whether "callable has const modifier or not""") def _get_has_static(self): --- 244,248 ---- self._has_const = has_const has_const = property( _get_has_const, _set_has_const ! , doc="""describes, whether "callable" has const modifier or not""") def _get_has_static(self): *************** *** 209,213 **** self._has_static = has_static has_static = property( _get_has_static, _set_has_static ! , doc="""describes, whether "callable has static modifier or not""") def function_type(self): --- 251,255 ---- self._has_static = has_static has_static = property( _get_has_static, _set_has_static ! , doc="""describes, whether "callable" has static modifier or not""") def function_type(self): *************** *** 231,234 **** --- 273,296 ---- calldef_t.__init__( self, *args, **keywords ) + def __str__(self): + # Get the full name of the calldef... + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + # Add the arguments... + args = map(lambda a: str(a), self.arguments) + res = "%s(%s)"%(name, ", ".join(args)) + # Add the return type... + if self.return_type!=None: + res = "%s %s"%(self.return_type, res) + # extern? + if self.has_extern: + res = "extern "+res + # Append the declaration class + cls = self.__class__.__name__ + if cls[-2:]=="_t": + cls = cls[:-2] + return "%s [%s]"%(res, cls) + def _get__cmp__call_items(self): return [] *************** *** 259,262 **** --- 321,325 ---- member_calldef_t.__init__( self, *args, **keywords ) + class constructor_t( member_calldef_t ): """describes constructor declaration""" |