Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuGuiParser Class Reference

Parses gui script files into separate sections and generates the corresponding utility. More...

#include <vuGuiParser.h>

Inheritance diagram for vuGuiParser:

Inheritance graph
[legend]
Collaboration diagram for vuGuiParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuGuiParser ()
 default constructor, does nothing
 ~vuGuiParser ()
 destrustor, does nothing
void Parse (const char *filename) throw (const char *)
 Parses the given gui script file, and generates the corresponding class.

Private Member Functions

void ParseGui ()
 Parses a gui declaration.
void ParseSections ()
 Parses the different sections of a gui declaration.
void ParseAPIs ()
 Parses the API section of the gui declaration.
void ParseControls (const char *Location)
 Parses the init section of the gui declaration.
vuString ParseListBox (const char *Name)
 Parses a listbox declaration.
vuString ParseSlider (const char *Name)
 Parses a slider declaration.
vuString ParseButton (const char *Name)
 Parses a button declaration.
vuString ParseCheckBox (const char *Name)
 Parse a checkbox declaration.
vuString ParseRadioBox (const char *Name)
 Parse a radiobox declaration.
void ParseMethod (const char *Header)
 Parses a block of code from the file and writes it as a method to the output file.
vuString ParseStatement ()
 Parses a statement from the file and translates it into a method call.
StringList ParseList ()
 Parses a list of identifiers from the file.
void WriteData ()
 Writes the accumulated control data to the files.

Private Attributes

ofstream m_fHeader
 The output header file for the generated gui class.
ofstream m_fImpl
 The output implemenation file for the generated gui class.
vuString m_Name
 The name of the gui that is being read.
vuString m_Base
 The utility base class that the gui is derived from.
StringList m_Apis
 The header files to be included for the gui class.
StringList m_Controls
 The names of the defined controls.

Detailed Description

Parses gui script files into separate sections and generates the corresponding utility.

This is the main class for the vuTextGui program. It accepts the filename of the gui script file, then parses and interprets the script. The text file is interpreted by sections, with an api section, and widget define sections. The syntax for this is described in the vuTextGui documentation.

The current implementation outputs the gui utility implementation as it read the script file. This was done to keep the difficulty of the coding in line with the importance of the text gui, ie not to overkill on design. The parser is therefore relatively simple and keeps to the task at hand.

Definition at line 25 of file vuGuiParser.h.


Constructor & Destructor Documentation

vuGuiParser::vuGuiParser  ) 
 

default constructor, does nothing

Definition at line 20 of file vuGuiParser.cpp.

vuGuiParser::~vuGuiParser  ) 
 

destrustor, does nothing

Definition at line 28 of file vuGuiParser.cpp.


Member Function Documentation

void vuGuiParser::Parse const char *  filename  )  throw (const char *) [virtual]
 

Parses the given gui script file, and generates the corresponding class.

Reimplemented from vuParser.

Definition at line 36 of file vuGuiParser.cpp.

Referenced by main().

void vuGuiParser::ParseAPIs  )  [private]
 

Parses the API section of the gui declaration.

Definition at line 91 of file vuGuiParser.cpp.

References vuDVector< T >::getLength(), m_fImpl, m_Name, ParseList(), vuParser::readToken(), and StringList.

Referenced by ParseGui().

Here is the call graph for this function:

vuString vuGuiParser::ParseButton const char *  Name  )  [private]
 

Parses a button declaration.

The method parses a button define statement. It adds the name of the control to the control list, and generates the statements to initialize the control. The initialization statements are returned in a string.

Returns:
The c++ statements needed to create and initialize the control.

Definition at line 487 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuDVector< T >::getLength(), vuDVector< T >::isMember(), m_Controls, ParseList(), ParseMethod(), and StringList.

Referenced by ParseControls().

Here is the call graph for this function:

vuString vuGuiParser::ParseCheckBox const char *  Name  )  [private]
 

Parse a checkbox declaration.

The method parses a checkbox define statement. It adds the name of the control to the control list, and generates the statements to initialize the control. The initialization statements are returned in a string.

Returns:
The c++ statements needed to create and initialize the control.

Definition at line 452 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuDVector< T >::getLength(), vuDVector< T >::isMember(), m_Controls, ParseList(), ParseMethod(), and StringList.

Referenced by ParseControls().

Here is the call graph for this function:

void vuGuiParser::ParseControls const char *  Location  )  [private]
 

Parses the init section of the gui declaration.

Definition at line 147 of file vuGuiParser.cpp.

References CONTROL_DEFINE, vuParser::finished(), m_fHeader, m_fImpl, m_Name, ParseButton(), ParseCheckBox(), ParseListBox(), ParseRadioBox(), ParseSlider(), and vuParser::readToken().

Referenced by ParseSections().

Here is the call graph for this function:

void vuGuiParser::ParseGui  )  [private]
 

Parses a gui declaration.

Definition at line 50 of file vuGuiParser.cpp.

References GUI_OPEN, m_Base, m_fHeader, m_fImpl, m_Name, ParseAPIs(), ParseSections(), and WriteData().

Here is the call graph for this function:

StringList vuGuiParser::ParseList  )  [private]
 

