umbrello API Documentation

stereotype.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) 2003-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 // own header
00013 #include "stereotype.h"
00014 
00015 // qt/kde includes
00016 #include <klocale.h>
00017 #include <kdebug.h>
00018 #include <kinputdialog.h>
00019 
00020 // local includes
00021 #include "umldoc.h"
00022 #include "uml.h"
00023 
00024 UMLStereotype::UMLStereotype(const QString &name, Uml::IDType id /* = Uml::id_None */)
00025         : UMLObject( name, id ) {
00026     m_BaseType = Uml::ot_Stereotype;
00027     UMLStereotype * existing = UMLApp::app()->getDocument()->findStereotype(name);
00028     if (existing) {
00029         kError() << "UMLStereotype constructor: " << name << " already exists"
00030                   << kdBacktrace(25) << endl;
00031     }
00032     m_refCount = 0;
00033 }
00034 
00035 UMLStereotype::UMLStereotype() : UMLObject() {
00036     m_BaseType = Uml::ot_Stereotype;
00037     m_refCount = 0;
00038 }
00039 
00040 UMLStereotype::~UMLStereotype() {}
00041 
00042 bool UMLStereotype::operator==( UMLStereotype &rhs) {
00043     if (this == &rhs) {
00044         return true;
00045     }
00046 
00047     if ( !UMLObject::operator==( rhs ) ) {
00048         return false;
00049     }
00050 
00051     return true;
00052 }
00053 
00054 void UMLStereotype::copyInto(UMLStereotype *rhs) const
00055 {
00056     UMLObject::copyInto(rhs);
00057 }
00058 
00059 UMLObject* UMLStereotype::clone() const
00060 {
00061     UMLStereotype *clone = new UMLStereotype();
00062     copyInto(clone);
00063 
00064     return clone;
00065 }
00066 
00067 
00068 void UMLStereotype::saveToXMI(QDomDocument& qDoc, QDomElement& qElement) {
00069     //FIXME: uml13.dtd compliance
00070     QDomElement stereotypeElement = UMLObject::save("UML:Stereotype", qDoc);
00071     qElement.appendChild( stereotypeElement );
00072 }
00073 
00074 bool UMLStereotype::showPropertiesDialog(QWidget* parent) {
00075     bool ok;
00076     QString name = KInputDialog::getText(i18n("Stereotype"), i18n("Enter name:"), getName(),&ok, parent);
00077     if (ok) {
00078         setName(name);
00079     }
00080     return ok;
00081 }
00082 
00083 void UMLStereotype::incrRefCount() {
00084     m_refCount++;
00085 }
00086 
00087 void UMLStereotype::decrRefCount() {
00088     m_refCount--;
00089 }
00090 
00091 int UMLStereotype::refCount() const {
00092     return m_refCount;
00093 }
00094 
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:00 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003