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

glproject.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  File:    glproject.h
00004  Created: by Aidan Lane, December 01, 2003
00005  Updated: by Aidan Lane, February 15, 2004
00006  
00007  This file is part of Glitch
00008  Copyright (C) 2003-2004  Monash University, Clayton Campus, Australia
00009  Created by Aidan Lane, under the supervision of Jon McCormack.
00010  
00011  This program was developed to aid the students studying the CSE3313
00012  Computer Graphics course at Monash University.
00013  
00014  This software may contain portions that are copyright (C) 1993,
00015  Silicon Graphics, Inc. All Rights Reserved.
00016  
00017  Glitch is free software; you can redistribute it and/or modify
00018  it under the terms of the GNU General Public License as published by
00019  the Free Software Foundation, version 2.
00020  
00021  Glitch is distributed in the hope that it will be useful,
00022  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  GNU General Public License for more details.
00025  
00026  You should have received a copy of the GNU General Public License
00027  along with this program; if not, write to the Free Software
00028  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00029 
00030 *****************************************************************************/
00031 
00032 #ifndef __GLPROJECT_H__
00033 #define __GLPROJECT_H__
00034 
00035 
00036 #include <qdom.h>
00037 #include <qstring.h>
00038 #include <qptrlist.h>
00039 
00040 #include "cmdtreenode.h"
00041 #include "cmdinstance.h"
00042 
00043 #define PROJECT_FILE_EXTENSION "glp" // GL Project
00044 
00045 
00059 class GLProject
00060 {
00061 public:
00062     enum OpenResult { Success, DiskReadError, UnknownDocType,
00063                       UnknownDocVersion, DocParseError };
00064 
00065     GLProject( const QString& title = QString::null,
00066         const QString& filename = QString::null );
00067 
00068     // getters
00069     QString title() const { return myTitle; }
00070     QString descText() const { return myDescText; }
00071     QString docText() const { return myDocText; }
00072     QString filename() const { return myFilename; }
00073     QPtrList<CmdInstance>* initCmds() { return &myInitCmds; }
00074     QPtrList<CmdInstance>* displayCmds() { return &myDisplayCmds; }
00075 
00076     // setters
00077     void setTitle( const QString& title ) { myTitle = title; }
00078     void setDescText( const QString& descText ) { myDescText = descText; }
00079     void setDocText( const QString& docText ) { myDocText = docText; }
00080     void setFilename( const QString& filename ) { myFilename = filename; }
00081     void setInitCmds( QPtrList<CmdInstance>& cmds ) { myInitCmds = cmds; }
00082     void setDisplayCmds( QPtrList<CmdInstance>& cmds ) { myDisplayCmds = cmds; }
00083 
00084     // file
00085     bool saveFile();
00086     OpenResult openFile( const QString& filename, QPtrList<CmdTreeNode>* tree );
00087 
00088     static QString fileExtension() { return PROJECT_FILE_EXTENSION; }
00089 
00090     // create a string representation of the project - used by saveFile
00091     // this should probably be private, but it is useful when it comes to debugging
00092     QString toString();
00093 
00094 private:
00095     void insertCmds( QDomDocument &doc, QDomElement &root, QPtrList<CmdInstance>& cmds );
00096     QString getElementText( QDomElement e ) const;
00097     bool parseCmds( QDomElement &root, QPtrList<CmdInstance>& cmds, QPtrList<CmdTreeNode>* tree );
00098 
00099     QString myTitle;
00100     QString myDescText;     // description text (e.g. breif desc., author's name, etc...)
00101     QString myDocText;      // documention text
00102     QString myFilename;
00103     QPtrList<CmdInstance> myInitCmds;
00104     QPtrList<CmdInstance> myDisplayCmds;
00105 };
00106 
00107 
00108 #endif  // __GLPROJECT_H__

Generated on Fri Feb 27 12:01:39 2004 for Glitch by doxygen 1.3.2