umlclassifierlistitemlist.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 "umlclassifierlistitemlist.h" 00013 #include "classifierlistitem.h" 00014 #include <kdebug.h> 00015 #include <klocale.h> 00016 00017 void UMLClassifierListItemList::copyInto(UMLClassifierListItemList *rhs) const { 00018 // Prevent copying to yourself. (Can cause serious injuries) 00019 if (rhs == this) return; 00020 00021 rhs->clear(); 00022 00023 // Suffering from const; we shall not modify our object. 00024 UMLClassifierListItemList *tmp = new UMLClassifierListItemList(*this); 00025 00026 UMLClassifierListItem *item; 00027 for (item = tmp->first(); item; item = tmp->next() ) 00028 { 00029 rhs->append((UMLClassifierListItem*)item->clone()); 00030 } 00031 delete tmp; 00032 } 00033 00034 00035 UMLClassifierListItemList* UMLClassifierListItemList::clone() const { 00036 UMLClassifierListItemList *clone = new UMLClassifierListItemList(); 00037 copyInto(clone); 00038 return clone; 00039 } 00040 00041 00042
