Bug 450196

Summary: [C++ import] Type std::string is created multiple times
Product: [Applications] umbrello Reporter: Oliver Kellogg <okellogg>
Component: importerAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 2.33.80 (KDE releases 22.03.80)
Attachments: umbrello_multiple_std-string_instances screenshot provided by Robert Hairgrove

Description Oliver Kellogg 2022-02-14 06:35:39 UTC
SUMMARY
***
In the list view, on importing C++ multiple "string" are created in the "std" package.
***

STEPS TO REPRODUCE
1. Select Code -> Active Language -> C++
2. Import one or more files with multiple mentions of the type std::string, e.g. as attribute type or operation parameter type

OBSERVED RESULT
In the listview package "std" created by the import, multiple "string" appear.

EXPECTED RESULT
At most one "string" type shall be created.
Comment 1 Oliver Kellogg 2022-02-14 06:39:37 UTC
Created attachment 146699 [details]
umbrello_multiple_std-string_instances screenshot provided by Robert Hairgrove
Comment 2 Oliver Kellogg 2022-02-14 08:32:11 UTC
Git commit 7760dfff825a2a4643f6c7ea2f9d0f60e83969bf by Oliver Kellogg.
Committed on 14/02/2022 at 08:30.
Pushed by okellogg into branch 'master'.

Fix "[C++ import] Type std::string is created multiple times"

umbrello/codeimport/import_utils.{h,cpp}
- New function checkStdString takes a writable reference to QString
  as argument. If the variable passed in contains "std::string" it will
  be changed to "string".

umbrello/codeimport/import_utils.cpp
- In function createUMLObject :
  - Before attempting to find the UMLObject by name call
    checkStdString(name).
  - In the code handling nullptr return from first search,
    - remove `const' on definition of local isConst;
    - search `name' for "const" delimited at start and end by word
      boundary and remove the possible matched item;
    - apply checkStdString(typeName) before attempting to find the
      UMLObject by typeName;
    - before calling Object_Factory::createUMLObject fix condition for
      changing `t' from ot_UMLObject to ot_Class.
  - As a peripheral change, near start of function,
    - simplify handling of leading "::" in name;
    - handle Ada specific name prefix "Standard".
- At function addMethodParameter remove obsolete documentation.
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +39   -14   umbrello/codeimport/import_utils.cpp
M  +2    -0    umbrello/codeimport/import_utils.h

https://invent.kde.org/sdk/umbrello/commit/7760dfff825a2a4643f6c7ea2f9d0f60e83969bf