[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Jan 7 07:05:17 UTC 2005
CVS commit by okellogg:
addAttribute(): Fix condition for m_List.insert() vs. append()
M +11 -6 class.cpp 1.55
--- kdesdk/umbrello/umbrello/class.cpp #1.54:1.55
@@ -68,8 +68,9 @@ bool UMLClass::addAttribute(UMLAttribute
int position /* = -1 */) {
QString name = (QString)Att->getName();
- if( findChildObject( Uml::ot_Attribute, name).count() == 0 ) {
+ UMLObjectList list = findChildObject(Uml::ot_Attribute, name);
+ if (list.count() == 0 ) {
Att -> parent() -> removeChild( Att );
this -> insertChild( Att );
- if( position >= 0 && position <= (int)m_List.count() )
+ if( position >= 0 && position < (int)m_List.count() )
m_List.insert(position,Att);
else
@@ -102,10 +103,14 @@ int UMLClass::removeAttribute(UMLObject*
UMLAttribute* UMLClass::takeAttribute(UMLAttribute* a) {
int index = m_List.findRef( a );
- a = (index == -1 ? 0 : dynamic_cast<UMLAttribute*>(m_List.take( )));
- if (a) {
- emit attributeRemoved(a);
+ UMLAttribute *retval = NULL;
+ if (index != -1)
+ retval = dynamic_cast<UMLAttribute*>(m_List.take( ));
+ if (retval) {
+ emit attributeRemoved(retval);
emit modified();
}
- return a;
+ kdDebug() << "UMLClass::takeAttribute: findRef returns " << index
+ << ", a=" << a << ", retval=" << retval << endl;
+ return retval;
}
More information about the umbrello-devel
mailing list