HyperspaceExplorer 0.7.1
Public Member Functions | Private Attributes
Script::Parser Class Reference

Parser reads a file and executes the commands in it in a C4DView. More...

#include <Parser.h>

Collaboration diagram for Script::Parser:
Collaboration graph
[legend]

List of all members.

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::ViewgetView () const

Private Attributes

std::vector< std::string_lines
 Lines of the script.
UI::View_view
 The View on which we're operating.

Detailed Description

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

Author:
Helge Preuss <lene.preuss@gmail.com>

Constructor & Destructor Documentation

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

Todo:
lines must not be longer than 4095 characters. Everything after that is discarded. This is a limitation of std::ifstream::getline().
Parameters:
fileThe script file that is read

References _lines, std::vector< _Tp, _Alloc >::push_back(), and Script::strip_comments().

Here is the call graph for this function:


Member Function Documentation

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

Returns:
success

References _lines, std::vector< _Tp, _Alloc >::begin(), Script::StatementFactory::createStatement(), std::vector< _Tp, _Alloc >::end(), and Script::Statement::execute().

Here is the call graph for this function:

UI::View* Script::Parser::getView ( ) const [inline]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:19 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo