Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
FileHanding.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef FILEHANDING_H
19#define FILEHANDING_H
20
21#include <wx/string.h>
22#include <fstream>
23#include <sstream>
24
25#include "../editors/Workspace.h"
26#include "../editors/ControlEditor.h"
27
28#include "../elements/controlElement/ControlElementContainer.h"
29#include "../elements/Text.h"
30
31#include "../simulation/ElectricCalculation.h"
32
33#include "../utils/XMLParser.h"
34
43{
44public:
46 FileHanding(Workspace* workspace);
47 FileHanding(ControlEditor* controlEditor);
49
50 void SetWorkspace(Workspace* workspace) { m_workspace = workspace; }
51 void SetControlEditor(ControlEditor* controlEditor) { m_controlEditor = controlEditor; }
52
53 void SaveProject(wxFileName path);
54 bool OpenProject(wxFileName path);
55
56 void SaveControl(wxFileName path);
57 bool OpenControl(wxFileName path,
58 std::vector< std::shared_ptr<ControlElement> >& ctrlElementList,
59 std::vector< std::shared_ptr<ConnectionLine> >& ctrlConnectionList);
60
61 void SaveControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = nullptr);
62 bool OpenControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = nullptr);
63
64protected:
65 Workspace* m_workspace = nullptr;
66 ControlEditor* m_controlEditor = nullptr;
67};
68
69#endif // FILEHANDING_H
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
Save and opens the projects created on disk.
Definition FileHanding.h:43
This class manages the graphical and power elements. It is responsible for handling the user's intera...
Definition Workspace.h:103