Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

GLProject Class Reference

Encapsulates a Glitch project and provides file save and load facilities. More...

#include <glproject.h>

List of all members.

Public Types

enum  OpenResult {
  Success, DiskReadError, UnknownDocType, UnknownDocVersion,
  DocParseError
}

Public Member Functions

 GLProject (const QString &title=QString::null, const QString &filename=QString::null)
QString title () const
QString descText () const
QString docText () const
QString filename () const
QPtrList< CmdInstance > * initCmds ()
QPtrList< CmdInstance > * displayCmds ()
void setTitle (const QString &title)
void setDescText (const QString &descText)
void setDocText (const QString &docText)
void setFilename (const QString &filename)
void setInitCmds (QPtrList< CmdInstance > &cmds)
void setDisplayCmds (QPtrList< CmdInstance > &cmds)
bool saveFile ()
OpenResult openFile (const QString &filename, QPtrList< CmdTreeNode > *tree)
QString toString ()

Static Public Member Functions

QString fileExtension ()

Private Member Functions

void insertCmds (QDomDocument &doc, QDomElement &root, QPtrList< CmdInstance > &cmds)
QString getElementText (QDomElement e) const
bool parseCmds (QDomElement &root, QPtrList< CmdInstance > &cmds, QPtrList< CmdTreeNode > *tree)

Private Attributes

QString myTitle
QString myDescText
QString myDocText
QString myFilename
QPtrList< CmdInstancemyInitCmds
QPtrList< CmdInstancemyDisplayCmds


Detailed Description

Encapsulates a Glitch project and provides file save and load facilities.

A project consists primarily of a list of initialization command instances and display command instances, both along with their own encapsulated data, including parameter values and their variable instances (again, obviously with their data).

A project also contains fields such as a title, a description and documentation.

A project instance can easily be saved to disk via the GLProject::saveFile() method (using the current filename). It can then be reloaded using the GLProject::openFile() method.


Member Enumeration Documentation

enum GLProject::OpenResult
 

Enumeration values:
Success 
DiskReadError 
UnknownDocType 
UnknownDocVersion 
DocParseError 


Constructor & Destructor Documentation

GLProject::GLProject const QString &  title = QString::null,
const QString &  filename = QString::null
 

Glitch Project Constructor.

Note: Auto-delete is enabled here for both myInitCmds and myDisplayCmds, so that when an pointer entry is removed from either list, the object that it is pointing to is also deleted.


Member Function Documentation

QString GLProject::descText  )  const [inline]
 

QPtrList<CmdInstance>* GLProject::displayCmds  )  [inline]
 

QString GLProject::docText  )  const [inline]
 

QString GLProject::fileExtension  )  [inline, static]
 

QString GLProject::filename  )  const [inline]
 

QString GLProject::getElementText QDomElement  e  )  const [private]
 

Concatenate the strings from all of the level-0 DOM text nodes of a DOM element. (there should only be one text element though)

QPtrList<CmdInstance>* GLProject::initCmds  )  [inline]
 

void GLProject::insertCmds QDomDocument &  doc,
QDomElement &  root,
QPtrList< CmdInstance > &  cmds
[private]
 

Used to insert a list of commands into a XML DOM document.

GLProject::OpenResult GLProject::openFile const QString &  filename,
QPtrList< CmdTreeNode > *  tree
 

Read a project from disk, with an XML representation.

It requires the command tree to lookup the commands from and check for validity.

On success, the project instance will contain the file's data and the project's filename will also be set the one specified to the method.

bool GLProject::parseCmds QDomElement &  root,
QPtrList< CmdInstance > &  cmds,
QPtrList< CmdTreeNode > *  tree
[private]
 

Parse the commands from an XML DOM document into a list of command instances.

bool GLProject::saveFile  ) 
 

Store a project to disk, with an XML representation.

Note: This method WILL overwrite any existing file. Please ensure that the user is happy with overwriting a file BEFORE calling this method.

void GLProject::setDescText const QString &  descText  )  [inline]
 

void GLProject::setDisplayCmds QPtrList< CmdInstance > &  cmds  )  [inline]
 

void GLProject::setDocText const QString &  docText  )  [inline]
 

void GLProject::setFilename const QString &  filename  )  [inline]
 

void GLProject::setInitCmds QPtrList< CmdInstance > &  cmds  )  [inline]
 

void GLProject::setTitle const QString &  title  )  [inline]
 

QString GLProject::title  )  const [inline]
 

QString GLProject::toString  ) 
 

Get the XML representation of the project.

This is used by the GLProject::saveFile() method.


Member Data Documentation

QString GLProject::myDescText [private]
 

QPtrList<CmdInstance> GLProject::myDisplayCmds [private]
 

QString GLProject::myDocText [private]
 

QString GLProject::myFilename [private]
 

QPtrList<CmdInstance> GLProject::myInitCmds [private]
 

QString GLProject::myTitle [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Feb 27 12:01:40 2004 for Glitch by doxygen 1.3.2