[Uml-devel] kdesdk/umbrello/umbrello/diagram
Dirk Mueller
mueller at kde.org
Thu Mar 13 02:50:09 UTC 2003
CVS commit by mueller:
std::type_info is private here, so you can't store it. rewriting to get around that
M +7 -9 widgetfactory.cpp 1.7
--- kdesdk/umbrello/umbrello/diagram/widgetfactory.cpp #1.6:1.7
@@ -43,21 +43,19 @@ DiagramElement* WidgetFactory:: createUM
int id = parent->document()->getUniqueID();
- type_info &type = typeid(*obj);
- if( type == typeid(UMLClass) )
- {
- w = new ClassWidget(parent,id,dynamic_cast<UMLClass*>(obj));
- }
- else if ( type == typeid(UMLInterface) )
+ if ( dynamic_cast<UMLClass*>( obj ) )
+ w = new ClassWidget(parent,id,static_cast<UMLClass*>(obj));
+ else if ( dynamic_cast<UMLInterface*>( obj ) )
{
// w = new InterfaceWidget(parent,id,dynamic_cast<UMLInterface*>(obj));
}
- else if ( type == typeid(UMLActor) )
+ else if ( dynamic_cast<UMLActor*> ( obj ) )
{
- w = new ActorWidget(parent,id,dynamic_cast<UMLActor*>(obj));
+ w = new ActorWidget(parent,id,static_cast<UMLActor*>(obj));
}
//else if ( type == typeid(...) )
else
{
- kdDebug()<<"Widget fot type "<<type.name()<<" not yet implemented"<<endl;
+ kdDebug()<<"Widget fot type "
+ << typeid( *obj ).name() << " not yet implemented"<<endl;
}
return w;
More information about the umbrello-devel
mailing list