[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Jan 31 10:41:14 UTC 2005
CVS commit by okellogg:
Put scope qualified datatypes in the global scope.
This removes another occasion of gratuitous prompting for a type name.
CCBUG:93298
M +3 -6 classimport.cpp 1.67
M +15 -1 model_utils.cpp 1.19
--- kdesdk/umbrello/umbrello/classimport.cpp #1.66:1.67
@@ -116,5 +116,6 @@ UMLObject *ClassImport::createUMLObject(
parentPkg = static_cast<UMLPackage*>(o);
}
- name.remove(QRegExp("^.*::")); // may also zap "const "
+ // All scope qualified datatypes live in the global scope.
+ m_putAtGlobalScope = true;
}
Uml::Object_Type t = type;
@@ -125,13 +126,9 @@ UMLObject *ClassImport::createUMLObject(
if (isConst || isPointer || isRef) {
// Create the full given type (including adornments.)
- if (isPointer || isRef) {
- type = Uml::ot_Datatype;
- } else if (type == Uml::ot_UMLObject)
- type = Uml::ot_Class;
if (isConst)
name.prepend("const ");
if (m_putAtGlobalScope)
parentPkg = NULL;
- o = m_umldoc->createUMLObject(type, name, parentPkg);
+ o = m_umldoc->createUMLObject(Uml::ot_Datatype, name);
UMLDatatype *dt = static_cast<UMLDatatype*>(o);
UMLClassifier *c = dynamic_cast<UMLClassifier*>(origType);
--- kdesdk/umbrello/umbrello/model_utils.cpp #1.18:1.19
@@ -98,7 +98,21 @@ UMLObject* findUMLObject(UMLObjectList i
Uml::Object_Type type /* = ot_UMLObject */,
UMLObject *currentObj /* = NULL */) {
- QStringList components = QStringList::split("::", name);
+ QStringList components;
+ if (name.contains("::"))
+ components = QStringList::split("::", name);
+ else if (name.contains("."))
+ components = QStringList::split(".", name);
QString nameWithoutFirstPrefix;
if (components.size() > 1) {
+ if (name.contains(QRegExp("[^\\w:\\.]"))) {
+ // It's obviously a datatype.
+ // Scope qualified datatypes live in the global scope.
+ for (UMLObjectListIt oit(inList); oit.current(); ++oit) {
+ UMLObject *obj = oit.current();
+ if (obj->getName() == name)
+ return obj;
+ }
+ return NULL;
+ }
name = components.front();
components.pop_front();
More information about the umbrello-devel
mailing list