Browse Source

xml helper files

Nicolas Winkler 4 years ago
parent
commit
82d6e4d252

+ 26 - 0
libalmond/include/ExportRecipe.h

@@ -0,0 +1,26 @@
+#pragma once
+#ifndef LIBALMOND_EXPORT_RECIPE_H
+#define LIBALMOND_EXPORT_RECIPE_H
+
+#include <MandelUtil.h>
+#include "Gradient.h"
+
+#include <string>
+
+namespace alm
+{
+    struct ImageExportRecipe;
+}
+
+
+struct alm::ImageExportRecipe
+{
+    mnd::MandelInfo view;
+    Gradient gradient;
+
+    std::string toXml(void) const;
+    static ImageExportRecipe fromXml(const std::string& xml);
+};
+
+#endif // LIBALMOND_EXPORT_RECIPE_H
+

+ 20 - 0
libalmond/include/XmlException.h

@@ -0,0 +1,20 @@
+#pragma once
+#ifndef LIBALMOND_XMLEXCEPTION_H
+#define LIBALMOND_XMLEXCEPTION_H
+
+#include <stdexcept>
+#include <string>
+
+namespace alm
+{
+    struct XmlException;
+}
+
+struct alm::XmlException :
+    std::runtime_error
+{
+    XmlException(const std::string& err);
+};
+
+
+#endif // LIBALMOND_XMLEXCEPTION_H

+ 19 - 0
libalmond/src/ExportRecipe.cpp

@@ -0,0 +1,19 @@
+#include "ExportRecipe.h"
+#include "tinyxml2.h"
+
+#include "XmlException.h"
+
+using alm::ImageExportRecipe;
+using alm::XmlException;
+
+
+std::string ImageExportRecipe::toXml(void) const
+{
+}
+
+
+ImageExportRecipe ImageExportRecipe::fromXml(const std::string& xml)
+{
+    tinyxml2::XMLDocument xmlDoc;
+    xmlDoc.Parse(xml.c_str());
+}

+ 8 - 0
libalmond/src/XmlException.cpp

@@ -0,0 +1,8 @@
+#include "XmlException.h"
+
+using alm::XmlException;
+
+XmlException::XmlException(const std::string& error) :
+    std::runtime_error{ error }
+{
+}