tesseract v5.3.3.20231005
cpp.ast.Type Class Reference
Inheritance diagram for cpp.ast.Type:
cpp.ast._GenericDeclaration cpp.ast.Node

Public Member Functions

def __init__ (self, start, end, name, templated_types, modifiers, reference, pointer, array)
 
def __str__ (self)
 
def IsDeclaration (self)
 
def IsDefinition (self)
 
def IsExportable (self)
 
- Public Member Functions inherited from cpp.ast._GenericDeclaration
def __init__ (self, start, end, name, namespace)
 
def FullName (self)
 
- Public Member Functions inherited from cpp.ast.Node
def __init__ (self, start, end)
 
def IsDeclaration (self)
 
def IsDefinition (self)
 
def IsExportable (self)
 
def Requires (self, node)
 
def XXX__str__ (self)
 
def __repr__ (self)
 

Public Attributes

 templated_types
 
 name
 
 modifiers
 
 reference
 
 pointer
 
 array
 
- Public Attributes inherited from cpp.ast._GenericDeclaration
 name
 
 namespace
 
- Public Attributes inherited from cpp.ast.Node
 start
 
 end
 

Detailed Description

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

Definition at line 407 of file ast.py.

Constructor & Destructor Documentation

◆ __init__()

def cpp.ast.Type.__init__ (   self,
  start,
  end,
  name,
  templated_types,
  modifiers,
  reference,
  pointer,
  array 
)
    Args:
      name: str name of main type
      templated_types: [Class (Type?)] template type info between <>
      modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
      reference, pointer, array: bools

Reimplemented from cpp.ast._GenericDeclaration.

Definition at line 410 of file ast.py.

411 reference, pointer, array):
412 """
413 Args:
414 name: str name of main type
415 templated_types: [Class (Type?)] template type info between <>
416 modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
417 reference, pointer, array: bools
418 """
419 _GenericDeclaration.__init__(self, start, end, name, [])
420 self.templated_types = templated_types
421 if not name and modifiers:
422 self.name = modifiers.pop()
423 self.modifiers = modifiers
424 self.reference = reference
425 self.pointer = pointer
426 self.array = array
427

Member Function Documentation

◆ __str__()

def cpp.ast.Type.__str__ (   self)

Definition at line 428 of file ast.py.

428 def __str__(self):
429 prefix = ''
430 if self.modifiers:
431 prefix = ' '.join(self.modifiers) + ' '
432 name = str(self.name)
433 if self.templated_types:
434 name += '<%s>' % self.templated_types
435 suffix = prefix + name
436 if self.reference:
437 suffix += '&'
438 if self.pointer:
439 suffix += '*'
440 if self.array:
441 suffix += '[]'
442 return self._TypeStringHelper(suffix)
443

◆ IsDeclaration()

def cpp.ast.Type.IsDeclaration (   self)
Returns bool if this node is a declaration.

Reimplemented from cpp.ast.Node.

Definition at line 446 of file ast.py.

446 def IsDeclaration(self):
447 return False
448

◆ IsDefinition()

def cpp.ast.Type.IsDefinition (   self)
Returns bool if this node is a definition.

Reimplemented from cpp.ast.Node.

Definition at line 449 of file ast.py.

449 def IsDefinition(self):
450 return False
451

◆ IsExportable()

def cpp.ast.Type.IsExportable (   self)
Returns bool if this node exportable from a header file.

Reimplemented from cpp.ast.Node.

Definition at line 452 of file ast.py.

452 def IsExportable(self):
453 return False
454
455

Member Data Documentation

◆ array

cpp.ast.Type.array

Definition at line 426 of file ast.py.

◆ modifiers

cpp.ast.Type.modifiers

Definition at line 423 of file ast.py.

◆ name

cpp.ast.Type.name

Definition at line 422 of file ast.py.

◆ pointer

cpp.ast.Type.pointer

Definition at line 425 of file ast.py.

◆ reference

cpp.ast.Type.reference

Definition at line 424 of file ast.py.

◆ templated_types

cpp.ast.Type.templated_types

Definition at line 420 of file ast.py.


The documentation for this class was generated from the following file: