QElectroTech  0.70
elementcollectionhandler.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef ELEMENTCOLLECTIONHANDLER_H
19 #define ELEMENTCOLLECTIONHANDLER_H
20 
21 #include "elementslocation.h"
22 #include "nameslist.h"
23 
24 class QWidget;
25 
31 {
32  public:
33  ECHStrategy(ElementsLocation &source, ElementsLocation &destination);
34  virtual ~ECHStrategy();
35  virtual ElementsLocation copy() =0;
36 
38 };
39 
45 {
46  public:
47  ECHSFileToFile (ElementsLocation &source, ElementsLocation &destination);
48  ElementsLocation copy() override;
49 
50  private:
51  ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
52  ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
53 };
54 
59 class ECHSXmlToFile : public ECHStrategy
60 {
61  public:
62  ECHSXmlToFile (ElementsLocation &source, ElementsLocation &destination);
63  ElementsLocation copy() override;
64 
65  private:
66  ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
67  ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
68 };
69 
75 class ECHSToXml : public ECHStrategy
76 {
77  public:
78  ECHSToXml (ElementsLocation &source, ElementsLocation &destination);
79  ElementsLocation copy() override;
80 };
81 
88 {
89  public:
92 
94  ElementsLocation createDir(ElementsLocation &parent, const QString &name, const NamesList &name_list);
95  bool importFromProject (QETProject *project, ElementsLocation &location);
96  bool setNames(ElementsLocation &location, const NamesList &name_list);
97 
98  private:
99  ECHStrategy *m_strategy = nullptr;
100 };
101 
102 #endif // ELEMENTCOLLECTIONHANDLER_H
bool importFromProject(QETProject *project, ElementsLocation &location)
ElementCollectionHandler::importFromProject Import the element represented by to the embedded collec...
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
The ECHSFileToFile class Manage the copy of directory or element from a file system collection to ano...
ElementsLocation copy(ElementsLocation &source, ElementsLocation &destination)
ElementCollectionHandler::copy Copy the content of collection represented by source to the collection...
ECHStrategy(ElementsLocation &source, ElementsLocation &destination)
ECHSToXml(ElementsLocation &source, ElementsLocation &destination)
ElementsLocation copy() override
ElementsLocation m_destination
The ECHStrategy class Abstract class for manage copy of directory or element from a collection to ano...
ECHSXmlToFile(ElementsLocation &source, ElementsLocation &destination)
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
The ECHSXmlToFile class Manage the copy of a directory or element from an xml collection to a file...
ElementsLocation createDir(ElementsLocation &parent, const QString &name, const NamesList &name_list)
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
ElementsLocation copy() override
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
ElementsLocation copy() override
ElementCollectionHandler()
ElementCollectionHandler::ElementCollectionHandler.
bool setNames(ElementsLocation &location, const NamesList &name_list)
ElementCollectionHandler::setNames Set the names stored in as the names of the item represented by l...
The ECHSToXml class Manage the copy of a directory or element from a collection (no matter if the sou...
virtual ElementsLocation copy()=0
ECHSFileToFile(ElementsLocation &source, ElementsLocation &destination)
ElementsLocation m_source
The ElementCollectionHandler class Provide several method to copy element or directory from a collect...