From 7075de4b71a96afb7ca7c6cc115a4ec542ac53a9 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Sat, 10 Dec 2016 17:18:31 -0200 Subject: Basic save methods implemented --- Project/FileHanding.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Project/FileHanding.h (limited to 'Project/FileHanding.h') diff --git a/Project/FileHanding.h b/Project/FileHanding.h new file mode 100644 index 0000000..4aa7f37 --- /dev/null +++ b/Project/FileHanding.h @@ -0,0 +1,41 @@ +#ifndef FILEHANDING_H +#define FILEHANDING_H + +#include +#include +#include + +#include "Workspace.h" +#include "ElectricCalculation.h" +#include "Text.h" + +#include "rapidXML/rapidxml.hpp" +// Modified: http://stackoverflow.com/questions/14113923/rapidxml-print-header-has-undefined-methods +#include "rapidXML/rapidxml_print.hpp" +#include "rapidXML/rapidxml_utils.hpp" + +class FileHanding +{ +public: + FileHanding(); + FileHanding(Workspace* workspace); + ~FileHanding(); + + void SetWorkspace(Workspace* workspace) { m_workspace = workspace; } + + void SaveProject(wxFileName path); + void OpenProject(wxFileName path); + +protected: + Workspace* m_workspace; + + rapidxml::xml_node<>* AppendNode(rapidxml::xml_document<>& doc, + rapidxml::xml_node<>* parentNode, + const char* name, + rapidxml::node_type nodeType = rapidxml::node_element); + void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, wxString value); + void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, int value); + void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, double value); +}; + +#endif // FILEHANDING_H -- cgit