#pragma once #include "GUI.hpp" #include "coders/xml.hpp" #include #include #include #include namespace gui { class UiXmlReader; using uinode_reader = std::function< std::shared_ptr(UiXmlReader&, const xml::xmlelement&)>; class UiXmlReader { std::unordered_map readers; std::unordered_set ignored; std::stack contextStack; std::string filename; const scriptenv& env; public: UiXmlReader(const scriptenv& env); void add(const std::string& tag, uinode_reader reader); bool hasReader(const std::string& tag) const; void addIgnore(const std::string& tag); std::shared_ptr readUINode(const xml::xmlelement& element); void readUINode( const UiXmlReader& reader, const xml::xmlelement& element, UINode& node ); void readUINode( UiXmlReader& reader, const xml::xmlelement& element, Container& container ); std::shared_ptr readXML( const std::string& filename, const std::string& source ); std::shared_ptr readXML( const std::string& filename, const xml::xmlelement& root ); const std::string& getContext() const; const scriptenv& getEnvironment() const; const std::string& getFilename() const; }; }