Commit a5f92b67 authored by Ralf Habacker's avatar Ralf Habacker

Convert casts in UML model classes to use related casting methods.

CCBUG:368282
Reviewed-by: aaron.nottbeck at sag.eu
parent 668c6ad4
......@@ -637,7 +637,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
QString newName = parent->uniqChildName(UMLObject::ot_Attribute, obj->name());
obj->setName(newName);
}
UMLAttribute *att = static_cast<UMLAttribute*>(obj);
UMLAttribute *att = obj->asUMLAttribute();
if (parent->addAttribute(att, idchanges)) {
result = true;
} else {
......@@ -648,7 +648,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
}
case UMLObject::ot_Operation :
{
UMLOperation *op = static_cast<UMLOperation*>(obj);
UMLOperation *op = obj->asUMLOperation();
UMLOperation *exist = parent->checkOperationSignature(op->name(), op->getParmList());
if (exist) {
QString newName = parent->uniqChildName(UMLObject::ot_Operation, obj->name());
......@@ -664,7 +664,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
}
case UMLObject::ot_Template:
{
UMLTemplate* tp = static_cast<UMLTemplate*>(obj);
UMLTemplate* tp = obj->asUMLTemplate();
UMLTemplate* exist = parent->findTemplate(tp->name());
if (exist) {
QString newName = parent->uniqChildName(UMLObject::ot_Template, obj->name());
......@@ -680,7 +680,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
}
case UMLObject::ot_EnumLiteral:
{
UMLEnum* enumParent = dynamic_cast<UMLEnum*>(parent);
UMLEnum* enumParent = parent->asUMLEnum();
// if parent is not a UMLEnum, bail out immediately;
if (!enumParent) {
result = false;
......@@ -693,7 +693,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
QString newName = enumParent->uniqChildName(UMLObject::ot_EnumLiteral, obj->name());
obj->setName(newName);
}
UMLEnumLiteral* enl = static_cast<UMLEnumLiteral*>(obj);
UMLEnumLiteral* enl = obj->asUMLEnumLiteral();
if (enumParent->addEnumLiteral(enl, idchanges)) {
result = true;
......@@ -705,7 +705,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
}
case UMLObject::ot_EntityAttribute :
{
UMLEntity* entityParent = dynamic_cast<UMLEntity*>(parent);
UMLEntity* entityParent = parent->asUMLEntity();
// if parent is not a UMLEntity, bail out immediately;
if (!entityParent) {
result = false;
......@@ -717,7 +717,7 @@ bool UMLClipboard::pasteClip5(const QMimeData* data)
QString newName = entityParent->uniqChildName(UMLObject::ot_EntityAttribute, obj->name());
obj->setName(newName);
}
UMLEntityAttribute *att = static_cast<UMLEntityAttribute*>(obj);
UMLEntityAttribute *att = obj->asUMLEntityAttribute();
if (entityParent->addEntityAttribute(att, idchanges)) {
result = true;
......
......@@ -846,7 +846,7 @@ bool UMLDragData::decodeViews(QDomNode& umlviewsNode, UMLViewList& diagrams)
uError() << "Bad parent for view.";
return false;
}
UMLFolder *f = static_cast<UMLFolder*>(po);
UMLFolder *f = po->asUMLFolder();
UMLView* view = new UMLView(f);
view->umlScene()->loadFromXMI(diagramElement);
diagrams.append(view);
......
......@@ -122,7 +122,7 @@ QString AdaWriter::packageName(UMLPackage *p)
if (umlPkg == UMLApp::app()->document()->rootFolder(Uml::ModelType::Logical))
umlPkg = NULL;
UMLClassifier *c = dynamic_cast<UMLClassifier*>(p);
UMLClassifier *c = p->asUMLClassifier();
if (umlPkg == NULL) {
retval = className;
if (c == NULL || !isOOClass(c))
......@@ -309,7 +309,7 @@ void AdaWriter::writeClass(UMLClassifier *c)
}
if (c->baseType() == UMLObject::ot_Enum) {
UMLEnum *ue = static_cast<UMLEnum*>(c);
UMLEnum *ue = c->asUMLEnum();
UMLClassifierListItemList litList = ue->getFilteredList(UMLObject::ot_EnumLiteral);
uint i = 0;
ada << indent() << "type " << classname << " is (" << m_endl;
......
......@@ -49,7 +49,7 @@ void AdvancedCodeGenerator::checkAddUMLObject(UMLObject * obj)
return;
}
UMLClassifier * c = dynamic_cast<UMLClassifier*>(obj);
UMLClassifier * c = obj->asUMLClassifier();
if (c) {
CodeDocument * cDoc = newClassifierCodeDocument(c);
addCodeDocument(cDoc);
......@@ -65,7 +65,7 @@ void AdvancedCodeGenerator::checkRemoveUMLObject(UMLObject * obj)
return;
}
UMLClassifier * c = dynamic_cast<UMLClassifier*>(obj);
UMLClassifier * c = obj->asUMLClassifier();
if (c) {
ClassifierCodeDocument * cDoc = (ClassifierCodeDocument*) findCodeDocumentByClassifier(c);
if (cDoc) {
......
......@@ -301,7 +301,7 @@ QList<CodeOperation*> ClassifierCodeDocument::getCodeOperations ()
*/
void ClassifierCodeDocument::addOperation (UMLClassifierListItem * o)
{
UMLOperation *op = dynamic_cast<UMLOperation*>(o);
UMLOperation *op = o->asUMLOperation();
if (op == NULL) {
uError() << "arg is not a UMLOperation";
return;
......
......@@ -73,7 +73,7 @@ CodeClassField::~CodeClassField ()
*/
void CodeClassField::setParentUMLObject (UMLObject * obj)
{
UMLRole *role = dynamic_cast<UMLRole*>(obj);
UMLRole *role = obj->asUMLRole();
if(role) {
UMLAssociation * parentAssoc = role->parentAssociation();
Uml::AssociationType::Enum atype = parentAssoc->getAssocType();
......@@ -113,7 +113,7 @@ QString CodeClassField::getListObjectType()
{
if (!parentIsAttribute())
{
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if (role)
return getUMLObjectName(role->object());
}
......@@ -330,7 +330,7 @@ int CodeClassField::minimumListOccurances()
{
if (!parentIsAttribute())
{
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if (!role) {
uError() << "no valid parent object";
return -1;
......@@ -358,7 +358,7 @@ int CodeClassField::maximumListOccurances()
{
if (!parentIsAttribute())
{
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if (!role) {
uError() << "no valid parent object";
return -1;
......@@ -527,7 +527,9 @@ void CodeClassField::updateContent()
method->setWriteOutText(m_writeOutMethods);
return;
}
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if (!role)
return;
Uml::Changeability::Enum changeType = role->changeability();
bool isSingleValue = fieldIsSingleValue();
bool isEmptyRole = role->name().isEmpty() ? true : false;
......@@ -620,7 +622,7 @@ bool CodeClassField::fieldIsSingleValue ()
if(parentIsAttribute())
return true;
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if(!role)
return true; // it is really an attribute
......
......@@ -139,7 +139,7 @@ void CodeClassFieldDeclarationBlock::syncToParent ()
// the name of the role is not defined.
if (!(getParentClassField()->parentIsAttribute()))
{
UMLRole * parent = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * parent = getParentObject()->asUMLRole();
if (parent == NULL)
return;
if (parent->name().isEmpty())
......
......@@ -397,11 +397,11 @@ void CodeDocument::setAttributesFromNode (QDomElement & root)
// suspecting pre-1.5.3 file format where the package name was
// saved instead of the package ID.
UMLObject *o = umldoc->findUMLObject(pkgStr);
m_package = dynamic_cast<UMLPackage*>(o);
m_package = o->asUMLPackage();
}
if (m_package == NULL) {
UMLObject *o = umldoc->findObjectById(Uml::ID::fromString(pkgStr));
m_package = dynamic_cast<UMLPackage*>(o);
m_package = o->asUMLPackage();
}
}
const QString trueStr = QLatin1String("true");
......
......@@ -227,7 +227,7 @@ void CodeGenerator::loadCodeForOperation(const QString& idStr, const QDomElement
UMLObject::ObjectType t = obj->baseType();
if (t == UMLObject::ot_Operation) {
UMLOperation *op = static_cast<UMLOperation*>(obj);
UMLOperation *op = obj->asUMLOperation();
op->setSourceCode(value);
}
else {
......@@ -642,7 +642,7 @@ void CodeGenerator::findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
UMLObject *objA = a->getObject(Uml::RoleType::A);
UMLObject *objB = a->getObject(Uml::RoleType::B);
if (objA == c) {
temp = static_cast<UMLPackage*>(objB);
temp = objB->asUMLPackage();
}
}
break;
......@@ -653,7 +653,7 @@ void CodeGenerator::findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
UMLObject *objA = a->getObject(Uml::RoleType::A);
UMLObject *objB = a->getObject(Uml::RoleType::B);
if (objA == c && objB->baseType() != UMLObject::ot_Datatype) {
temp = static_cast<UMLPackage*>(objB);
temp = objB->asUMLPackage();
}
}
break;
......
......@@ -465,7 +465,7 @@ void CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode (QDomElement & roo
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"), QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op) {
CodeOperation * block = CodeGenFactory::newCodeOperation(dynamic_cast<ClassifierCodeDocument*>(m_pCodeDoc), op);
block->loadFromXMI(element);
......
......@@ -63,7 +63,7 @@ QList<CodeParameter*> CodeOperation::getParameterList ()
UMLOperation * CodeOperation::getParentOperation()
{
return dynamic_cast<UMLOperation*>(getParentObject());
return getParentObject()->asUMLOperation();
}
/**
......@@ -119,7 +119,7 @@ void CodeOperation::setAttributesFromNode (QDomElement & element)
QString idStr = element.attribute(QLatin1String("parent_id"), QLatin1String("-1"));
Uml::ID::Type id = Uml::ID::fromString(idStr);
UMLObject * obj = UMLApp::app()->document()->findObjectById(id);
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op)
init(op);
......
......@@ -147,7 +147,7 @@ UMLObject * CodeParameter::getParentObject()
// this is kind of broken for UMLRoles.
QString CodeParameter::ID()
{
UMLRole * role = dynamic_cast<UMLRole*>(m_parentObject);
UMLRole * role = m_parentObject->asUMLRole();
if (role)
{
// cant use Role "ID" as that is used to distinquish if its
......@@ -171,7 +171,7 @@ void CodeParameter::setAttributesOnNode(QDomDocument & doc, QDomElement & blockE
// setting ID's takes special treatment
// as UMLRoles arent properly stored in the XMI right now.
// (change would break the XMI format..save for big version change)
UMLRole * role = dynamic_cast<UMLRole*>(m_parentObject);
UMLRole * role = m_parentObject->asUMLRole();
if (role)
blockElement.setAttribute(QLatin1String("role_id"), role->role());
else
......@@ -212,7 +212,7 @@ void CodeParameter::setAttributesFromNode(QDomElement & root)
// might ripple throughout the code and cause problems. Thus, since the
// change appears to be needed for only this part, I'll do this crappy
// change instead. -b.t.
UMLAssociation * assoc = dynamic_cast<UMLAssociation*>(obj);
UMLAssociation * assoc = obj->asUMLAssociation();
if (assoc) {
// In this case we init with indicated role child obj.
UMLRole * role = 0;
......
......@@ -66,7 +66,7 @@ QString CPPCodeClassField::getInitialValue()
{
if (parentIsAttribute())
{
UMLAttribute * at = dynamic_cast<UMLAttribute*>(getParentObject());
UMLAttribute * at = getParentObject()->asUMLAttribute();
if (at) {
return fixInitialStringDeclValue(at->getInitialValue(), getTypeName());
} else {
......
......@@ -348,7 +348,7 @@ void CPPCodeGenerator::checkAddUMLObject(UMLObject * obj)
if (isReservedKeyword(obj->name()))
return;
UMLClassifier * c = dynamic_cast<UMLClassifier*>(obj);
UMLClassifier * c = obj->asUMLClassifier();
if(c) {
CodeDocument * cDoc = newClassifierCodeDocument(c);
CPPHeaderCodeDocument * hcodeDoc = newHeaderClassifierCodeDocument(c);
......@@ -370,7 +370,7 @@ void CPPCodeGenerator::checkRemoveUMLObject(UMLObject * obj)
if (!obj)
return;
UMLClassifier * c = dynamic_cast<UMLClassifier*>(obj);
UMLClassifier * c = obj->asUMLClassifier();
if(c) {
// source
ClassifierCodeDocument * cDoc = (ClassifierCodeDocument*) findCodeDocumentByClassifier(c);
......
......@@ -160,7 +160,7 @@ void CPPHeaderCodeDocument::loadChildTextBlocksFromNode (QDomElement & root)
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"),QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if(op) {
CodeOperation * block = new CPPHeaderCodeOperation(this, op);
block->updateMethodDeclaration();
......@@ -481,7 +481,7 @@ void CPPHeaderCodeDocument::updateContent()
if (!isInterface) {
QString enumStatement;
QString indent = UMLApp::app()->commonPolicy()->getIndentation();
UMLEnum* e = dynamic_cast<UMLEnum*>(c);
UMLEnum* e = c->asUMLEnum();
if (e) {
enumStatement.append(indent + QLatin1String("enum ") + cppClassName + QLatin1String(" {") + endLine);
......
......@@ -200,7 +200,7 @@ void CSharpWriter::writeClass(UMLClassifier *c)
if (includes.count()) {
foreach (UMLPackage* p, includes) {
UMLClassifier *cl = dynamic_cast<UMLClassifier*>(p);
UMLClassifier *cl = p->asUMLClassifier();
if (cl)
p = cl->umlPackage();
if (p != logicalView && m_seenIncludes.indexOf(p) == -1 && p != container) {
......
......@@ -202,7 +202,7 @@ void DClassifierCodeDocument::loadChildTextBlocksFromNode(QDomElement & root)
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"), QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op) {
CodeOperation * block = new DCodeOperation(this, op);
block->loadFromXMI(element);
......
......@@ -66,7 +66,7 @@ QString DCodeClassField::getInitialValue()
{
if (parentIsAttribute())
{
UMLAttribute * at = dynamic_cast<UMLAttribute*>(getParentObject());
UMLAttribute * at = getParentObject()->asUMLAttribute();
if (at) {
return fixInitialStringDeclValue(at->getInitialValue(), getTypeName());
} else {
......
......@@ -127,7 +127,7 @@ void JavaANTCodeDocument::loadChildTextBlocksFromNode (QDomElement & root)
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"),QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op) {
CodeOperation * block = 0;
uError() << "TODO: implement CodeGenFactory::newCodeOperation() for JavaANTCodeDocument";
......
......@@ -199,7 +199,7 @@ void JavaClassifierCodeDocument::loadChildTextBlocksFromNode (QDomElement & root
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"), QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op) {
CodeOperation * block = new JavaCodeOperation(this, op);
block->loadFromXMI(element);
......
......@@ -60,7 +60,7 @@ QString JavaCodeClassField::getInitialValue()
{
if (parentIsAttribute())
{
UMLAttribute * at = dynamic_cast<UMLAttribute*>(getParentObject());
UMLAttribute * at = getParentObject()->asUMLAttribute();
if (at) {
return fixInitialStringDeclValue(at->getInitialValue(), getTypeName());
} else {
......
......@@ -84,7 +84,7 @@ void OwnedCodeBlock::setAttributesOnNode(QDomDocument& /*doc*/, QDomElement& ele
// setting ID's takes special treatment
// as UMLRoles arent properly stored in the XMI right now.
// (change would break the XMI format..save for big version change)
UMLRole * role = dynamic_cast<UMLRole*>(m_parentObject);
UMLRole * role = m_parentObject->asUMLRole();
if (role) {
elem.setAttribute(QLatin1String("parent_id"), Uml::ID::toString(role->parentAssociation()->id()));
// CAUTION: role_id here is numerically inverted wrt Uml::Role_Type,
......@@ -125,7 +125,7 @@ void OwnedCodeBlock::setAttributesFromNode (QDomElement & elem)
// might ripple throughout the code and cause problems. Thus, since the
// change appears to be needed for only this part, I'll do this crappy
// change instead. -b.t.
UMLAssociation * assoc = dynamic_cast<UMLAssociation*>(obj);
UMLAssociation * assoc = obj->asUMLAssociation();
if (assoc) {
// In this case we init with indicated role child obj.
UMLRole * role = 0;
......
......@@ -66,7 +66,7 @@ void OwnedHierarchicalCodeBlock::setAttributesOnNode(QDomDocument & doc, QDomEle
// setting ID's takes special treatment
// as UMLRoles arent properly stored in the XMI right now.
// (change would break the XMI format..save for big version change)
UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
UMLRole * role = getParentObject()->asUMLRole();
if(role) {
// see comment on role_id at OwnedCodeBlock::setAttributesOnNode()
elem.setAttribute(QLatin1String("role_id"), (role->role() == Uml::RoleType::A));
......
......@@ -89,7 +89,7 @@ QString PascalWriter::qualifiedName(UMLPackage *p, bool withType, bool byValue)
if (umlPkg == UMLApp::app()->document()->rootFolder(Uml::ModelType::Logical))
umlPkg = NULL;
UMLClassifier *c = dynamic_cast<UMLClassifier*>(p);
UMLClassifier *c = p->asUMLClassifier();
if (umlPkg == NULL) {
retval = className;
if (c == NULL || !isOOClass(c))
......@@ -200,7 +200,7 @@ void PascalWriter::writeClass(UMLClassifier *c)
pas << "type" << m_endl;
m_indentLevel++;
if (c->baseType() == UMLObject::ot_Enum) {
UMLEnum *ue = static_cast<UMLEnum*>(c);
UMLEnum *ue = c->asUMLEnum();
UMLClassifierListItemList litList = ue->getFilteredList(UMLObject::ot_EnumLiteral);
uint i = 0;
pas << indent() << classname << " = (" << m_endl;
......
......@@ -235,7 +235,7 @@ void RubyClassifierCodeDocument::loadChildTextBlocksFromNode(QDomElement & root)
// find the code operation by id
QString id = element.attribute(QLatin1String("parent_id"), QLatin1String("-1"));
UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
UMLOperation * op = obj->asUMLOperation();
if (op) {
CodeOperation * block = new RubyCodeOperation(this, op);
block->loadFromXMI(element);
......
......@@ -64,7 +64,7 @@ QString RubyCodeClassField::getInitialValue()
{
if (parentIsAttribute())
{
UMLAttribute * at = dynamic_cast<UMLAttribute*>(getParentObject());
UMLAttribute * at = getParentObject()->asUMLAttribute();
if (at) {
return fixInitialStringDeclValue(at->getInitialValue(), getTypeName());
} else {
......
......@@ -88,7 +88,7 @@ void MySQLWriter::printForeignKeyConstraints(QTextStream& sql, UMLClassifierList
// we need to create an index on the referenced attributes before we can create a foreign key constraint in MySQL
foreach(UMLClassifierListItem* cli, constrList) {
UMLForeignKeyConstraint* fkc = static_cast<UMLForeignKeyConstraint*>(cli);
UMLForeignKeyConstraint* fkc = cli->asUMLForeignKeyConstraint();
QMap<UMLEntityAttribute*, UMLEntityAttribute*> attributeMap = fkc->getEntityAttributePairs();
......
......@@ -188,7 +188,7 @@ SQLWriter::~SQLWriter()
*/
void SQLWriter::writeClass(UMLClassifier *c)
{
UMLEntity* e = dynamic_cast<UMLEntity*>(c);
UMLEntity* e = c->asUMLEntity();
if (!e) {
uError() << "Invalid cast from" << c->baseTypeStr() << "'" << c->name() << "' to UMLEntity*";
......@@ -424,7 +424,7 @@ void SQLWriter::printEntityAttributes(QTextStream& sql, UMLEntityAttributeList e
void SQLWriter::printUniqueConstraints(QTextStream& sql, UMLClassifierListItemList constrList)
{
foreach(UMLClassifierListItem* cli, constrList) {
UMLUniqueConstraint* uuc = dynamic_cast<UMLUniqueConstraint*>(cli);
UMLUniqueConstraint* uuc = cli->asUMLUniqueConstraint();
if (!uuc) {
uError() << "Invalid cast from" << cli->baseTypeStr() << "'" << cli->name() << "' to UMLUniqueConstraint*";
return;
......@@ -471,7 +471,7 @@ void SQLWriter::printUniqueConstraints(QTextStream& sql, UMLClassifierListItemLi
void SQLWriter::printForeignKeyConstraints(QTextStream& sql, UMLClassifierListItemList constrList)
{
foreach(UMLClassifierListItem* cli, constrList) {
UMLForeignKeyConstraint* fkc = dynamic_cast<UMLForeignKeyConstraint*>(cli);
UMLForeignKeyConstraint* fkc = cli->asUMLForeignKeyConstraint();
if (!fkc) {
uError() << "Invalid cast from" << cli->baseTypeStr() << "'" << cli->name() << "' to UMLForeignKeyConstraint*";
return;
......@@ -598,7 +598,7 @@ void SQLWriter::printAutoIncrements(QTextStream& sql, UMLEntityAttributeList ent
void SQLWriter::printCheckConstraints(QTextStream& sql, UMLClassifierListItemList constrList)
{
foreach(UMLClassifierListItem* cli, constrList) {
UMLCheckConstraint* chConstr = dynamic_cast<UMLCheckConstraint*>(cli);
UMLCheckConstraint* chConstr = cli->asUMLCheckConstraint();
if (!chConstr) {
uError() << "Invalid cast from" << cli->baseTypeStr() << "'" << cli->name() << "' to UMLCheckConstraint*";
return;
......
......@@ -237,7 +237,7 @@ void ValaWriter::writeClass(UMLClassifier *c)
//m_seenIncludes.append(logicalView);
if (includes.count()) {
foreach (UMLPackage* p, includes) {
UMLClassifier *cl = dynamic_cast<UMLClassifier*>(p);
UMLClassifier *cl = p->asUMLClassifier();
if (cl) {
p = cl->umlPackage();
}
......
......@@ -454,7 +454,7 @@ void XMLSchemaWriter::writeChildObjsInAssociation (UMLClassifier *c,
{
UMLObjectList list = findChildObjsInAssociations (c, assoc);
foreach(UMLObject* obj, list) {
UMLClassifier * thisClassifier = dynamic_cast<UMLClassifier*>(obj);
UMLClassifier * thisClassifier = obj->asUMLClassifier();
if (thisClassifier)
writeClassifier(thisClassifier, xs);
}
......
......@@ -261,7 +261,7 @@ bool AdaImport::parseStmt()
umldoc->addAssociation(assoc);
skipStmt();
} else {
pushScope(static_cast<UMLPackage*>(ns));
pushScope(ns->asUMLPackage());
}
} else if (m_source[m_srcIndex] == QLatin1String("renames")) {
m_renaming[name] = advance();
......@@ -328,7 +328,7 @@ bool AdaImport::parseStmt()
// enum type
UMLObject *ns = Import_Utils::createUMLObject(UMLObject::ot_Enum,
name, currentScope(), m_comment);
UMLEnum *enumType = static_cast<UMLEnum*>(ns);
UMLEnum *enumType = ns->asUMLEnum();
while ((next = advance()) != QLatin1String(")")) {
Import_Utils::addEnumLiteral(enumType, next, m_comment);
m_comment.clear();
......@@ -363,10 +363,10 @@ bool AdaImport::parseStmt()
UMLObject *ns = Import_Utils::createUMLObject(t, name, currentScope(), m_comment);
if (t == UMLObject::ot_Interface) {
while ((next = advance()) == QLatin1String("and")) {
UMLClassifier *klass = static_cast<UMLClassifier*>(ns);
UMLClassifier *klass = ns->asUMLClassifier();
QString base = expand(advance());
UMLObject *p = Import_Utils::createUMLObject(UMLObject::ot_Interface, base, currentScope());
UMLClassifier *parent = static_cast<UMLClassifier*>(p);
UMLClassifier *parent = p->asUMLClassifier();
Import_Utils::createGeneralization(klass, parent);
}
} else {
......@@ -380,7 +380,7 @@ bool AdaImport::parseStmt()
ns->setStereotype(QLatin1String("record"));
}
if (next == QLatin1String("record"))
m_klass = static_cast<UMLClassifier*>(ns);
m_klass = ns->asUMLClassifier();
else
skipStmt();
return true;
......@@ -401,12 +401,12 @@ bool AdaImport::parseStmt()
t = (known ? known->baseType() : UMLObject::ot_Datatype);
}
UMLObject *ns = Import_Utils::createUMLObject(t, base, NULL);
UMLClassifier *parent = static_cast<UMLClassifier*>(ns);
UMLClassifier *parent = ns->asUMLClassifier();
ns = Import_Utils::createUMLObject(t, name, currentScope(), m_comment);
if (isExtension) {
next = advance();
if (next == QLatin1String("null") || next == QLatin1String("record")) {
UMLClassifier *klass = static_cast<UMLClassifier*>(ns);
UMLClassifier *klass = ns->asUMLClassifier();
Import_Utils::createGeneralization(klass, parent);
if (next == QLatin1String("record")) {
// Set the m_klass for attributes.
......@@ -417,7 +417,7 @@ bool AdaImport::parseStmt()
QStringList::Iterator end(baseInterfaces.end());
for (QStringList::Iterator bi(baseInterfaces.begin()); bi != end; ++bi) {
ns = Import_Utils::createUMLObject(t, *bi, currentScope());
parent = static_cast<UMLClassifier*>(ns);
parent = ns->asUMLClassifier();