umlobjectlist.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) 2002-2006 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #include "umlobjectlist.h" 00013 #include "umlobject.h" 00014 #include <kdebug.h> 00015 #include <klocale.h> 00016 00017 void UMLObjectList::copyInto(UMLObjectList *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 UMLObjectList *tmp = new UMLObjectList(*this); 00025 00026 UMLObject *item; 00027 for (item = tmp->first(); item; item = tmp->next() ) 00028 { 00029 rhs->append(item->clone()); 00030 } 00031 delete tmp; 00032 } 00033 00034 00035 UMLObjectList* UMLObjectList::clone() const { 00036 UMLObjectList *clone = new UMLObjectList(); 00037 copyInto(clone); 00038 return clone; 00039 } 00040 00041 00042
