TutorialFile.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(__INCLUDE_TutorialFileh_INCLUDE__)
00022 #define __INCLUDE_TutorialFileh_INCLUDE__
00023 
00024 #include <XML/XMLFile.h>
00025 #include <map>
00026 
00027 class TutorialFile;
00028 class TutorialFileEntry;
00029 class TutorialCondition
00030 {
00031 public:
00032         virtual TutorialFileEntry *checkCondition() = 0;
00033         virtual bool parseXML(TutorialFile *file, XMLNode *node) = 0;
00034 
00035         static TutorialCondition *create(const char *type);
00036 };
00037 
00038 class TutorialConditionFirstMove : public TutorialCondition
00039 {
00040 public:
00041         virtual TutorialFileEntry *checkCondition();
00042         virtual bool parseXML(TutorialFile *file, XMLNode *node);
00043 
00044 protected:
00045         TutorialFileEntry *next_;
00046 };
00047 
00048 class TutorialConditionTankDead : public TutorialCondition
00049 {
00050 public:
00051         virtual TutorialFileEntry *checkCondition();
00052         virtual bool parseXML(TutorialFile *file, XMLNode *node);
00053 
00054 protected:
00055         TutorialFileEntry *next_;
00056 };
00057 
00058 class TutorialConditionWindowVisible : public TutorialCondition
00059 {
00060 public:
00061         virtual TutorialFileEntry *checkCondition();
00062         virtual bool parseXML(TutorialFile *file, XMLNode *node);
00063 
00064 protected:
00065         std::string window_;
00066         TutorialFileEntry *next_;
00067 };
00068 
00069 class TutorialFileEntry
00070 {
00071 public:
00072         std::list<TutorialCondition *> conditions_;
00073         std::string name_;
00074         XMLNode *text_;
00075 
00076         TutorialFileEntry *checkConditions();
00077 };
00078 
00079 class TutorialFile
00080 {
00081 public:
00082         TutorialFile();
00083         virtual ~TutorialFile();
00084 
00085         bool parseFile(const std::string &file);
00086 
00087         TutorialFileEntry *getStartEntry() { return start_; }
00088         TutorialFileEntry *getEntry(const char *name); 
00089 
00090 protected:
00091         XMLFile file_;
00092         std::map<std::string, TutorialFileEntry *> entries_;
00093         TutorialFileEntry *start_;
00094 };
00095 
00096 #endif // __INCLUDE_TutorialFileh_INCLUDE__

Generated on Mon Feb 16 15:14:46 2009 for Scorched3D by  doxygen 1.5.3