HyperspaceExplorer 0.7.1
|
Parser reads a file and executes the commands in it in a C4DView. More...
#include <Parser.h>
Public Member Functions | |
Parser (const std::string &file) | |
open a parser object for a given filename | |
bool | execute () |
Execute the commands described in the rc-file. | |
void | setView (UI::View *view) |
Define the view we operate on. | |
UI::View * | getView () const |
Private Attributes | |
std::vector< std::string > | _lines |
Lines of the script. | |
UI::View * | _view |
The View on which we're operating. |
Parser reads a file and executes the commands in it in a C4DView.
This class takes the role of the Context class in the class diagram for the Interpreter pattern in the GOF book, p. 245
Script::Parser::Parser | ( | const std::string & | file | ) |
open a parser object for a given filename
Read a command file and store its content for later execution.
The content of file
is stored line-wise
file | The script file that is read |
References _lines, std::vector< _Tp, _Alloc >::push_back(), and Script::strip_comments().
bool Script::Parser::execute | ( | ) |
Execute the commands described in the rc-file.
execute the commands for the current command file
Executes the statements in the file one after the other
References _lines, std::vector< _Tp, _Alloc >::begin(), Script::StatementFactory::createStatement(), std::vector< _Tp, _Alloc >::end(), and Script::Statement::execute().
UI::View* Script::Parser::getView | ( | ) | const [inline] |
References _view.
Referenced by Script::ImgPrefixStmt::execute(), Script::ImgDirStmt::execute(), Script::AnimateStmt::execute(), Script::Fog4DStmt::execute(), Script::FogStmt::execute(), Script::SolidStmt::execute(), Script::WireStmt::execute(), Script::TransStmt::execute(), Script::LightStmt::execute(), Script::ShadingStmt::execute(), Script::ColorStmt::execute(), Script::LoopStmt::execute(), Script::FramesStmt::execute(), Script::DeltaStmt::execute(), Script::XformStmt::execute(), Script::ObjectStmt::execute(), and Script::SizeStmt::execute().