UiXmlReader added (WIP)

This commit is contained in:
MihailRis
2024-02-04 05:00:29 +03:00
parent e9efdb0e7b
commit 86412a28ec
6 changed files with 269 additions and 13 deletions
+31
View File
@@ -0,0 +1,31 @@
#ifndef FRONTEND_GUI_GUI_XML_H_
#define FRONTEND_GUI_GUI_XML_H_
#include <memory>
#include <unordered_map>
#include "GUI.h"
#include "../../coders/xml.h"
namespace gui {
class UiXmlReader;
using uinode_reader = std::function<std::shared_ptr<UINode>(UiXmlReader&, xml::xmlelement)>;
class UiXmlReader {
std::unordered_map<std::string, uinode_reader> readers;
public:
UiXmlReader();
void add(const std::string& tag, uinode_reader reader);
std::shared_ptr<UINode> readUINode(xml::xmlelement element);
std::shared_ptr<UINode> readXML(
const std::string& filename,
const std::string& source
);
};
}
#endif // FRONTEND_GUI_GUI_XML_H_