FireflyBoardParser Class Reference

#include <FireflyBoardParser.h>

List of all members.

Public Member Functions

MVFireflygetFirefly ()
MVBoardgetBoard ()
void parse (std::string filename)
 Start parsing. Parses row by row.

Static Public Member Functions

static FireflyBoardParsergetInstance ()

Private Member Functions

 FireflyBoardParser ()
 Standard Constructor.
char readChar ()
 Read the next character from the input file and check for EOF.
Token readToken ()
 Read the next token, consuming the next character(s).
std::string tokenToString (Token tok)
 A convenience function which translates Tokens to textual representation.
void parseRow_walkToNextLinebreak ()
 Helping function for parseRow().
void parseRow_silentErrorRecover (std::string message)
 Helping function for parseRow().
bool parseRow_readRequiredToken (Token requiredToken)
 Helping function for parseRow().
bool parseRow_readRequiredNumberToken (int &value)
 Helping function for parseRow().
bool parseRow_readTwoRequiredCommaSeparatedNumberTokens (int &value1, int &value2)
 Helping function for parseRow().
void parseRow ()
 Parses a single row. Reads in the first token and figures out which keyword it is. Then, read the appropriate parameters and prepare the result.

Private Attributes

std::ifstream * file
 input file stream
char next
 current character
Token token
 current token's symbol class
int valNumber
 current token's int-value (NUMBER)
std::string valWord
 current token's string-value (WORD)
MVBoard board
MVFirefly firefly

Static Private Attributes

static FireflyBoardParserinstance = 0
 The singleton instance.


Constructor & Destructor Documentation

FireflyBoardParser::FireflyBoardParser (  )  [private]

Standard Constructor.


Member Function Documentation

char FireflyBoardParser::readChar (  )  [private]

Read the next character from the input file and check for EOF.

Read the next character from the input file and check for EOF.

Token FireflyBoardParser::readToken (  )  [private]

Read the next token, consuming the next character(s).

Read the next token, consuming the next character(s).

std::string FireflyBoardParser::tokenToString ( Token  tok  )  [private]

A convenience function which translates Tokens to textual representation.

A convenience function which translates Tokens to textual representation.

void FireflyBoardParser::parseRow_walkToNextLinebreak (  )  [private]

Helping function for parseRow().

void FireflyBoardParser::parseRow_silentErrorRecover ( std::string  message  )  [private]

Helping function for parseRow().

bool FireflyBoardParser::parseRow_readRequiredToken ( Token  requiredToken  )  [private]

Helping function for parseRow().

bool FireflyBoardParser::parseRow_readRequiredNumberToken ( int &  value  )  [private]

Helping function for parseRow().

bool FireflyBoardParser::parseRow_readTwoRequiredCommaSeparatedNumberTokens ( int &  value1,
int &  value2 
) [private]

Helping function for parseRow().

void FireflyBoardParser::parseRow (  )  [private]

Parses a single row. Reads in the first token and figures out which keyword it is. Then, read the appropriate parameters and prepare the result.

Parses a single row. Reads in the first token and figures out which keyword it is. Then, read the appropriate parameters and prepare the result.

FireflyBoardParser * FireflyBoardParser::getInstance (  )  [static]

The only way to access the manager

MVFirefly * FireflyBoardParser::getFirefly (  ) 

MVBoard * FireflyBoardParser::getBoard (  ) 

void FireflyBoardParser::parse ( std::string  filename  ) 

Start parsing. Parses row by row.

Start parsing. Parses row by row. Please notice:

  • Only very basic error recovery (ignore incorrect, nonempty lines)
  • Parser does not check semantical validity (e.g., if a wall is placed between two places located side by side).


Member Data Documentation

The singleton instance.

std::ifstream* FireflyBoardParser::file [private]

input file stream

char FireflyBoardParser::next [private]

current character

current token's symbol class

current token's int-value (NUMBER)

std::string FireflyBoardParser::valWord [private]

current token's string-value (WORD)


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

Generated on Mon Jul 7 13:30:33 2008 for Firefly by  doxygen 1.5.6