Public Member Functions

Parser Class Reference

L-system definition file parser. More...

#include <Parser.hpp>

Collaboration diagram for Parser:
Collaboration graph
[legend]

Public Member Functions

 Parser ()
 Parser constructor.
void parse (ifstream &file)
 Parse the L-system definition file.
set< char > getAlphabet () const
 Alphabet getter.
string getAxiom () const
 Axiom getter.
multimap< char, string > getRules () const
 Production rules getter.
int getIterations () const
 Number of iterations to run getter.
map< char, string > getTurtle () const
 Turtle graphics getter.
string getReductionScale () const
 Drawing reduction scale getter.
vector< string > getInitPos () const
 Initial position getter.
string getInitAng () const
 Initial angle getter.

Detailed Description

L-system definition file parser.

Follows a symbolic definition similar to the L-system as is defined in the Wikipedia, but it avoids punctuation marks for convenient parsing issues.

Author:
Alexandre Trilla (atrilla)

Definition at line 57 of file Parser.hpp.


Constructor & Destructor Documentation

Parser::Parser (  ) 

Parser constructor.

Postcondition:
Builds the parser.

Member Function Documentation

set<char> Parser::getAlphabet (  )  const

Alphabet getter.

Returns:
The alphabet of the L-system definition.
Precondition:
Parser has to be loaded.
Postcondition:
The alphabet is returned.
string Parser::getAxiom (  )  const

Axiom getter.

Returns:
The axiom of the L-system definition.
Precondition:
Parser has to be loaded.
Postcondition:
The axiom is returned.
string Parser::getInitAng (  )  const

Initial angle getter.

Returns:
The initial angle of the turtle.
Precondition:
Parser has to be loaded.
Postcondition:
The initial angle of the turtle.
vector<string> Parser::getInitPos (  )  const

Initial position getter.

Returns:
The initial position of the turtle.
Precondition:
Parser has to be loaded.
Postcondition:
The initial position of the turtle.
int Parser::getIterations (  )  const

Number of iterations to run getter.

Returns:
The number of iterations to run.
Precondition:
Parser has to be loaded.
Postcondition:
The number of iterations to run is returned.
string Parser::getReductionScale (  )  const

Drawing reduction scale getter.

Returns:
The drawing reduction scale.
Precondition:
Parser has to be loaded.
Postcondition:
The reduction rate applied to the drawing.
multimap<char, string> Parser::getRules (  )  const

Production rules getter.

Returns:
The production rules of the L-system definition.
Precondition:
Parser has to be loaded.
Postcondition:
The production rules are returned.
map<char, string> Parser::getTurtle (  )  const

Turtle graphics getter.

Returns:
The symbol-drawing instruction correspondence.
Precondition:
Parser has to be loaded.
Postcondition:
The correspondence of symbol-drawing instruction.
void Parser::parse ( ifstream &  file  ) 

Parse the L-system definition file.

Parameters:
file The file.
Precondition:
File must be open.
Postcondition:
Parser loaded with definition. Does not close file.

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