/** * Sets the class' UMLStereotype. Adjusts the reference counts * at the previously set stereotype and at the new stereotype. * If the previously set UMLStereotype's reference count drops * to zero then the UMLStereotype is removed at the UMLDoc and * it is then physically deleted. * * @param stereo Sets the classes UMLStereotype. */ void UMLObject::setUMLStereotype(UMLStereotype *stereo) { if (stereo == m_pStereotype) return; if (stereo) { stereo->incrRefCount(); } if (m_pStereotype) { m_pStereotype->decrRefCount(); if (m_pStereotype->refCount() == 0) { UMLDoc *pDoc = UMLApp::app()->document(); pDoc->removeStereotype(m_pStereotype); delete m_pStereotype; } } m_pStereotype = stereo; // TODO: don't emit modified() if predefined folder emitModified(); }