The GeneratorScope class manages scopes in the generator.
More...
#include <generatorScope.h>
The GeneratorScope class manages scopes in the generator.
This class is responsible for handling the scope of variables and parameters, managing indentation levels, and tracking the number of variables added to the current scope.
◆ GeneratorScope() [1/2]
GeneratorScope::GeneratorScope |
( |
int | identation = 1 | ) |
|
|
inline |
Constructs a GeneratorScope with an optional initial indentation level.
Initializes a new scope with no variables or parameters and a specified level of indentation.
- Parameters
-
identation | The initial level of indentation (default is 1). |
◆ GeneratorScope() [2/2]
GeneratorScope::GeneratorScope |
( |
std::vector< int > | parentVars, |
|
|
std::vector< int > | parentParams, |
|
|
int | parentIndentation ) |
|
inline |
Constructs a GeneratorScope based on a parent scope.
Initializes a new scope by inheriting variables, parameters, and indentation from a parent scope.
- Parameters
-
parentVars | List of variable IDs from the parent scope. |
parentParams | List of parameter IDs from the parent scope. |
parentIndentation | The indentation level of the parent scope. |
◆ ~GeneratorScope()
GeneratorScope::~GeneratorScope |
( |
| ) |
|
|
inline |
Destructor for the GeneratorScope class.
Currently, this destructor does not perform any special operations.
◆ addParam()
int GeneratorScope::addParam |
( |
| ) |
|
Adds a new parameter ID to the current scope.
Adds a new parameter by pushing the next available parameter ID to the list and returning its position.
- Returns
- The index of the newly added parameter.
◆ addVar()
void GeneratorScope::addVar |
( |
int | id | ) |
|
Adds a variable ID to the current scope.
Increases the count of added variables and stores the given variable ID in the list of available variable IDs.
- Parameters
-
id | The ID of the variable to add. |
◆ getIndentation()
int GeneratorScope::getIndentation |
( |
| ) |
|
Retrieves the current indentation level.
- Returns
- The current indentation level.
◆ getIndentationTabs()
std::string GeneratorScope::getIndentationTabs |
( |
int | d = 0 | ) |
|
Generates a string of tabs for code indentation.
This method creates a string containing tabs based on the current indentation level and an additional depth parameter.
- Parameters
-
d | Additional depth to add to the current indentation (default is 0). |
- Returns
- A string of tabs representing the indentation.
◆ getVarCounter()
int GeneratorScope::getVarCounter |
( |
| ) |
|
Gets the number of available variables in the current scope.
- Returns
- The number of available variables.
◆ avaiableParamsID
std::vector<int> GeneratorScope::avaiableParamsID |
◆ avaiableVarsID
std::vector<int> GeneratorScope::avaiableVarsID |
◆ numberOfAddedVars
int GeneratorScope::numberOfAddedVars |
The documentation for this class was generated from the following files: