Commit 92d13fb6 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Return list from UMLPackage::containedObjects() as reference because we need...

Return list from UMLPackage::containedObjects() as reference because we need adding object references.
parent 98fa381f
......@@ -79,7 +79,7 @@ void PackageContentsPage::slotDoubleClick(QListWidgetItem *item)
if (index == -1) {
return;
}
UMLObjectList contents = m_package->containedObjects();
UMLObjectList &contents = m_package->containedObjects();
UMLObject *o = contents.at(index);
QPointer<ClassPropertiesDialog> dlg = new ClassPropertiesDialog(this, o, true);
dlg->exec();
......@@ -92,7 +92,7 @@ void PackageContentsPage::slotDoubleClick(QListWidgetItem *item)
void PackageContentsPage::fillListBox()
{
m_contentLW->clear();
UMLObjectList contents = m_package->containedObjects();
UMLObjectList &contents = m_package->containedObjects();
UMLObjectListIt objList_it(contents);
UMLObject* umlo = 0;
while (objList_it.hasNext()) {
......@@ -119,7 +119,7 @@ void PackageContentsPage::slotMenuSelection(QAction* action)
switch(id) {
case ListPopupMenu::mt_Delete:
{
UMLObjectList contents = m_package->containedObjects();
UMLObjectList &contents = m_package->containedObjects();
if (m_contentLW->currentRow() == -1)
break;
UMLObject *o = contents.at(m_contentLW->currentRow());
......
......@@ -214,7 +214,7 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
foundType != UMLObject::ot_Component) {
continue;
}
UMLObjectList objectsInCurrentScope = pkg->containedObjects();
UMLObjectList &objectsInCurrentScope = pkg->containedObjects();
for (UMLObjectListIt oit(objectsInCurrentScope); oit.hasNext();) {
UMLObject *obj = oit.next();
uIgnoreZeroPointer(obj);
......
......@@ -229,7 +229,7 @@ void UMLPackage::removeAllObjects()
/**
* Returns the list of objects contained in this package.
*/
UMLObjectList UMLPackage::containedObjects()
UMLObjectList &UMLPackage::containedObjects()
{
return m_objects;
}
......
......@@ -45,7 +45,7 @@ public:
virtual void removeAllObjects();
UMLObjectList containedObjects();
UMLObjectList &containedObjects();
void addAssocToConcepts(UMLAssociation* assoc);
void removeAssocFromConcepts(UMLAssociation *assoc);
......
......@@ -1054,7 +1054,7 @@ UMLObject* UMLDoc::findUMLObject(const QString &name,
return o;
}
for (int i = 0; i < Uml::ModelType::N_MODELTYPES; ++i) {
UMLObjectList list = m_root[i]->containedObjects();
UMLObjectList &list = m_root[i]->containedObjects();
if (list.size() == 0)
continue;
o = Model_Utils::findUMLObject(list, name, type, currentObj);
......@@ -1098,7 +1098,7 @@ UMLObject* UMLDoc::findUMLObjectRaw(UMLFolder *folder,
{
if (folder == 0)
return 0;
UMLObjectList list = folder->containedObjects();
UMLObjectList &list = folder->containedObjects();
if (list.size() == 0)
return 0;
return Model_Utils::findUMLObjectRaw(list, name, type, 0);
......@@ -1898,7 +1898,7 @@ void UMLDoc::removeUMLObject(UMLObject* umlobject, bool deleteObject)
uError() << umlobject->name() << ": root package is not set !";
return;
}
UMLObjectList rootObjects = rootPkg->containedObjects();
UMLObjectList &rootObjects = rootPkg->containedObjects();
// Store the associations to remove in a buffer because we
// should not remove elements from m_objectList while it is
// being iterated over.
......@@ -2710,7 +2710,7 @@ bool UMLDoc::loadUMLObjectsFromXMI1(QDomElement& element)
continue;
}
if (pkg) {
UMLObjectList objects = pkg->containedObjects();
UMLObjectList &objects = pkg->containedObjects();
if (! objects.contains(pObject)) {
DEBUG(DBG_SRC) << "CHECK: adding " << pObject->name()
<< " to " << pkg->name();
......@@ -2963,7 +2963,7 @@ UMLEntityList UMLDoc::entities(bool includeNested /* =true */)
*/
UMLClassifierList UMLDoc::datatypes()
{
UMLObjectList objects = m_datatypeRoot->containedObjects();
UMLObjectList &objects = m_datatypeRoot->containedObjects();
UMLClassifierList datatypeList;
foreach (UMLObject *obj, objects) {
uIgnoreZeroPointer(obj);
......@@ -3394,7 +3394,7 @@ void UMLDoc::addDefaultDatatypes()
*/
void UMLDoc::createDatatype(const QString &name)
{
UMLObjectList datatypes = m_datatypeRoot->containedObjects();
UMLObjectList &datatypes = m_datatypeRoot->containedObjects();
UMLObject* umlobject = Model_Utils::findUMLObject(datatypes, name,
UMLObject::ot_Datatype, m_datatypeRoot);
if (!umlobject) {
......
......@@ -2743,7 +2743,7 @@ bool UMLListView::deleteItem(UMLListViewItem *temp)
} else if (Model_Utils::typeIsCanvasWidget(lvt) || Model_Utils::typeIsClassifierList(lvt)) {
UMLPackage *nmSpc = object->asUMLPackage();
if (nmSpc) {
UMLObjectList contained = nmSpc->containedObjects();
UMLObjectList &contained = nmSpc->containedObjects();
if (contained.count()) {
KMessageBox::error(
0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment