1 /* 2 SPDX-License-Identifier: GPL-2.0-or-later 3 SPDX-FileCopyrightText: 2004-2014 Umbrello UML Modeller Authors <umbrello-devel@kde.org> 4 */ 5 6 #include "umlentityattributelist.h" 7 8 #include "entityattribute.h" 9 10 #include <KLocalizedString> 11 UMLEntityAttributeList()12UMLEntityAttributeList::UMLEntityAttributeList() 13 { 14 } 15 UMLEntityAttributeList(const UMLEntityAttributeList & other)16UMLEntityAttributeList::UMLEntityAttributeList(const UMLEntityAttributeList& other) 17 : QList<UMLEntityAttribute*>(other) 18 { 19 } 20 ~UMLEntityAttributeList()21UMLEntityAttributeList::~UMLEntityAttributeList() 22 { 23 } 24 25 /** 26 * Copy the internal presentation of this object into the new 27 * object. 28 */ copyInto(UMLEntityAttributeList * rhs) const29void UMLEntityAttributeList::copyInto(UMLEntityAttributeList* rhs) const 30 { 31 // Don't copy yourself. 32 if (rhs == this) return; 33 34 rhs->clear(); 35 36 // Suffering from const; we shall not modify our object. 37 UMLEntityAttributeList* tmp = new UMLEntityAttributeList(*this); 38 39 UMLEntityAttribute* item; 40 for (UMLEntityAttributeListIt eait(*tmp); eait.hasNext() ;) { 41 item = eait.next(); 42 rhs->append((UMLEntityAttribute*)item->clone()); 43 } 44 delete tmp; 45 } 46 47 /** 48 * Make a clone of this object. 49 */ clone() const50UMLEntityAttributeList* UMLEntityAttributeList::clone() const 51 { 52 UMLEntityAttributeList *clone = new UMLEntityAttributeList(); 53 copyInto(clone); 54 return clone; 55 } 56