QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ElementsLocation Class Reference

The ElementsLocation class This class represents the location, the location of an element or of a category, even of a collection ... in a collection. She encapsulates a virtual path. More...

#include <elementslocation.h>

Collaboration diagram for ElementsLocation:
Collaboration graph

Public Member Functions

 ElementsLocation ()
 ElementsLocation::ElementsLocation Constructor.
 
 ElementsLocation (const QString &path, QETProject *project=nullptr)
 ElementsLocation::ElementsLocation.
 
 ElementsLocation (const ElementsLocation &)
 ElementsLocation::ElementsLocation The copy constructor.
 
 ElementsLocation (const QMimeData *data)
 ElementsLocation::ElementLocation Constructor, build an ElementLocation from a QMimeData, the mime data format must be "application/x-qet-element-uri" or "application/x-qet-category-uri". This location can be null even if format is valid.
 
virtual ~ElementsLocation ()
 ElementsLocation::~ElementsLocation Destructeur.
 
ElementsLocationoperator= (const ElementsLocation &)
 ElementsLocation::operator = Assignment operator.
 
bool operator== (const ElementsLocation &) const
 ElementsLocation::operator ==.
 
bool operator!= (const ElementsLocation &) const
 ElementsLocation::operator != Operateur de comparaison.
 
QString baseName () const
 ElementsLocation::baseName.
 
