2016-02-13 12:51:56 +00:00
|
|
|
/*
|
|
|
|
Copyright 2006-2015 The QElectroTech Team
|
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef ELEMENTCOLLECTIONHANDLER_H
|
|
|
|
#define ELEMENTCOLLECTIONHANDLER_H
|
|
|
|
|
2016-03-15 15:23:11 +00:00
|
|
|
#include "elementslocation.h"
|
2016-02-13 12:51:56 +00:00
|
|
|
|
|
|
|
class QWidget;
|
|
|
|
|
2016-03-06 14:40:52 +00:00
|
|
|
/**
|
|
|
|
* @brief The ECHStrategy class
|
|
|
|
* Abstract class for manage copy of directory or element from a collection to another
|
|
|
|
*/
|
2016-02-13 12:51:56 +00:00
|
|
|
class ECHStrategy
|
|
|
|
{
|
|
|
|
public:
|
2016-03-15 15:23:11 +00:00
|
|
|
ECHStrategy(ElementsLocation &source, ElementsLocation &destination);
|
2016-02-13 12:51:56 +00:00
|
|
|
virtual ~ECHStrategy();
|
2016-03-15 15:23:11 +00:00
|
|
|
virtual ElementsLocation copy() =0;
|
2016-02-13 12:51:56 +00:00
|
|
|
|
2016-03-15 15:23:11 +00:00
|
|
|
ElementsLocation m_source, m_destination;
|
2016-02-13 12:51:56 +00:00
|
|
|
};
|
|
|
|
|
2016-03-06 14:40:52 +00:00
|
|
|
/**
|
|
|
|
* @brief The ECHSFileToFile class
|
|
|
|
* Manage the copy of directory or element from a file system collection to another file system collection
|
|
|
|
*/
|
2016-02-13 12:51:56 +00:00
|
|
|
class ECHSFileToFile : public ECHStrategy
|
|
|
|
{
|
|
|
|
public:
|
2016-03-15 15:23:11 +00:00
|
|
|
ECHSFileToFile (ElementsLocation &source, ElementsLocation &destination);
|
|
|
|
ElementsLocation copy();
|
2016-02-13 12:51:56 +00:00
|
|
|
|
|
|
|
private:
|
2016-03-15 15:23:11 +00:00
|
|
|
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString());
|
|
|
|
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString());
|
2016-02-13 12:51:56 +00:00
|
|
|
};
|
|
|
|
|
2016-03-09 10:17:28 +00:00
|
|
|
/**
|
|
|
|
* @brief The ECHSXmlToFile class
|
|
|
|
* Manage the copy of a directory or element from an xml collection to a file.
|
|
|
|
*/
|
|
|
|
class ECHSXmlToFile : public ECHStrategy
|
|
|
|
{
|
|
|
|
public:
|
2016-03-15 15:23:11 +00:00
|
|
|
ECHSXmlToFile (ElementsLocation &source, ElementsLocation &destination);
|
|
|
|
ElementsLocation copy();
|
2016-03-09 10:17:28 +00:00
|
|
|
|
|
|
|
private:
|
2016-03-15 15:23:11 +00:00
|
|
|
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString());
|
|
|
|
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString());
|
2016-03-09 10:17:28 +00:00
|
|
|
};
|
|
|
|
|
2016-03-06 14:40:52 +00:00
|
|
|
/**
|
|
|
|
* @brief The ECHSToXml class
|
|
|
|
* Manage the copy of a directory or element from a collection (no matter if the source is a file system collection or an xml collection)
|
|
|
|
* to an xml collection
|
|
|
|
*/
|
|
|
|
class ECHSToXml : public ECHStrategy
|
2016-02-21 18:53:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-03-15 15:23:11 +00:00
|
|
|
ECHSToXml (ElementsLocation &source, ElementsLocation &destination);
|
|
|
|
ElementsLocation copy();
|
2016-02-21 18:53:40 +00:00
|
|
|
};
|
|
|
|
|
2016-02-13 12:51:56 +00:00
|
|
|
/**
|
|
|
|
* @brief The ElementCollectionHandler class
|
|
|
|
* Provide several method to copy element or directory from a collection
|
|
|
|
* to another collection.
|
|
|
|
*/
|
|
|
|
class ElementCollectionHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ElementCollectionHandler();
|
|
|
|
~ElementCollectionHandler();
|
|
|
|
|
2016-03-15 15:23:11 +00:00
|
|
|
ElementsLocation copy(ElementsLocation &source, ElementsLocation &destination);
|
2016-02-13 12:51:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ECHStrategy *m_strategy = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ELEMENTCOLLECTIONHANDLER_H
|