Fix some doxygen issues (~100)

This commit is contained in:
Simon De Backer
2020-08-18 20:07:55 +02:00
parent b5f212418c
commit 790cdc5229
22 changed files with 205 additions and 154 deletions

View File

@@ -25,10 +25,12 @@
@brief XmlElementCollection::XmlElementCollection
Build an empty collection.
The collection start by :
* <collection>
* <category name="import>
* </category>
* </collection>
@code{xml}
<collection>
<category name="import>
</category>
</collection>
@endcode
All elements and category are stored as child of <category name="import>
@param project : the project of this collection
*/
@@ -72,8 +74,10 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
/**
@brief XmlElementCollection::XmlElementCollection
Constructor with an collection. The tagName of @dom_element must be "collection"
@param dom_element -the collection in a dom_element (the dom element in cloned)
Constructor with an collection.
The tagName of dom_element must be "collection"
@param dom_element :
-the collection in a dom_element (the dom element in cloned)
@param project : the project of this collection
*/
XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, QETProject *project) :
@@ -108,7 +112,7 @@ QDomElement XmlElementCollection::importCategory() const {
/**
@brief XmlElementCollection::childs
@param parent_element
@return All childs element in the @parent_element tree
@return All childs element in the parent_element tree
*/
QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) const
{
@@ -118,10 +122,13 @@ QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) con
/**
@brief XmlElementCollection::child
If parent_element have child element with an attribute name = @child_name, return it, else return a null QDomElement.
Only search for element with tag-name "category" and "element" (if child_name end with ".elmt")
If parent_element have child element
with an attribute name = child_name, return it,
else return a null QDomElement.
Only search for element with tag-name "category" and "element"
(if child_name end with ".elmt")
@param parent_element : the parent DomElement where we search for child.
@parent_element must be a child node of this XmlElementCollection.
parent_element must be a child node of this XmlElementCollection.
@param child_name : name of child to search.
@return The child QDomElement or a null QDomElement if not found
*/
@@ -175,7 +182,7 @@ QDomElement XmlElementCollection::child(const QString &path) const
/**
@brief XmlElementCollection::directories
@param parent_element
@return A list of directory stored in @parent_element
@return A list of directory stored in parent_element
*/
QList<QDomElement> XmlElementCollection::directories(const QDomElement &parent_element) const
{
@@ -196,7 +203,7 @@ QList<QDomElement> XmlElementCollection::directories(const QDomElement &parent_e
/**
@brief XmlElementCollection::directoriesNames
@param parent_element
@return a list of names for every child directories of @parent_element
@return a list of names for every child directories of parent_element
*/
QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_element) const
{
@@ -216,7 +223,7 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele
/**
@brief XmlElementCollection::elements
@param parent_element
@return A list of element stored in @parent_element
@return A list of element stored in parent_element
*/
QList<QDomElement> XmlElementCollection::elements(const QDomElement &parent_element) const
{
@@ -237,7 +244,7 @@ QList<QDomElement> XmlElementCollection::elements(const QDomElement &parent_elem
/**
@brief XmlElementCollection::elementsNames
@param parent_element
@return A list of names fr every childs element of @parent_element
@return A list of names fr every childs element of parent_element
*/
QStringList XmlElementCollection::elementsNames(const QDomElement &parent_element) const
{
@@ -257,7 +264,7 @@ QStringList XmlElementCollection::elementsNames(const QDomElement &parent_elemen
/**
@brief XmlElementCollection::element
@param path : path of the element in this collection
@return the QDomElement that represent the element at path @path
@return the QDomElement that represent the element at path path
or a null QDomElement if not found or doesn't represent an element
*/
QDomElement XmlElementCollection::element(const QString &path) const
@@ -275,7 +282,7 @@ QDomElement XmlElementCollection::element(const QString &path) const
/**
@brief XmlElementCollection::directory
@param path : path of the directory in this collection
@return the QDomElement that represent the directory at path @path
@return the QDomElement that represent the directory at path path
or a null QDomElement if not found.
*/
QDomElement XmlElementCollection::directory(const QString &path) const
@@ -291,35 +298,39 @@ QDomElement XmlElementCollection::directory(const QString &path) const
/**
@brief XmlElementCollection::addElement
Add the element at location to this collection.
The element is copied in this collection in "import" dir with the same path, in other word
if the path is dir1/dir2/dir3/myElement.elmt, myElement is copied to this collection at the path : import/dir1/dir2/dir3/myElement.elmt
The element is copied in this collection
in "import" dir with the same path, in other word
if the path is dir1/dir2/dir3/myElement.elmt,
myElement is copied to this collection at the
path : import/dir1/dir2/dir3/myElement.elmt
If the path doesn't exist, he was created.
If the element already exist, do nothing.
@param location, location of the element
@return the collection path of the added item or a null QString if element can't be added.
@return the collection path of the added item
or a null QString if element can't be added.
*/
QString XmlElementCollection::addElement(ElementsLocation &location)
{
//location must be an element and exist
//location must be an element and exist
if (!(location.exist() && location.isElement()))
return QString();
//Add an element from this collection to this collection have no sense
//Add an element from this collection to this collection have no sense
if (location.isProject() && location.projectCollection() == this)
return QString();
//First we check if this location exist in this collection if so, we do nothing
//First we check if this location exist in this collection if so, we do nothing
if ( exist("import/" + location.collectionPath(false)) )
return QString();
//Get the import dir of this collection
//Get the import dir of this collection
QDomElement parent_element = importCategory();
if (parent_element.isNull())
return QString();
QString integrated_path = parent_element.attribute("name");
//Split the path
//Split the path
QStringList splitted_path = location.collectionPath(false).split("/");
if (splitted_path.isEmpty())
return QString();
@@ -333,11 +344,11 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
foreach(QString str, splitted_path) {
QDomElement child_element = child(parent_element, str);
//Child doesn't exist, we create it
//Child doesn't exist, we create it
if (child_element.isNull()) {
QDomElement created_child;
//str is the path of an element, we integrate an element
//str is the path of an element, we integrate an element
if (str.endsWith(".elmt")) {
QFile element_file(dir.filePath(str));
if (!element_file.exists())
@@ -346,9 +357,9 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
created_child = QETXML::fileSystemElementToXmlCollectionElement(m_dom_document, element_file);
}
//str is the path of a directory, we integrate a directory.
//str is the path of a directory, we integrate a directory.
else {
//Dir doesn't exist.
//Dir doesn't exist.
if (!dir.cd(str))
return QString();
@@ -361,7 +372,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
parent_element.appendChild(created_child);
parent_element = created_child;
}
//Child exist
//Child exist
else {
if (!dir.cd(str))
return QString();
@@ -382,11 +393,11 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
QDomElement child_element = child(parent_element, str);
//Child doesn't exist, we create it
//Child doesn't exist, we create it
if (child_element.isNull()) {
QDomElement created_child;
//str is the path of an element, we integrate an element
//str is the path of an element, we integrate an element
if (str.endsWith(".elmt")) {
created_child = m_dom_document.createElement("element");
created_child.setAttribute("name", str);
@@ -394,7 +405,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
created_child.appendChild(location.xml().cloneNode(true));
}
//str is the path of a directory, we integrate a directory.
//str is the path of a directory, we integrate a directory.
else {
created_child = m_dom_document.createElement("category");
created_child.setAttribute("name", str);
@@ -410,7 +421,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
parent_element.appendChild(created_child);
parent_element = created_child;
}
//Child exist
//Child exist
else
parent_element = child_element;
@@ -424,12 +435,15 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
/**
@brief XmlElementCollection::addElementDefinition
Add the élément defintion @xml_definition in the directory at path @dir_path with the name @elmt_name.
@param dir_path : the path of the directory where we must add the element.
Add the élément defintion xml_definition
in the directory at path dir_path with the name elmt_name.
@param dir_path :
the path of the directory where we must add the element.
The path must be an existing directory of this collection.
@param elmt_name : The name used to store the element (the name must end with .elmt, if not, .elmt will be append to @elmt_name)
@param elmt_name : The name used to store the element
(the name must end with .elmt, if not, .elmt will be append to elmt_name)
@param xml_definition : The xml definition of the element.
The tag name of @xml_definition must be "definition".
The tag name of xml_definition must be "definition".
@return True if the element is added with success.
*/
bool XmlElementCollection::addElementDefinition(const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition)
@@ -462,7 +476,7 @@ bool XmlElementCollection::addElementDefinition(const QString &dir_path, const Q
/**
@brief XmlElementCollection::removeElement
Remove the element at path @path.
Remove the element at path path.
@param path
@return True if element is removed and emit the signal elementRemoved.
else false.
@@ -482,14 +496,19 @@ bool XmlElementCollection::removeElement(const QString& path)
/**
@brief XmlElementCollection::copy
Copy the content represented by source (an element or a directory) to destination.
Copy the content represented by source (an element or a directory)
to destination.
Destination must be a directory of this collection.
If the destination already have an item at the same path of source, he will be replaced by source.
If the destination already have an item at the same path of source,
he will be replaced by source.
@param source : content to copy
@param destination : destination of the copy, must be a directory of this collection
@param rename : rename the copy with @rename else use the name of source
@param deep_copy : if true copy all childs of source (only if source is directory)
@return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
@param destination : destination of the copy, must be a directory
of this collection
@param rename : rename the copy with rename else use the name of source
@param deep_copy : if true copy all childs of source
(only if source is directory)
@return the ElementLocation that represent the copy,
if copy failed return a null ElementLocation
*/
ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy)
{
@@ -504,7 +523,7 @@ ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLo
/**
@brief XmlElementCollection::exist
Return true if the path @path exist in this collection
Return true if the path path exist in this collection
@param path
@return
*/
@@ -552,7 +571,7 @@ bool XmlElementCollection::createDir(const QString& path, const QString& name, c
/**
@brief XmlElementCollection::removeDir
Remove the directory at path @path.
Remove the directory at path path.
@param path
@return true if successfuly removed and emit directoryRemoved(QString),
else false.
@@ -574,7 +593,8 @@ bool XmlElementCollection::removeDir(const QString& path)
If dom_element is null, return all location owned by this collection
dom_element must be a child of this collection.
@param dom_element : dom_element where we must to search location.
@param childs = if true return all childs location of dom_element, if false, only return the direct childs location of dom_element.
@param childs = if true return all childs location of dom_element,
if false, only return the direct childs location of dom_element.
@return
*/
QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_element, bool childs) const
@@ -615,7 +635,8 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
@brief XmlElementCollection::domToLocation
Return the element location who represent the xml element : dom_element
dom_element must be owned by this collection
@param dom_element : the dom_element of this collection that represent an element.
@param dom_element :
the dom_element of this collection that represent an element.
The tag name of dom_element must be "element"
@return the element location, location can be null if fail.
*/
@@ -668,18 +689,20 @@ void XmlElementCollection::cleanUnusedDirectory()
/**
@brief XmlElementCollection::copyDirectory
Copy the directory represented by source to destination.
if destination have a directory with the same name as source, then this directory is removed
if destination have a directory with the same name as source,
then this directory is removed
@param source : directory to copy
@param destination : destination of the copy
@param rename : rename the copy with @rename else use the name of source
@param rename : rename the copy with rename else use the name of source
@param deep_copy :if true copy all childs of source
@return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
@return the ElementLocation that represent the copy,
if copy failed return a null ElementLocation
*/
ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy)
{
QString new_dir_name = rename.isEmpty() ? source.fileName() : rename;
//Get the xml directory where the new directory must be added
//Get the xml directory where the new directory must be added
QDomElement parent_dir_dom = directory(destination.collectionPath(false));
if (parent_dir_dom.isNull()) return ElementsLocation();
@@ -692,7 +715,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
ElementsLocation created_location;
//Copy with a file system collection source
//Copy with a file system collection source
if (source.isFileSystem())
{
QDir source_dir(source.fileSystemPath());
@@ -716,7 +739,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
copyDirectory(sub_source, created_location);
}
//Append all elements of source to the new created directory
//Append all elements of source to the new created directory
source_dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{
@@ -726,14 +749,15 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
}
}
//Copy with a xml collection source
//Copy with a xml collection source
else
{
if (!source.projectCollection()) return ElementsLocation();
QDomNode other_collection_node = source.projectCollection()->child(source.collectionPath(false)).cloneNode(deep_copy);
//We don't make a deep copy, but we must to get the local names of the copied directory
//We don't make a deep copy,
// but we must to get the local names of the copied directory
if (!deep_copy) {
QDomNode names = source.projectCollection()->child(source.collectionPath(false)).namedItem("names");
if (!names.isNull() && names.isElement())
@@ -759,7 +783,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
If element already exist in destination he will be replaced by the new.
@param source : element to copy
@param destination : destination of the copy
@param rename : rename the copy with @rename else use the name of source
@param rename : rename the copy with rename else use the name of source
@return The ElementsLocation of the copy
*/
ElementsLocation XmlElementCollection::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename)
@@ -768,14 +792,14 @@ ElementsLocation XmlElementCollection::copyElement(ElementsLocation &source, Ele
QDomElement elmt_dom;
//Copy with a file system collection source
//Copy with a file system collection source
if (source.isFileSystem())
{
QFile file(source.fileSystemPath());
elmt_dom = QETXML::fileSystemElementToXmlCollectionElement(m_dom_document, file, new_elmt_name);
if (elmt_dom.isNull()) return ElementsLocation();
}
//Copy with a xml collection source
//Copy with a xml collection source
else
{
QDomElement other_collection = source.xml();