QString collectionPath (bool protocol=true) const
 ElementsLocation::collectionPath Return the path of the represented element relative to collection if protocol is true the path is prepended by the collection type (common://, company://, custom:// or embed://) else if false, only the collection path is returned without the collection type.
 
QString projectCollectionPath () const
 ElementsLocation::projectCollectionPath.
 
QString fileSystemPath () const
 ElementsLocation::fileSystemPath.
 
QString path () const
 ElementsLocation::path.
 
void setPath (const QString &path)
 ElementsLocation::setPath Set the path of this item. The path can be relative to a collection (start by common://, company://, custom:// or embed://) or not.
 
bool addToPath (const QString &)
 ElementsLocation::addToPath Add a string to the actual path of this location.
 
ElementsLocation parent () const
 ElementsLocation::parent.
 
QETProjectproject () const
 ElementsLocation::project.
 
void setProject (QETProject *)
 ElementsLocation::setProject.
 
bool isNull () const
 ElementsLocation::isNull.
 
QString toString () const
 ElementsLocation::toString.
 
bool isElement () const
 ElementsLocation::isElement.
 
bool isDirectory () const
 ElementsLocation::isDirectory.
 
bool isFileSystem () const
 ElementsLocation::isFileSystem.
 
bool isCommonCollection () const
 ElementsLocation::isCommonCollection.
 
bool isCompanyCollection () const
 ElementsLocation::isCompanyCollection.
 
bool isCustomCollection () const
 ElementsLocation::isCustomCollection.
 
bool isProject () const
 ElementsLocation::isProject.
 
bool exist () const
 ElementsLocation::exist.
 
bool isWritable () const
 ElementsLocation::isWritable.
 
XmlElementCollectionprojectCollection () const
 ElementsLocation::projectCollection.
 
NamesList nameList ()
 ElementsLocation::nameList.
 
QDomElement xml () const
 ElementsLocation::xml.
 
pugi::xml_document pugiXml () const
 ElementsLocation::pugiXml.
 
bool setXml (const QDomDocument &xml_document) const
 ElementsLocation::setXml Replace the current xml description by xml_document; The document element of xml_document must have tagname "definition" to be written This definition must be writable.
 
QUuid uuid () const
 ElementsLocation::uuid.
 
QIcon icon () const
 ElementLocation::icon.
 
QString name () const
 ElementLocation::name.
 
QString fileName () const
 ElementLocation::fileName.
 
DiagramContext elementInformations () const
 ElementsLocation::elementInformations.
 

Static Public Attributes

static int MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation")
 Id of the corresponding Qt meta type.
 

Private Attributes

QString m_collection_path
 
QString m_file_system_path
 
QETProjectm_project = nullptr
 
std::stringstream m_string_stream
 

Detailed Description

The ElementsLocation class This class represents the location, the location of an element or of a category, even of a collection ... in a collection. She encapsulates a virtual path.

Constructor & Destructor Documentation

◆ ElementsLocation() [1/4]

ElementsLocation::ElementsLocation ( )

◆ ElementsLocation() [2/4]

ElementsLocation::ElementsLocation ( const QString &  path,
QETProject project = nullptr 
)

ElementsLocation::ElementsLocation.

Parameters
path: Item location path
project: Project of the location of the element
Here is the call graph for this function:

◆ ElementsLocation() [3/4]

ElementsLocation::ElementsLocation ( const ElementsLocation other)

ElementsLocation::ElementsLocation The copy constructor.

Parameters
other: Alternate item location to copy

◆ ElementsLocation() [4/4]

ElementsLocation::ElementsLocation ( const QMimeData *  data)

ElementsLocation::ElementLocation Constructor, build an ElementLocation from a QMimeData, the mime data format must be "application/x-qet-element-uri" or "application/x-qet-category-uri". This location can be null even if format is valid.

Parameters
data
Here is the call graph for this function:

◆ ~ElementsLocation()

ElementsLocation::~ElementsLocation ( )
virtual

Member Function Documentation

◆ addToPath()

bool ElementsLocation::addToPath ( const QString &  string)

ElementsLocation::addToPath Add a string to the actual path of this location.

Parameters
string
Returns
True if the operation success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ baseName()

QString ElementsLocation::baseName ( ) const

ElementsLocation::baseName.

Returns
The base name of the element or directory. Unlike ElementsLocation::fileName, this method don't return the extension name. For example if this location represent an element they return myElement.
See also
fileName()
Here is the caller graph for this function:

◆ collectionPath()

QString ElementsLocation::collectionPath ( bool  protocol = true) const

ElementsLocation::collectionPath Return the path of the represented element relative to collection if protocol is true the path is prepended by the collection type (common://, company://, custom:// or embed://) else if false, only the collection path is returned without the collection type.

Parameters
protocol
Returns
the path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ elementInformations()

DiagramContext ElementsLocation::elementInformations ( ) const

ElementsLocation::elementInformations.

Returns
the element information of the element represented by this location. If the location is a directory, the returned diagram context is empty
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exist()

bool ElementsLocation::exist ( ) const

ElementsLocation::exist.

Returns
True if this location represent an existing directory or element.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fileName()

QString ElementsLocation::fileName ( ) const

ElementLocation::fileName.

Returns
Return the file name of the represented item, whatever the storage system (file system, xml collection) with is file extension. For example if this location represent an element, they return myElement.elmt. For a directory return myDirectory.
See also
baseName
Here is the caller graph for this function:

◆ fileSystemPath()

QString ElementsLocation::fileSystemPath ( ) const

ElementsLocation::fileSystemPath.

Returns
The file system path of this element, (the separator is always '/' see QDir::toNativeSeparators()) If this element is embedded in a project return an empty string;
Here is the caller graph for this function:

◆ icon()

QIcon ElementsLocation::icon ( ) const

ElementLocation::icon.

Returns
The icon of the represented element. If icon can't be set, return a null QIcon
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCommonCollection()

bool ElementsLocation::isCommonCollection ( ) const

ElementsLocation::isCommonCollection.

Returns
True if this location represent an item from the common collection
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCompanyCollection()

bool ElementsLocation::isCompanyCollection ( ) const

ElementsLocation::isCompanyCollection.

Returns
True if this location represent an item from the company collection
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCustomCollection()

bool ElementsLocation::isCustomCollection ( ) const

ElementsLocation::isCustomCollection.

Returns
True if this location represent an item from the custom collection
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDirectory()

bool ElementsLocation::isDirectory ( ) const

ElementsLocation::isDirectory.

Returns
true if this location represent a directory
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isElement()

bool ElementsLocation::isElement ( ) const

ElementsLocation::isElement.

Returns
true if this location represent an element
Here is the caller graph for this function:

◆ isFileSystem()

bool ElementsLocation::isFileSystem ( ) const

ElementsLocation::isFileSystem.

Returns
true if
Here is the caller graph for this function:

◆ isNull()

bool ElementsLocation::isNull ( ) const

ElementsLocation::isNull.

Returns
true if the location seems usable (virtual path not empty).
Here is the caller graph for this function:

◆ isProject()

bool ElementsLocation::isProject ( ) const

ElementsLocation::isProject.

Returns
True if this location represent an item from a project.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isWritable()

bool ElementsLocation::isWritable ( ) const

ElementsLocation::isWritable.

Returns
True if this element can be writable (can use set xml)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

QString ElementsLocation::name ( ) const

ElementLocation::name.

Returns
The name of the represented element in the current local
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nameList()

NamesList ElementsLocation::nameList ( )

ElementsLocation::nameList.

Returns
the namelist of the represented element or directory. If namelist can't be set, return a empty namelist
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool ElementsLocation::operator!= ( const ElementsLocation other) const

ElementsLocation::operator != Operateur de comparaison.

Parameters
otherAutre emplacement d'element a comparer
Returns
true si other et cet ElementsLocation sont differents, false sinon

◆ operator=()

ElementsLocation & ElementsLocation::operator= ( const ElementsLocation other)

ElementsLocation::operator = Assignment operator.

Parameters
other: Other item location to assign
Returns
*this ElementsLocation

◆ operator==()

bool ElementsLocation::operator== ( const ElementsLocation other) const

ElementsLocation::operator ==.

Parameters
other: other item location to compare
Returns
true if other and this ElementsLocation are identical, false otherwise

◆ parent()

ElementsLocation ElementsLocation::parent ( ) const

ElementsLocation::parent.

Returns
the location of the parent category, or a copy of this location when it represents a root category.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ path()

QString ElementsLocation::path ( ) const

ElementsLocation::path.

Returns
The path of this location.
Deprecated:
use instead collectionPath(true)
Here is the caller graph for this function:

◆ project()

QETProject * ElementsLocation::project ( ) const

ElementsLocation::project.

Returns
the project of this location or 0 if it is not linked to a project.
Here is the caller graph for this function:

◆ projectCollection()

XmlElementCollection * ElementsLocation::projectCollection ( ) const

ElementsLocation::projectCollection.

Returns
If this location represente a item in an embedded project collection, return this collection else return nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ projectCollectionPath()

QString ElementsLocation::projectCollectionPath ( ) const

ElementsLocation::projectCollectionPath.

Returns
The path is in form : project0+embed://dir/subdir/myElement.elmt If this item represent a file system thing, return a null QString;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pugiXml()

pugi::xml_document ElementsLocation::pugiXml ( ) const

ElementsLocation::pugiXml.

Returns
the xml document of this element or directory The definition can be null
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPath()

void ElementsLocation::setPath ( const QString &  path)

ElementsLocation::setPath Set the path of this item. The path can be relative to a collection (start by common://, company://, custom:// or embed://) or not.

Parameters
path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProject()

void ElementsLocation::setProject ( QETProject project)

ElementsLocation::setProject.

Parameters
project: the new project points to this location Indicate 0 so that this location is no longer linked to a project.
Here is the call graph for this function:

◆ setXml()

bool ElementsLocation::setXml ( const QDomDocument &  xml_document) const

ElementsLocation::setXml Replace the current xml description by xml_document; The document element of xml_document must have tagname "definition" to be written This definition must be writable.

Parameters
xml_document
Returns
true if success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

QString ElementsLocation::toString ( ) const

ElementsLocation::toString.

Returns
A character string representing the location
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uuid()

QUuid ElementsLocation::uuid ( ) const

ElementsLocation::uuid.

Returns
The uuid of the pointed element Uuid can be null
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml()

QDomElement ElementsLocation::xml ( ) const

ElementsLocation::xml.

Returns
The definition of this element or directory. The definition can be null.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_collection_path

QString ElementsLocation::m_collection_path
private

◆ m_file_system_path

QString ElementsLocation::m_file_system_path
private

◆ m_project

QETProject* ElementsLocation::m_project = nullptr
private

◆ m_string_stream

std::stringstream ElementsLocation::m_string_stream
mutableprivate

◆ MetaTypeId

int ElementsLocation::MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation")
static

Id of the corresponding Qt meta type.


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