QElectroTech  0.70
Public Member Functions | Private Attributes | List of all members
ElementCollectionHandler Class Reference

The ElementCollectionHandler class Provide several method to copy element or directory from a collection to another collection. More...

#include <elementcollectionhandler.h>

Public Member Functions

 ElementCollectionHandler ()
 ElementCollectionHandler::ElementCollectionHandler. More...
 
 ~ElementCollectionHandler ()
 
ElementsLocation copy (ElementsLocation &source, ElementsLocation &destination)
 ElementCollectionHandler::copy Copy the content of collection represented by source to the collection represented by destination. Destination must be a directory, else the copy do nothing and return a null ElementLocation if destination have an item with the same name of source, a dialog ask to user what to do. More...
 
as child of @parent.

ElementCollectionHandler::createDir Create a directorie with name Parent must be a directory

Parameters
parent: parent of the dir to create
name: name of directorie to create
name_list: translations of the directorie name
Returns
: ElementsLocation that represent the new directorie, location can be null if an error was occurred
ElementsLocation createDir (ElementsLocation &parent, const QString &name, const NamesList &name_list)
 
bool importFromProject (QETProject *project, ElementsLocation &location)
 ElementCollectionHandler::importFromProject Import the element represented by to the embedded collection of at the same path. must represente an element owned by a project embedded collection. More...
 
bool setNames (ElementsLocation &location, const NamesList &name_list)
 ElementCollectionHandler::setNames Set the names stored in as the names of the item represented by location. More...
 

Private Attributes

ECHStrategym_strategy = nullptr
 

Detailed Description

The ElementCollectionHandler class Provide several method to copy element or directory from a collection to another collection.

Definition at line 87 of file elementcollectionhandler.h.

Constructor & Destructor Documentation

◆ ElementCollectionHandler()

ElementCollectionHandler::ElementCollectionHandler ( )

◆ ~ElementCollectionHandler()

ElementCollectionHandler::~ElementCollectionHandler ( )

Definition at line 306 of file elementcollectionhandler.cpp.

References m_strategy.

Member Function Documentation

◆ copy()

ElementsLocation ElementCollectionHandler::copy ( ElementsLocation source,
ElementsLocation destination 
)

ElementCollectionHandler::copy Copy the content of collection represented by source to the collection represented by destination. Destination must be a directory, else the copy do nothing and return a null ElementLocation if destination have an item with the same name of source, a dialog ask to user what to do.

Parameters
source
destination
Returns

Definition at line 320 of file elementcollectionhandler.cpp.

References ECHStrategy::copy(), ElementsLocation::exist(), ElementsLocation::isElement(), ElementsLocation::isFileSystem(), ElementsLocation::isProject(), and m_strategy.

Referenced by ElementsCollectionModel::dropMimeData().

◆ createDir()

ElementsLocation ElementCollectionHandler::createDir ( ElementsLocation parent,
const QString &  name,
const NamesList name_list 
)

◆ importFromProject()

bool ElementCollectionHandler::importFromProject ( QETProject project,
ElementsLocation location 
)

ElementCollectionHandler::importFromProject Import the element represented by to the embedded collection of at the same path. must represente an element owned by a project embedded collection.

Parameters
project: project where copy the element
location: location to copy
Returns
true if import with success

Definition at line 403 of file elementcollectionhandler.cpp.

References ElementsLocation::addToPath(), ElementsLocation::collectionPath(), XmlElementCollection::copy(), QETProject::embeddedElementCollection(), ElementsLocation::exist(), ElementsLocation::fileName(), ElementsLocation::isElement(), ElementsLocation::isProject(), and ElementsLocation::parent().

Referenced by Diagram::fromXml().

◆ setNames()

bool ElementCollectionHandler::setNames ( ElementsLocation location,
const NamesList name_list 
)

ElementCollectionHandler::setNames Set the names stored in as the names of the item represented by location.

Parameters
location: location to change the names
name_list: NamesList to use
Returns
return true if success

Definition at line 445 of file elementcollectionhandler.cpp.

References ElementsLocation::exist(), ElementsLocation::fileSystemPath(), ElementsLocation::isDirectory(), ElementsLocation::isElement(), ElementsLocation::isFileSystem(), ElementsLocation::isProject(), ElementsLocation::isWritable(), NamesList::toXml(), QET::writeXmlFile(), and ElementsLocation::xml().

Referenced by ElementsCategoryEditor::acceptUpdate().

Member Data Documentation

◆ m_strategy

ECHStrategy* ElementCollectionHandler::m_strategy = nullptr
private

Definition at line 99 of file elementcollectionhandler.h.

Referenced by copy(), and ~ElementCollectionHandler().


The documentation for this class was generated from the following files: