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

Public Member Functions

def __init__ (self, start, end, name, bases, templated_types, body, namespace)
 
def IsDeclaration (self)
 
def IsDefinition (self)
 
def IsExportable (self)
 
def Requires (self, node)
 
def __str__ (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

 bases
 
 body
 
 templated_types
 
- Public Attributes inherited from cpp.ast._GenericDeclaration
 name
 
 namespace
 
- Public Attributes inherited from cpp.ast.Node
 start
 
 end
 

Detailed Description

Definition at line 319 of file ast.py.

Constructor & Destructor Documentation

◆ __init__()

def cpp.ast.Class.__init__ (   self,
  start,
  end,
  name,
  bases,
  templated_types,
  body,
  namespace 
)

Reimplemented from cpp.ast._GenericDeclaration.

Definition at line 320 of file ast.py.

320 def __init__(self, start, end, name, bases, templated_types, body, namespace):
321 _GenericDeclaration.__init__(self, start, end, name, namespace)
322 self.bases = bases
323 self.body = body
324 self.templated_types = templated_types
325

Member Function Documentation

◆ __str__()

def cpp.ast.Class.__str__ (   self)

Definition at line 346 of file ast.py.

346 def __str__(self):
347 name = self.name
348 if self.templated_types:
349 name += '<%s>' % self.templated_types
350 suffix = '%s, %s, %s' % (name, self.bases, self.body)
351 return self._TypeStringHelper(suffix)
352
353

◆ IsDeclaration()

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

Reimplemented from cpp.ast.Node.

Definition at line 326 of file ast.py.

326 def IsDeclaration(self):
327 return self.bases is None and self.body is None
328

◆ IsDefinition()

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

Reimplemented from cpp.ast.Node.

Definition at line 329 of file ast.py.

329 def IsDefinition(self):
330 return not self.IsDeclaration()
331

◆ IsExportable()

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

Reimplemented from cpp.ast.Node.

Definition at line 332 of file ast.py.

332 def IsExportable(self):
333 return not self.IsDeclaration()
334

◆ Requires()

def cpp.ast.Class.Requires (   self,
  node 
)
Does this AST node require the definition of the node passed in?

Reimplemented from cpp.ast.Node.

Definition at line 335 of file ast.py.

335 def Requires(self, node):
336 # TODO(nnorwitz): handle namespaces, etc.
337 if self.bases:
338 for token_list in self.bases:
339 # TODO(nnorwitz): bases are tokens, do name comparison.
340 for token in token_list:
341 if token.name == node.name:
342 return True
343 # TODO(nnorwitz): search in body too.
344 return False
345

Member Data Documentation

◆ bases

cpp.ast.Class.bases

Definition at line 322 of file ast.py.

◆ body

cpp.ast.Class.body

Definition at line 323 of file ast.py.

◆ templated_types

cpp.ast.Class.templated_types

Definition at line 324 of file ast.py.


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