|
mkRPG
|
00001 #ifndef XMLWRITTER_H 00002 #define XMLWRITTER_H 00003 00004 #include "game.h" 00005 #include <QFileDevice> 00006 #include <QDir> 00007 #include <QXmlStreamReader> 00008 #include <QList> 00009 00010 00025 class XmlWritter{ 00026 enum Element{EndL, Eg, OpenMarkUp, CloseMarkUp, MarkUpParam}; 00027 enum Mode{Default, newMarkUp, MarkUpNamed, ParamName,ParamValue}; 00028 public: 00029 XmlWritter(const QDir &path, Game &game, bool serverXml = true); 00030 ~XmlWritter(); 00031 00032 const QString fileName() const; 00033 00034 00035 private: 00036 XmlWritter(const QDir &path, const QString &fileName, bool serverXml = true); 00037 XmlWritter(const QDir &path, const GameObject *obj, bool serverXml = true); 00038 XmlWritter(const QDir &path, World &world, bool serverXml = true); 00039 XmlWritter(const QDir &path, CellType &cellType, bool serverXml = true); 00040 XmlWritter(const QDir &path, MapType &mapType, bool serverXml = true); 00041 XmlWritter(const QDir &path, Map &map, bool serverXml = true); 00042 XmlWritter(const QDir &path, ObjectType &objectType, bool serverXml = true); 00043 XmlWritter(const QDir &path, Object &object, bool serverXml = true); 00044 XmlWritter(const QDir &path, EntityType &entityType, bool serverXml = true); 00045 XmlWritter(const QDir &path, Entity &entity, bool serverXml = true); 00046 XmlWritter(const QDir &path, const QList<Image *> &images, bool serverXml = true); 00047 XmlWritter &operator<<(const GameObject &obj); 00048 XmlWritter &operator<<(const QString &s); 00049 XmlWritter &operator<<(const int &i); 00050 XmlWritter &operator<<(const Element &e); 00051 XmlWritter &operator<<(const Action *a); 00052 00053 void writeCell(Cell &c, int x, int y); 00054 void writeCellType(CellType &c); 00055 void writeMapType(MapType &m); 00056 void writeObjectType(ObjectType &o); 00057 void writeEntityType(EntityType &e); 00058 void writeInheritableObject(InheritableObject &o); 00059 00060 00061 void writeObjectAttributes(const GameObject &obj); 00062 00063 00064 00065 void writeCreatedFiles(XmlWritter &wr); 00066 00067 00068 QDir path; 00069 QFile file; 00070 QTextStream stream; 00071 QStack<QString> markUps; 00072 00073 00074 QList<QPair<QString, QString>> createdFiles; 00075 bool newLine; 00076 Mode mode; 00077 00078 00079 bool serverXml; 00080 }; 00081 00082 00083 00084 00085 00086 #endif // XMLWRITTER_H
1.7.6.1