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 From ac9b62df34695e8c7f4fbb838c6126bd98671316 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Mon, 12 Dec 2016 21:12:51 -0200 Subject: Many elements save implemented --- Project/FileHanding.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Project/FileHanding.h') diff --git a/Project/FileHanding.h b/Project/FileHanding.h index 4aa7f37..5e06c3e 100644 --- a/Project/FileHanding.h +++ b/Project/FileHanding.h @@ -36,6 +36,9 @@ protected: 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); + void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, wxString value); + void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, int value); + void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, double value); }; #endif // FILEHANDING_H -- cgit From e86a20525e9838f4b3962eb267ea51dce7e8fb77 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Tue, 13 Dec 2016 21:38:03 -0200 Subject: Bus open implemented, capacitor buggy --- Project/FileHanding.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Project/FileHanding.h') diff --git a/Project/FileHanding.h b/Project/FileHanding.h index 5e06c3e..ba95177 100644 --- a/Project/FileHanding.h +++ b/Project/FileHanding.h @@ -24,7 +24,7 @@ public: void SetWorkspace(Workspace* workspace) { m_workspace = workspace; } void SaveProject(wxFileName path); - void OpenProject(wxFileName path); + bool OpenProject(wxFileName path); protected: Workspace* m_workspace; @@ -39,6 +39,9 @@ protected: void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, wxString value); void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, int value); void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, double value); + double GetNodeValueDouble(rapidxml::xml_node<>* parent, const char* nodeName); + int GetNodeValueInt(rapidxml::xml_node<>* parent, const char* nodeName); + int GetAttributeValueInt(rapidxml::xml_node<>* parent, const char* nodeName, const char* atrName); }; #endif // FILEHANDING_H -- cgit