xml_formation.hh

00001 /*
00002 ** TowBowlTactics, a turn-based strategy football game.
00003 **
00004 ** Copyright (C) 2006-2010 The TBT Team.
00005 **
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 **
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 **
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef XML_FORMATION_HH_
00018 # define XML_FORMATION_HH_
00019 
00020 # include <xercesc/sax/EntityResolver.hpp>
00021 # include "xml/xml.hh"
00022 
00023 BEGIN_NS(xml);
00024 
00032 class XMLFormation : public XML
00033 {
00034 public:
00035   XMLFormation(const std::string& schema_path);
00036 
00038   bool switchFormationId(int formation_id);
00039 
00042   bool hasCoord(int player_id);
00046   Coordinates getCoord(int player_id);
00047 
00048   virtual void parse(const std::string& filename);
00049 
00050 protected:
00051   virtual const char* getExpectedRoot() const;
00052   virtual void initXMLInternal();
00053 
00054   int formation_id_;
00055   std::string schema_path_;
00056 };
00057 
00058 
00059 class XMLFormationEntityResolver : public xercesc::EntityResolver
00060 {
00061 public:
00062   XMLFormationEntityResolver(const std::string& schema_path);
00063   xercesc::InputSource* resolveEntity(const XMLCh* const, const XMLCh* const);
00064 
00065 private:
00066   std::string schema_path_;
00067 }; 
00068 
00069 
00070 
00071 END_NS(xml);
00072 
00073 #endif /* !XML_FORMATION_HH_ */
Generated on Mon Apr 5 21:17:14 2010 for Stechec/TBT by  doxygen 1.6.3