|
Schnek
|
#include <variables.hpp>
Public Member Functions | |
| VariableStorage (std::string name, std::string classname) | |
| Construct with the name and classname of the root block. | |
| VariableStorage (const VariableStorage &storage) | |
| void | resetCursor () |
| reset the cursor to the root block | |
| void | cursorUp () |
| void | addVariable (std::string name, pVariable variable) |
| pBlockVariables | createBlock (std::string name, std::string classname) |
| pBlockVariables | getRootBlock () |
| Returns the root block. | |
| pBlockVariables | getCurrentBlock () |
| Returns the current block given by the cursor. | |
VariableStorage holds the blocks and variables in a tree structure The class contains a cursor that will follow the last inserted block. The cursor is used when constructing the structure from the input deck.
| void VariableStorage::addVariable | ( | std::string | name, |
| pVariable | variable | ||
| ) |
Add a new variable with a given name The variable is inserted into the current block given by the cursor. Throws an exception if the variable name already exists.
| pBlockVariables VariableStorage::createBlock | ( | std::string | name, |
| std::string | classname | ||
| ) |
Create a new block with the name and classname The block is inserted as the child of the current block given by the cursor. Returns a pointer to the new block or throws an exception if the block name already exists.
| void VariableStorage::cursorUp | ( | ) |
Move the cursor up one level. If the cursor is already at the root, nothing happens