Commit 3bf9ace7 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Fix 'c++ methods are not imported if class is defined outside name space'

FIXED-IN:2.23.0 (KDE Applications 17.08.0)
BUG:383445
parent 3c02b21f
......@@ -189,7 +189,7 @@ UMLObject *createUMLObject(UMLObject::ObjectType type,
DEBUG(DBG_SRC) << "Import_Utils::createUMLObject(" << name
<< "): Association as parent package is not supported yet, using Logical View";
parentPkg = logicalView;
} else if (name.startsWith(QLatin1String("::"))) {
} else if (name.startsWith(UMLApp::app()->activeLanguageScopeSeparator())) {
name = name.mid(2);
parentPkg = logicalView;
}
......@@ -219,15 +219,14 @@ UMLObject *createUMLObject(UMLObject::ObjectType type,
parentPkg = logicalView;
// Find, or create, the scopes.
QStringList components;
if (typeName.contains(QLatin1String("::"))) {
components = typeName.split(QLatin1String("::"), QString::SkipEmptyParts);
QString scopeSeparator = UMLApp::app()->activeLanguageScopeSeparator();
if (typeName.contains(scopeSeparator)) {
components = typeName.split(scopeSeparator, QString::SkipEmptyParts);
} else if (typeName.contains(QLatin1String("..."))) {
// Java variable length arguments
type = UMLObject::ot_Datatype;
parentPkg = umldoc->datatypeFolder();
isAdorned = false;
} else if (typeName.contains(QLatin1String("."))) {
components = typeName.split(QLatin1Char('.'));
}
if (components.count() > 1) {
typeName = components.back();
......
......@@ -394,9 +394,21 @@ void CppTree2Uml::parseClassSpecifier(ClassSpecifierAST* ast)
if (m_thread) {
m_thread->emitMessageToLog(QString(), QLatin1String("class ") + className);
}
if (!scopeOfName(ast->name(), QStringList()).isEmpty()){
uDebug() << "skip private class declarations";
return;
QStringList scope = scopeOfName(ast->name(), QStringList());
UMLObject *localParent = 0;
if (!scope.isEmpty()) {
localParent = m_doc->findUMLObject(scope.join(QLatin1String("::")),
UMLObject::ot_Class, m_currentNamespace[m_nsCnt]);
if (!localParent)
localParent = m_doc->findUMLObject(scope.join(QLatin1String("::")),
UMLObject::ot_Package, m_currentNamespace[m_nsCnt]);
if (!localParent) {
localParent = Import_Utils::createUMLObject(UMLObject::ot_Class, className,
m_currentNamespace[m_nsCnt],
ast->comment(), QString(), true);
localParent->setStereotype(QLatin1String("class-or-package"));
}
m_currentNamespace[++m_nsCnt] = localParent->asUMLPackage();
}
if (className.isEmpty()) {
......@@ -458,6 +470,8 @@ void CppTree2Uml::parseClassSpecifier(ClassSpecifierAST* ast)
m_currentAccess = oldAccess;
m_inSlots = oldInSlots;
m_inSignals = oldInSignals;
if (localParent)
m_currentNamespace[m_nsCnt--] = 0;
}
void CppTree2Uml::parseEnumSpecifier(EnumSpecifierAST* ast)
......
......@@ -163,15 +163,14 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
name.remove(QLatin1Char('&'));
}
#endif
if (name.contains(QLatin1String("::")))
components = name.split(QLatin1String("::"));
else if (name.contains(QLatin1Char('.')))
components = name.split(QLatin1Char('.'));
QString scopeSeparator = UMLApp::app()->activeLanguageScopeSeparator();
if (name.contains(scopeSeparator))
components = name.split(scopeSeparator);
QString nameWithoutFirstPrefix;
if (components.size() > 1) {
name = components.front();
components.pop_front();
nameWithoutFirstPrefix = components.join(QLatin1String("::"));
nameWithoutFirstPrefix = components.join(scopeSeparator);
}
if (currentObj) {
UMLPackage *pkg = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment