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

Public Member Functions

def __init__ (self, start, end, name, var_type, initial_value, namespace)
 
def Requires (self, node)
 
def ToString (self)
 
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

 type
 
 initial_value
 
- Public Attributes inherited from cpp.ast._GenericDeclaration
 name
 
 namespace
 
- Public Attributes inherited from cpp.ast.Node
 start
 
 end
 

Detailed Description

Definition at line 250 of file ast.py.

Constructor & Destructor Documentation

◆ __init__()

def cpp.ast.VariableDeclaration.__init__ (   self,
  start,
  end,
  name,
  var_type,
  initial_value,
  namespace 
)

Reimplemented from cpp.ast._GenericDeclaration.

Definition at line 251 of file ast.py.

251 def __init__(self, start, end, name, var_type, initial_value, namespace):
252 _GenericDeclaration.__init__(self, start, end, name, namespace)
253 self.type = var_type
254 self.initial_value = initial_value
255

Member Function Documentation

◆ __str__()

def cpp.ast.VariableDeclaration.__str__ (   self)

Definition at line 267 of file ast.py.

267 def __str__(self):
268 return self._StringHelper(self.__class__.__name__, self.ToString())
269
270

◆ Requires()

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

Reimplemented from cpp.ast.Node.

Definition at line 256 of file ast.py.

256 def Requires(self, node):
257 # TODO(nnorwitz): handle namespaces, etc.
258 return self.type.name == node.name
259

◆ ToString()

def cpp.ast.VariableDeclaration.ToString (   self)
Return a string that tries to reconstitute the variable decl.

Definition at line 260 of file ast.py.

260 def ToString(self):
261 """Return a string that tries to reconstitute the variable decl."""
262 suffix = '%s %s' % (self.type, self.name)
263 if self.initial_value:
264 suffix += ' = ' + self.initial_value
265 return suffix
266

Member Data Documentation

◆ initial_value

cpp.ast.VariableDeclaration.initial_value

Definition at line 254 of file ast.py.

◆ type

cpp.ast.VariableDeclaration.type

Definition at line 253 of file ast.py.


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