[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Sep 2 11:53:32 UTC 2006
SVN commit 580020 by okellogg:
getFullyQualifiedName(): Add an optional arg, includeRoot.
M +5 -7 attribute.cpp
M +2 -1 attribute.h
M +20 -5 umlobject.cpp
M +8 -5 umlobject.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.cpp #580019:580020
@@ -1,8 +1,3 @@
-/*
- * copyright (C) 2002-2005
- * Umbrello UML Modeller Authors <uml-devel@ uml.sf.net>
- */
-
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@@ -10,6 +5,8 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
+ * copyright (C) 2002-2006 *
+ * Umbrello UML Modeller Authors <uml-devel@ uml.sf.net> *
***************************************************************************/
// own header
@@ -119,7 +116,8 @@
return s + getName();
}
-QString UMLAttribute::getFullyQualifiedName(QString separator) const {
+QString UMLAttribute::getFullyQualifiedName(QString separator,
+ bool includeRoot /* = false */) const {
UMLOperation *op = NULL;
UMLObject *owningObject = static_cast<UMLObject*>(parent());
if (owningObject->getBaseType() == Uml::ot_Operation) {
@@ -135,7 +133,7 @@
}
if (separator.isEmpty())
separator = UMLApp::app()->activeLanguageScopeSeparator();
- QString fqn = ownParent->getFullyQualifiedName(separator);
+ QString fqn = ownParent->getFullyQualifiedName(separator, includeRoot);
if (op)
fqn.append(separator + op->getName());
fqn.append(separator + m_Name);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.h #580019:580020
@@ -93,7 +93,8 @@
/**
* Reimplement method from UMLObject.
*/
- QString getFullyQualifiedName(QString separator = QString::null) const;
+ QString getFullyQualifiedName(QString separator = QString::null,
+ bool includeRoot = false) const;
/**
* Creates the <UML:Attribute> XMI element.
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #580019:580020
@@ -22,6 +22,7 @@
#include "umllistview.h"
#include "umllistviewitem.h"
#include "package.h"
+#include "folder.h"
#include "stereotype.h"
#include "object_factory.h"
#include "model_utils.h"
@@ -105,13 +106,27 @@
return m_Name;
}
-QString UMLObject::getFullyQualifiedName(QString separator) const {
+QString UMLObject::getFullyQualifiedName(QString separator,
+ bool includeRoot /* = false */) const {
QString fqn;
if (m_pUMLPackage) {
- if (separator.isEmpty())
- separator = UMLApp::app()->activeLanguageScopeSeparator();
- fqn = m_pUMLPackage->getFullyQualifiedName(separator);
- fqn.append(separator);
+ bool skipPackage = false;
+ if (!includeRoot) {
+ UMLDoc *umldoc = UMLApp::app()->getDocument();
+ for (int i = 0; i < Uml::N_MODELTYPES; i++) {
+ const Uml::Model_Type mt = (Uml::Model_Type)i;
+ if (m_pUMLPackage == umldoc->getRootFolder(mt)) {
+ skipPackage = true;
+ break;
+ }
+ }
+ }
+ if (!skipPackage) {
+ if (separator.isEmpty())
+ separator = UMLApp::app()->activeLanguageScopeSeparator();
+ fqn = m_pUMLPackage->getFullyQualifiedName(separator, includeRoot);
+ fqn.append(separator);
+ }
}
fqn.append(m_Name);
return fqn;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.h #580019:580020
@@ -229,13 +229,16 @@
/**
* Returns the fully qualified name, i.e. all package prefixes and then m_Name.
*
- * @param separator The separator string to use (optional.)
- * If not given then the separator is chosen according
- * to the currently selected active programming language
- * of import and code generation.
+ * @param separator The separator string to use (optional.)
+ * If not given then the separator is chosen according
+ * to the currently selected active programming language
+ * of import and code generation.
+ * @param includeRoot Whether to prefix the root folder name to the FQN.
+ * See UMLDoc::getRootFolder(). Default: false.
* @return The fully qualified name of this UMLObject.
*/
- virtual QString getFullyQualifiedName(QString separator = QString::null) const;
+ virtual QString getFullyQualifiedName(QString separator = QString::null,
+ bool includeRoot = false) const;
/**
* Returns the abstract state of the object.
More information about the umbrello-devel
mailing list