umbrello/umbrello
umlattributelist.cpp
Go to the documentation of this file.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 UMLAttributeList::UMLAttributeList() 00018 { } 00019 00020 UMLAttributeList::UMLAttributeList(const UMLAttributeList& other) 00021 : QList<UMLAttribute*>( other ) 00022 {} 00023 00024 UMLAttributeList::~UMLAttributeList() 00025 { } 00026 00027 void UMLAttributeList::copyInto(UMLAttributeList *rhs) const { 00028 // Don't copy yourself. 00029 if (rhs == this) return; 00030 00031 rhs->clear(); 00032 00033 // Suffering from const; we shall not modify our object. 00034 UMLAttributeList *tmp = new UMLAttributeList(*this); 00035 00036 UMLAttribute *item; 00037 for (UMLAttributeListIt ait( *tmp ); ait.hasNext() ; ) 00038 { 00039 item = ait.next(); 00040 rhs->append((UMLAttribute*)item->clone()); 00041 } 00042 delete tmp; 00043 } 00044 00045 00046 UMLAttributeList* UMLAttributeList::clone() const { 00047 UMLAttributeList *clone = new UMLAttributeList(); 00048 copyInto(clone); 00049 return clone; 00050 } 00051 00052
KDE 4.0 API Reference