[Uml-devel] KDE/kdesdk/umbrello/umbrello (silent)
Andi Fischer
andi.fischer at hispeed.ch
Thu Feb 28 21:09:29 UTC 2008
SVN commit 780351 by fischer:
SVN_SILENT: small clean-ups.
M +50 -36 umlcanvasobject.cpp
M +6 -13 umlcanvasobject.h
M +2 -2 umlobject.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #780350:780351
@@ -30,10 +30,10 @@
UMLCanvasObject::UMLCanvasObject(const QString & name, Uml::IDType id)
: UMLObject(name, id)
{
- init();
}
-UMLCanvasObject::~UMLCanvasObject() {
+UMLCanvasObject::~UMLCanvasObject()
+{
//removeAllAssociations();
/* No! This is way too late to do that.
It should have been called explicitly before destructing the
@@ -52,7 +52,8 @@
uDebug() << "UMLCanvasObject destructor: FIXME: there are still associations()";
}
-UMLAssociationList UMLCanvasObject::getSpecificAssocs(Uml::Association_Type assocType) {
+UMLAssociationList UMLCanvasObject::getSpecificAssocs(Uml::Association_Type assocType)
+{
UMLAssociationList list;
UMLObject *o = NULL;
for (UMLObjectListIt oit(m_List); oit.hasNext(); ) {
@@ -66,7 +67,8 @@
return list;
}
-bool UMLCanvasObject::addAssociationEnd(UMLAssociation* assoc) {
+bool UMLCanvasObject::addAssociationEnd(UMLAssociation* assoc)
+{
// add association only if not already present in list
if(!hasAssociation(assoc))
{
@@ -80,15 +82,17 @@
return false;
}
-bool UMLCanvasObject::hasAssociation(UMLAssociation* assoc) {
+bool UMLCanvasObject::hasAssociation(UMLAssociation* assoc)
+{
if(m_List.count(assoc) > 0)
return true;
return false;
}
-int UMLCanvasObject::removeAssociationEnd(UMLAssociation * assoc) {
+int UMLCanvasObject::removeAssociationEnd(UMLAssociation * assoc)
+{
if(!hasAssociation(assoc) || !m_List.removeAll(assoc)) {
- uWarning() << "can't find given assoc in list" << endl;
+ uWarning() << "can't find given assoc in list";
return -1;
}
UMLObject::emitModified();
@@ -96,7 +100,8 @@
return m_List.count();
}
-void UMLCanvasObject::removeAllAssociationEnds() {
+void UMLCanvasObject::removeAllAssociationEnds()
+{
for (int i = 0; i < m_List.count(); ) {
UMLObject *o = m_List.at(i);
if (o->getBaseType() != Uml::ot_Association) {
@@ -111,23 +116,22 @@
if (roleAObj) {
roleAObj->removeAssociationEnd(assoc);
} else if (objA)
- uDebug() << m_Name << ": objA " << objA->getName() << " is not a UMLCanvasObject"
- << endl;
+ uDebug() << m_Name << ": objA " << objA->getName() << " is not a UMLCanvasObject";
else
- uDebug() << m_Name << "): objA is NULL" << endl;
+ uDebug() << m_Name << "): objA is NULL";
UMLCanvasObject *roleBObj = dynamic_cast<UMLCanvasObject*>(objB);
if (roleBObj) {
roleBObj->removeAssociationEnd(assoc);
} else if (objB)
- uDebug() << m_Name << "): objB " << objB->getName() << " is not a UMLCanvasObject"
- << endl;
+ uDebug() << m_Name << "): objB " << objB->getName() << " is not a UMLCanvasObject";
else
- uDebug() << m_Name << "): objB is NULL" << endl;
+ uDebug() << m_Name << "): objB is NULL";
m_List.removeAt(i);
}
}
-void UMLCanvasObject::removeAllChildObjects() {
+void UMLCanvasObject::removeAllChildObjects()
+{
removeAllAssociationEnds();
while ( !m_List.isEmpty() ) {
delete m_List.takeFirst();
@@ -135,8 +139,10 @@
}
QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type,
- const QString &prefix /* = QString() */ ) {
- QString currentName = prefix;
+ const QString &prefix /* = QString() */ )
+{
+ QString currentName = QString();
+ currentName = prefix;
if (currentName.isEmpty()) {
switch (type) {
case Uml::ot_Association:
@@ -179,7 +185,8 @@
return name;
}
-UMLObject * UMLCanvasObject::findChildObject(const QString &n, Uml::Object_Type t) {
+UMLObject * UMLCanvasObject::findChildObject(const QString &n, Uml::Object_Type t)
+{
const bool caseSensitive = UMLApp::app()->activeLanguageIsCaseSensitive();
UMLObject *obj = NULL;
for (UMLObjectListIt oit(m_List); oit.hasNext(); ) {
@@ -196,7 +203,9 @@
return NULL;
}
-UMLObject* UMLCanvasObject::findChildObjectById(Uml::IDType id, bool /* considerAncestors */) {
+UMLObject* UMLCanvasObject::findChildObjectById(Uml::IDType id, bool considerAncestors)
+{
+ Q_UNUSED(considerAncestors);
UMLObject *o = NULL;
for (UMLObjectListIt oit(m_List); oit.hasNext(); ) {
o = oit.next();
@@ -206,11 +215,8 @@
return 0;
}
-void UMLCanvasObject::init() {
-
-}
-
-bool UMLCanvasObject::operator==(const UMLCanvasObject& rhs) {
+bool UMLCanvasObject::operator==(const UMLCanvasObject& rhs)
+{
if (this == &rhs) {
return true;
}
@@ -236,7 +242,8 @@
//target->m_List = m_List;
}
-int UMLCanvasObject::associations() {
+int UMLCanvasObject::associations()
+{
int count = 0;
UMLObject *obj = NULL;
for (UMLObjectListIt oit(m_List); oit.hasNext(); ) {
@@ -247,7 +254,8 @@
return count;
}
-UMLAssociationList UMLCanvasObject::getAssociations() {
+UMLAssociationList UMLCanvasObject::getAssociations()
+{
UMLAssociationList assocs;
UMLObject *o = NULL;
for (UMLObjectListIt oit(m_List); oit.hasNext() ; ) {
@@ -260,7 +268,8 @@
return assocs;
}
-UMLClassifierList UMLCanvasObject::getSuperClasses() {
+UMLClassifierList UMLCanvasObject::getSuperClasses()
+{
UMLClassifierList list;
UMLAssociationList assocs = getAssociations();
foreach (UMLAssociation* a , assocs ) {
@@ -273,13 +282,13 @@
list.append(c);
else
uDebug() << m_Name << ": generalization's other end is not a "
- << "UMLClassifier (id= " << ID2STR(a->getObjectId(Uml::B)) << ")"
- << endl;
+ << "UMLClassifier (id= " << ID2STR(a->getObjectId(Uml::B)) << ")";
}
return list;
}
-UMLClassifierList UMLCanvasObject::getSubClasses() {
+UMLClassifierList UMLCanvasObject::getSubClasses()
+{
UMLClassifierList list;
UMLAssociationList assocs = getAssociations();
foreach (UMLAssociation* a , assocs ) {
@@ -292,28 +301,33 @@
list.append(c);
else
uDebug() << "specialization's other end is not a UMLClassifier"
- << " (id=" << ID2STR(a->getObjectId(Uml::A)) << ")" << endl;
+ << " (id=" << ID2STR(a->getObjectId(Uml::A)) << ")";
}
return list;
}
-UMLAssociationList UMLCanvasObject::getRealizations() {
+UMLAssociationList UMLCanvasObject::getRealizations()
+{
return getSpecificAssocs(Uml::at_Realization);
}
-UMLAssociationList UMLCanvasObject::getAggregations() {
+UMLAssociationList UMLCanvasObject::getAggregations()
+{
return getSpecificAssocs(Uml::at_Aggregation);
}
-UMLAssociationList UMLCanvasObject::getCompositions() {
+UMLAssociationList UMLCanvasObject::getCompositions()
+{
return getSpecificAssocs(Uml::at_Composition);
}
-UMLAssociationList UMLCanvasObject::getRelationships() {
+UMLAssociationList UMLCanvasObject::getRelationships()
+{
return getSpecificAssocs(Uml::at_Relationship);
}
-bool UMLCanvasObject::resolveRef() {
+bool UMLCanvasObject::resolveRef()
+{
bool overallSuccess = UMLObject::resolveRef();
for (UMLObjectListIt ait(m_List); ait.hasNext(); ) {
UMLObject *obj = ait.next();
--- trunk/KDE/kdesdk/umbrello/umbrello/umlcanvasobject.h #780350:780351
@@ -32,11 +32,11 @@
* @see UMLObject
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-
class UMLCanvasObject : public UMLObject
{
Q_OBJECT
public:
+
/**
* Sets up a UMLCanvasObject.
*
@@ -75,15 +75,15 @@
/**
* Determine if this canvasobject has the given association.
*
- * @param assoc The association to check.
+ * @param assoc The association to check.
*/
bool hasAssociation(UMLAssociation* assoc);
/**
* Remove an association end from the CanvasObject.
*
- * @param assoc The association to remove.
- * @todo change param type to UMLRole
+ * @param assoc The association to remove.
+ * @todo change param type to UMLRole
*/
int removeAssociationEnd(UMLAssociation *assoc);
@@ -110,8 +110,8 @@
/**
* Return the subset of m_List that matches the given type.
*
- * @param assocType The Association_Type to match.
- * @return The list of associations that match assocType.
+ * @param assocType The Association_Type to match.
+ * @return The list of associations that match assocType.
*/
UMLAssociationList getSpecificAssocs(Uml::Association_Type assocType);
@@ -224,13 +224,6 @@
*/
UMLObjectList m_List;
-private:
-
- /**
- * Initialises key variables of the class.
- */
- void init();
-
signals:
/**
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #780350:780351
@@ -71,10 +71,10 @@
m_BaseType = Uml::ot_UMLObject;
m_nId = Uml::id_None;
m_pUMLPackage = NULL;
- m_Name = "";
+ m_Name = QString();
m_Vis = Uml::Visibility::Public;
m_pStereotype = NULL;
- m_Doc = "";
+ m_Doc = QString();
m_bAbstract = false;
m_bStatic = false;
m_bInPaste = false;
More information about the umbrello-devel
mailing list