[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Jan 11 19:05:27 UTC 2007
SVN commit 622396 by okellogg:
parseStmt(): Support subtypes.
M +23 -4 adaimport.cpp
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/adaimport.cpp #622395:622396
@@ -21,10 +21,12 @@
#include "../uml.h"
#include "../umldoc.h"
#include "../package.h"
+#include "../folder.h"
#include "../classifier.h"
#include "../enum.h"
#include "../operation.h"
#include "../attribute.h"
+#include "../association.h"
AdaImport::AdaImport() : NativeImportBase("--") {
initVars();
@@ -120,6 +122,7 @@
QString AdaImport::expand(const QString& name) {
QRegExp pfxRegExp("^(\\w+)\\.");
+ pfxRegExp.setCaseSensitive(false);
int pos = pfxRegExp.search(name);
if (pos == -1)
return name;
@@ -206,6 +209,26 @@
}
return true;
}
+ if (keyword == "subtype") {
+ QString name = advance();
+ advance(); // "is"
+ QString base = expand(advance());
+ UMLDoc *umldoc = UMLApp::app()->getDocument();
+ UMLObject *type = umldoc->findUMLObject(base, Uml::ot_UMLObject, m_scope[m_scopeIndex]);
+ if (type == NULL) {
+ type = Import_Utils::createUMLObject(Uml::ot_Class, base, m_scope[m_scopeIndex]);
+ }
+ UMLObject *subtype = Import_Utils::createUMLObject(type->getBaseType(), name,
+ m_scope[m_scopeIndex], m_comment);
+ UMLAssociation *assoc = new UMLAssociation(Uml::at_Dependency, subtype, type);
+ assoc->setUMLPackage(umldoc->getRootFolder(Uml::mt_Logical));
+ assoc->setStereotype("subtype");
+ // Work around missing display of stereotype in AssociationWidget:
+ assoc->setName(assoc->getStereotype(true));
+ umldoc->addAssociation(assoc);
+ skipStmt();
+ return true;
+ }
if (keyword == "type") {
QString name = advance();
if (advance() == "(") {
@@ -444,10 +467,6 @@
false, isAbstract, false, false, m_comment);
return true;
}
- if (keyword == "subtype") { // FIXMEnow: potentially important but not yet implemented
- skipStmt();
- return true;
- }
if (keyword == "task" || keyword == "protected") {
// Can task and protected objects/types be mapped to UML?
bool isType = false;
More information about the umbrello-devel
mailing list