QElectroTech  0.8-dev
elementcollectionhandler.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 
32 {
33  public:
35  ElementsLocation &destination);
36  virtual ~ECHStrategy();
37  virtual ElementsLocation copy() =0;
38 
40 };
41 
48 {
49  public:
51  ElementsLocation &destination);
52  ElementsLocation copy() override;
53 
54  private:
56  ElementsLocation &source,
57  ElementsLocation &destination,
58  const QString& rename = QString());
60  ElementsLocation &source,
61  ElementsLocation &destination,
62  const QString& rename = QString());
63 };
64 
70 class ECHSXmlToFile : public ECHStrategy
71 {
72  public:
74  ElementsLocation &destination);
75  ElementsLocation copy() override;
76 
77  private:
79  ElementsLocation &source,
80  ElementsLocation &destination,
81  const QString& rename = QString());
83  ElementsLocation &source,
84  ElementsLocation &destination,
85  const QString& rename = QString());
86 };
87 
95 class ECHSToXml : public ECHStrategy
96 {
97  public:
98  ECHSToXml (ElementsLocation &source,
99  ElementsLocation &destination);
100  ElementsLocation copy() override;
101 };
102 
109 {
110  public:
113 
115  ElementsLocation &destination);
117  const QString &name,
118  const NamesList &name_list);
119  bool importFromProject (QETProject *project,
120  ElementsLocation &location);
121  bool setNames(ElementsLocation &location,
122  const NamesList &name_list);
123 
124  private:
126 };
127 
128 #endif // ELEMENTCOLLECTIONHANDLER_H
ElementsLocation::exist
bool exist() const
ElementsLocation::exist.
Definition: elementslocation.cpp:472
ElementCollectionHandler::~ElementCollectionHandler
~ElementCollectionHandler()
Definition: elementcollectionhandler.cpp:307
XmlElementCollection::createDir
bool createDir(const QString &path, const QString &name, const NamesList &name_list)
XmlElementCollection::createDir Create a child directorie at path path with the name name....
Definition: xmlelementcollection.cpp:587
ECHSXmlToFile::copy
ElementsLocation copy() override
Definition: elementcollectionhandler.cpp:167
RenameDialog
Definition: renamedialog.h:29
ECHSXmlToFile::ECHSXmlToFile
ECHSXmlToFile(ElementsLocation &source, ElementsLocation &destination)
Definition: elementcollectionhandler.cpp:163
ECHStrategy
The ECHStrategy class Abstract class for manage copy of directory or element from a collection to ano...
Definition: elementcollectionhandler.h:32
QETProject::embeddedElementCollection
XmlElementCollection * embeddedElementCollection() const
QETProject::embeddedCollection.
Definition: qetproject.cpp:236
ECHStrategy::m_destination
ElementsLocation m_destination
Definition: elementcollectionhandler.h:39
nameslist.h
ElementCollectionHandler::copy
ElementsLocation copy(ElementsLocation &source, ElementsLocation &destination)
ElementCollectionHandler::copy Copy the content of collection represented by source to the collection...
Definition: elementcollectionhandler.cpp:321
ElementsLocation::fileName
QString fileName() const
ElementLocation::fileName.
Definition: elementslocation.cpp:793
ECHSXmlToFile::copyElement
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
Definition: elementcollectionhandler.cpp:252
ECHStrategy::ECHStrategy
ECHStrategy(ElementsLocation &source, ElementsLocation &destination)
Definition: elementcollectionhandler.cpp:28
XmlElementCollection::copy
ElementsLocation copy(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString(), bool deep_copy=true)
XmlElementCollection::copy Copy the content represented by source (an element or a directory) to dest...
Definition: xmlelementcollection.cpp:545
XmlElementCollection::directoriesNames
QStringList directoriesNames(const QDomElement &parent_element) const
XmlElementCollection::directoriesNames.
Definition: xmlelementcollection.cpp:226
ElementsLocation::isWritable
bool isWritable() const
ElementsLocation::isWritable.
Definition: elementslocation.cpp:499
ECHSXmlToFile::copyDirectory
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
Definition: elementcollectionhandler.cpp:205
ElementCollectionHandler::m_strategy
ECHStrategy * m_strategy
Definition: elementcollectionhandler.h:125
XmlElementCollection
The XmlElementCollection class This class represent a collection of elements stored to xml.
Definition: xmlelementcollection.h:34
xmlelementcollection.h
ElementsLocation::isFileSystem
bool isFileSystem() const
ElementsLocation::isFileSystem.
Definition: elementslocation.cpp:428
ECHSFileToFile::copy
ElementsLocation copy() override
Definition: elementcollectionhandler.cpp:42
ElementCollectionHandler::importFromProject
bool importFromProject(QETProject *project, ElementsLocation &location)
ElementCollectionHandler::importFromProject Import the element represented by location to the embedde...
Definition: elementcollectionhandler.cpp:405
ElementsLocation::isElement
bool isElement() const
ElementsLocation::isElement.
Definition: elementslocation.cpp:412
XmlElementCollection::elementsNames
QStringList elementsNames(const QDomElement &parent_element) const
XmlElementCollection::elementsNames.
Definition: xmlelementcollection.cpp:269
ElementCollectionHandler
The ElementCollectionHandler class Provide several method to copy element or directory from a collect...
Definition: elementcollectionhandler.h:109
ECHSFileToFile::copyDirectory
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
Definition: elementcollectionhandler.cpp:80
ElementsLocation::parent
ElementsLocation parent() const
ElementsLocation::parent.
Definition: elementslocation.cpp:346
elementcollectionhandler.h
ECHStrategy::~ECHStrategy
virtual ~ECHStrategy()
Definition: elementcollectionhandler.cpp:34
ECHSToXml::ECHSToXml
ECHSToXml(ElementsLocation &source, ElementsLocation &destination)
Definition: elementcollectionhandler.cpp:272
ElementsLocation::xml
QDomElement xml() const
ElementsLocation::xml.
Definition: elementslocation.cpp:575
QET::Rename
@ Rename
the target has to be renamed
Definition: qet.h:133
ECHStrategy::m_source
ElementsLocation m_source
Definition: elementcollectionhandler.h:39
ElementsLocation::addToPath
bool addToPath(const QString &)
ElementsLocation::addToPath Add a string to the actual path of this location.
Definition: elementslocation.cpp:320
elementslocation.h
ElementsLocation::isDirectory
bool isDirectory() const
ElementsLocation::isDirectory.
Definition: elementslocation.cpp:420
ElementsLocation::projectCollectionPath
QString projectCollectionPath() const
ElementsLocation::projectCollectionPath.
Definition: elementslocation.cpp:176
ECHSFileToFile::copyElement
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString &rename=QString())
Definition: elementcollectionhandler.cpp:134
ElementCollectionHandler::createDir
ElementsLocation createDir(ElementsLocation &parent, const QString &name, const NamesList &name_list)
ElementCollectionHandler::createDir Create a directorie with name as child of parent....
Definition: elementcollectionhandler.cpp:344
ElementsLocation::fileSystemPath
QString fileSystemPath() const
ElementsLocation::fileSystemPath.
Definition: elementslocation.cpp:193
QET::writeXmlFile
bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message=nullptr)
Definition: qet.cpp:584
RenameDialog::newName
QString newName() const
Definition: renamedialog.h:36
ElementsLocation::isProject
bool isProject() const
ElementsLocation::isProject.
Definition: elementslocation.cpp:459
ElementCollectionHandler::setNames
bool setNames(ElementsLocation &location, const NamesList &name_list)
ElementCollectionHandler::setNames Set the names stored in name_list as the names of the item represe...
Definition: elementcollectionhandler.cpp:454
XmlElementCollection::directory
QDomElement directory(const QString &path) const
XmlElementCollection::directory.
Definition: xmlelementcollection.cpp:309
qetproject.h
ElementsLocation::collectionPath
QString collectionPath(bool protocol=true) const
ElementsLocation::collectionPath Return the path of the represented element relative to collection if...
Definition: elementslocation.cpp:160
ElementsLocation::nameList
NamesList nameList()
ElementsLocation::nameList.
Definition: elementslocation.cpp:532
ElementsLocation
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition: elementslocation.h:46
renamedialog.h
QETProject
Definition: qetproject.h:51
ECHSToXml::copy
ElementsLocation copy() override
Definition: elementcollectionhandler.cpp:276
ECHStrategy::copy
virtual ElementsLocation copy()=0
NamesList
Definition: nameslist.h:30
ECHSFileToFile
The ECHSFileToFile class Manage the copy of directory or element from a file system collection to ano...
Definition: elementcollectionhandler.h:48
ElementsLocation::projectCollection
XmlElementCollection * projectCollection() const
ElementsLocation::projectCollection.
Definition: elementslocation.cpp:519
QET::Erase
@ Erase
Erase the target content.
Definition: qet.h:130
qetxml.h
ElementCollectionHandler::ElementCollectionHandler
ElementCollectionHandler()
ElementCollectionHandler::ElementCollectionHandler.
Definition: elementcollectionhandler.cpp:305
RenameDialog::selectedAction
QET::Action selectedAction() const
Definition: renamedialog.h:37
ECHSToXml
The ECHSToXml class Manage the copy of a directory or element from a collection (no matter if the sou...
Definition: elementcollectionhandler.h:96
NamesList::toXml
QDomElement toXml(QDomDocument &, const QHash< QString, QString > &=QHash< QString, QString >()) const
Definition: nameslist.cpp:169
ECHSXmlToFile
The ECHSXmlToFile class Manage the copy of a directory or element from an xml collection to a file.
Definition: elementcollectionhandler.h:71
ECHSFileToFile::ECHSFileToFile
ECHSFileToFile(ElementsLocation &source, ElementsLocation &destination)
Definition: elementcollectionhandler.cpp:38