MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / Type

Class Type

tests/external/gmock-1.7.0/scripts/generator/cpp/ast.py:408–454  ·  view source on GitHub ↗

Type used for any variable (eg class, primitive, struct, etc).

Source from the content-addressed store, hash-verified

406
407
408class Type(_GenericDeclaration):
409 """Type used for any variable (eg class, primitive, struct, etc)."""
410
411 def __init__(self, start, end, name, templated_types, modifiers,
412 reference, pointer, array):
413 """
414 Args:
415 name: str name of main type
416 templated_types: [Class (Type?)] template type info between <>
417 modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
418 reference, pointer, array: bools
419 """
420 _GenericDeclaration.__init__(self, start, end, name, [])
421 self.templated_types = templated_types
422 if not name and modifiers:
423 self.name = modifiers.pop()
424 self.modifiers = modifiers
425 self.reference = reference
426 self.pointer = pointer
427 self.array = array
428
429 def __str__(self):
430 prefix = ''
431 if self.modifiers:
432 prefix = ' '.join(self.modifiers) + ' '
433 name = str(self.name)
434 if self.templated_types:
435 name += '<%s>' % self.templated_types
436 suffix = prefix + name
437 if self.reference:
438 suffix += '&'
439 if self.pointer:
440 suffix += '*'
441 if self.array:
442 suffix += '[]'
443 return self._TypeStringHelper(suffix)
444
445 # By definition, Is* are always False. A Type can only exist in
446 # some sort of variable declaration, parameter, or return value.
447 def IsDeclaration(self):
448 return False
449
450 def IsDefinition(self):
451 return False
452
453 def IsExportable(self):
454 return False
455
456
457class TypeConverter(object):

Callers 4

AddTypeMethod · 0.70
AddParameterMethod · 0.70
CreateReturnTypeMethod · 0.70
_CreateVariableMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected