2014-11-21 14:43:27 +00:00
|
|
|
#ifndef CONVERTER_INCLUDED
|
|
|
|
#define CONVERTER_INCLUDED
|
2014-11-25 12:51:25 +00:00
|
|
|
|
2014-11-21 14:43:27 +00:00
|
|
|
#include <vector>
|
2014-11-25 12:51:25 +00:00
|
|
|
#include <string>
|
2014-11-24 12:03:55 +00:00
|
|
|
#include "tinyxml2.hh"
|
2014-11-21 14:43:27 +00:00
|
|
|
|
2014-11-25 12:51:25 +00:00
|
|
|
using namespace tinyxml2;
|
2014-11-21 14:43:27 +00:00
|
|
|
class Converter {
|
|
|
|
public:
|
2015-03-14 13:54:43 +00:00
|
|
|
Converter(std::string levelPath, std::string levelName, std::string compositionsPath);
|
2014-11-21 14:43:27 +00:00
|
|
|
Converter();
|
|
|
|
~Converter();
|
2014-12-08 12:33:38 +00:00
|
|
|
void updateComposition(int idG, int idB, float posX, float posZ); //updates the position of a composition
|
2015-02-20 12:11:05 +00:00
|
|
|
std::vector<int> newComposition(int type, float posX, float posZ); //creates a new composition and returns its ID
|
2015-02-13 12:46:41 +00:00
|
|
|
void deleteComposition(int idG, int idB);
|
2015-02-20 12:11:05 +00:00
|
|
|
void save(); //writes the xml to file
|
2014-11-21 14:43:27 +00:00
|
|
|
private:
|
2014-12-12 11:31:24 +00:00
|
|
|
std::vector<int> nextID;
|
2015-01-23 15:02:50 +00:00
|
|
|
bool idUsed[256][256];
|
2014-11-25 12:51:25 +00:00
|
|
|
std::string xmlFile;
|
|
|
|
XMLDocument* doc = new XMLDocument();
|
2014-11-28 16:05:49 +00:00
|
|
|
XMLDocument* compositions = new XMLDocument();
|
2015-02-20 14:06:43 +00:00
|
|
|
float queryFloat(XMLElement* element, const char* attribute);
|
|
|
|
float queryFloat(XMLDocument*& element, const char* attribute);
|
2015-02-20 12:11:05 +00:00
|
|
|
int queryInt(XMLElement* element, const char* attribute);
|
|
|
|
int queryInt(XMLDocument*& element, const char* attribute);
|
|
|
|
bool queryBool(XMLElement* element, const char* attribute);
|
|
|
|
bool queryBool(XMLDocument*& element, const char* attribute);
|
|
|
|
void errorCheck(XMLError error);
|
2014-11-21 14:43:27 +00:00
|
|
|
};
|
2014-11-25 12:51:25 +00:00
|
|
|
|
2014-11-21 14:43:27 +00:00
|
|
|
#endif
|