umlentityattributelist.cpp
00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 * copyright (C) 2004-2006 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #include "umlentityattributelist.h" 00013 #include "entityattribute.h" 00014 #include <kdebug.h> 00015 #include <klocale.h> 00016 00017 void UMLEntityAttributeList::copyInto(UMLEntityAttributeList* rhs) const { 00018 // Don't copy yourself. 00019 if (rhs == this) return; 00020 00021 rhs->clear(); 00022 00023 // Suffering from const; we shall not modify our object. 00024 UMLEntityAttributeList* tmp = new UMLEntityAttributeList(*this); 00025 00026 UMLEntityAttribute* item; 00027 for (item = tmp->first(); item; item = tmp->next() ) { 00028 rhs->append((UMLEntityAttribute*)item->clone()); 00029 } 00030 delete tmp; 00031 } 00032 00033 00034 UMLEntityAttributeList* UMLEntityAttributeList::clone() const { 00035 UMLEntityAttributeList *clone = new UMLEntityAttributeList(); 00036 copyInto(clone); 00037 return clone; 00038 }
