#pragma once #ifndef LIBALMOND_SERIALIZE_H #define LIBALMOND_SERIALIZE_H #include #include "Gradient.h" #include namespace tinyxml2 { class XMLElement; class XMLDocument; } namespace alm { struct ImageView; template tinyxml2::XMLElement* serialize(tinyxml2::XMLDocument& doc, const T&); template std::string toXml(const T&); template T deserialize(tinyxml2::XMLElement* xml); template T fromXml(const std::string& xml); // specializations template<> tinyxml2::XMLElement* serialize(tinyxml2::XMLDocument& doc, const Gradient&); template<> std::string toXml(const Gradient&); template<> Gradient deserialize(tinyxml2::XMLElement* xml); template<> Gradient fromXml(const std::string& xml); } struct alm::ImageView { mnd::MandelInfo view; Gradient gradient; std::string toXml(void) const; static ImageView fromXml(const std::string& xml); }; #endif // LIBALMOND_SERIALIZE_H