umlattributelist.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 "umlattributelist.h" 00013 #include "attribute.h" 00014 #include <kdebug.h> 00015 #include <klocale.h> 00016 00017 void UMLAttributeList::copyInto(UMLAttributeList *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 UMLAttributeList *tmp = new UMLAttributeList(*this); 00025 00026 UMLAttribute *item; 00027 for (item = tmp->first(); item; item = tmp->next() ) 00028 { 00029 rhs->append((UMLAttribute*)item->clone()); 00030 } 00031 delete tmp; 00032 } 00033 00034 00035 UMLAttributeList* UMLAttributeList::clone() const { 00036 UMLAttributeList *clone = new UMLAttributeList(); 00037 copyInto(clone); 00038 return clone; 00039 }
