umbrello API Documentation

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 
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:01 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003