Parses a list of identifiers from the file.

Returns:
A string list of the identifiers.

Definition at line 184 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuParser::finished(), vuParser::readToken(), STRING, and StringList.

Referenced by ParseAPIs(), ParseButton(), ParseCheckBox(), ParseListBox(), ParseRadioBox(), and ParseSlider().

Here is the call graph for this function:

vuString vuGuiParser::ParseListBox const char *  Name  )  [private]
 

Parses a listbox declaration.

The method parses a listbox define statement. It adds the name of the control to the control list, and generates the statements to initialize the control. The initialization statements are returned in a string.

Returns:
The c++ statements needed to create and initialize the control.

Definition at line 342 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuDVector< T >::getLength(), vuDVector< T >::isMember(), m_Controls, ParseList(), ParseMethod(), and StringList.

Referenced by ParseControls().

Here is the call graph for this function:

void vuGuiParser::ParseMethod const char *  Header  )  [private]
 

Parses a block of code from the file and writes it as a method to the output file.

Definition at line 213 of file vuGuiParser.cpp.

References vuParser::finished(), m_fHeader, m_fImpl, m_Name, ParseStatement(), and vuParser::readToken().

Referenced by ParseButton(), ParseCheckBox(), ParseListBox(), ParseRadioBox(), ParseSections(), and ParseSlider().

Here is the call graph for this function:

vuString vuGuiParser::ParseRadioBox const char *  Name  )  [private]
 

Parse a radiobox declaration.

The method parses a radiobox define statement. It adds the name of the control to the control list, and generates the statements to initialize the control. The initialization statements are returned in a string.

Returns:
The c++ statements needed to create and initialize the control.

Definition at line 410 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuDVector< T >::getLength(), vuDVector< T >::isMember(), m_Controls, ParseList(), ParseMethod(), and StringList.

Referenced by ParseControls().

Here is the call graph for this function:

void vuGuiParser::ParseSections  )  [private]
 

Parses the different sections of a gui declaration.

Definition at line 115 of file vuGuiParser.cpp.

References vuParser::finished(), ParseControls(), ParseMethod(), vuParser::readToken(), and SECTION_OPEN.

Referenced by ParseGui().

Here is the call graph for this function:

vuString vuGuiParser::ParseSlider const char *  Name  )  [private]
 

Parses a slider declaration.

The method parses a slider define statement. It adds the name of the control to the control list, and generates the statements to initialize the control. The initialization statements are returned in a string.

Returns:
The c++ statements needed to create and initialize the control.

Definition at line 377 of file vuGuiParser.cpp.

References vuDVector< T >::add(), vuDVector< T >::getLength(), vuDVector< T >::isMember(), m_Controls, ParseList(), ParseMethod(), and StringList.

Referenced by ParseControls().

Here is the call graph for this function:

vuString vuGuiParser::ParseStatement  )  [private]
 

Parses a statement from the file and translates it into a method call.

Returns:
The c++ statement corresponding to the text scrip statement

Definition at line 232 of file vuGuiParser.cpp.

References vuParser::finished(), vuDVector< T >::isMember(), m_Controls, vuParser::readToken(), and STRING.

Referenced by ParseMethod().

Here is the call graph for this function:

void vuGuiParser::WriteData  )  [private]
 

Writes the accumulated control data to the files.

This method writes out the statements common to all controls. It declares the controls in the header file, defines enum identifiers for their respective events, and registers the events.

Definition at line 284 of file vuGuiParser.cpp.

References vuString::c_str(), vuDVector< T >::getLength(), m_Base, m_Controls, m_fHeader, m_fImpl, and m_Name.

Referenced by ParseGui().

Here is the call graph for this function:


Member Data Documentation

StringList vuGuiParser::m_Apis [private]
 

The header files to be included for the gui class.

Definition at line 118 of file vuGuiParser.h.

vuString vuGuiParser::m_Base [private]
 

The utility base class that the gui is derived from.

Definition at line 116 of file vuGuiParser.h.

Referenced by ParseGui(), and WriteData().

StringList vuGuiParser::m_Controls [private]
 

The names of the defined controls.

Definition at line 120 of file vuGuiParser.h.

Referenced by ParseButton(), ParseCheckBox(), ParseListBox(), ParseRadioBox(), ParseSlider(), ParseStatement(), and WriteData().

ofstream vuGuiParser::m_fHeader [private]
 

The output header file for the generated gui class.

Definition at line 109 of file vuGuiParser.h.

Referenced by ParseControls(), ParseGui(), ParseMethod(), and WriteData().

ofstream vuGuiParser::m_fImpl [private]
 

The output implemenation file for the generated gui class.

Definition at line 111 of file vuGuiParser.h.

Referenced by ParseAPIs(), ParseControls(), ParseGui(), ParseMethod(), and WriteData().

vuString vuGuiParser::m_Name [private]
 

The name of the gui that is being read.

Definition at line 114 of file vuGuiParser.h.

Referenced by ParseAPIs(), ParseControls(), ParseGui(), ParseMethod(), and WriteData().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:16 2004 for vuVolume by  doxygen 1.3.9.1