Bug 450196 - [C++ import] Type std::string is created multiple times
Summary: [C++ import] Type std::string is created multiple times
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: importer (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-14 06:35 UTC by Oliver Kellogg
Modified: 2022-02-14 08:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)


Attachments
umbrello_multiple_std-string_instances screenshot provided by Robert Hairgrove (179.23 KB, image/png)
2022-02-14 06:39 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
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