Bug 413569 - C++ Code Generation Wizard generates wrong 'string' include statement
Summary: C++ Code Generation Wizard generates wrong 'string' include statement
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: exporter (show other bugs)
Version: 2.29.0 (KDE Applications 19.08.0)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on: 414079
Blocks: 281170
  Show dependency treegraph
 
Reported: 2019-10-28 21:18 UTC by Carsten Behling
Modified: 2020-01-11 12:25 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.29.90 (KDE Applications 19.11.90)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Behling 2019-10-28 21:18:55 UTC
SUMMARY

When using 'Code Generation Wizard...' it generates this include statement in *.h file for a class

#include string

It rather must be:

#include <string>

'Generate All Code' instead works well

STEPS TO REPRODUCE
1. Add a new class 'Something' to class Diagramm
2. Generate Code for this class through 'Code'->'Code Generation Wizard...' with default settings unchanged.

OBSERVED RESULT

Something.h contains

#include string

EXPECTED RESULT

Something.h contains

#include <string>

REMARK

vector include may have the same problem.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Sam Dyer 2019-10-28 22:36:28 UTC
Could you please add the software and operating system versions that you are using.
Comment 2 Carsten Behling 2019-10-29 05:38:40 UTC
(In reply to Sam Dyer from comment #1)
> Could you please add the software and operating system versions that you are
> using.

SOFTWARE/OS VERSIONS
Windows:- 
macOS: -
Linux/KDE Plasma: Ubuntu 18.04.1 LTS [linux version 4.15.0-64-generic]
KDE Plasma Version: 
KDE Frameworks Version: 5.44.0
Qt Version: Qt 5.9.5 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.3.0) on "xcb"

ADDITIONAL INFORMATION

Not observed on Windows Platform.
Comment 3 Sam Dyer 2019-10-29 06:20:16 UTC
Thank you
Comment 4 Ralf Habacker 2019-10-29 07:53:13 UTC
I tried that with a build from git branch Applications/19.08, but was not able to reproduce that with default settings. I always get 

#include <string> 

in the header file. Please provide more information to reproduce this issue.

It may be that related attributes are in the umbrello application config file named "umbrellorc" and located in the path returned from kf5-config --path config.
Comment 5 Carsten Behling 2019-10-29 18:07:42 UTC
(In reply to Ralf Habacker from comment #4)
> I tried that with a build from git branch Applications/19.08, but was not
> able to reproduce that with default settings. I always get 
> 
> #include <string> 
> 
> in the header file. Please provide more information to reproduce this issue.
> 
> It may be that related attributes are in the umbrello application config
> file named "umbrellorc" and located in the path returned from kf5-config
> --path config.

behlingc@homedesk:~/projects$ cat /home/behlingc/.config/umbrellorc 
[Class Options]
defaultAttributeScope=Private

[Code Generation]
overwritePolicy=Ok

[General Options]
Geometry=1853,920
autosavetime=5

[MainWindow]
Height 1015=960
Height 975=920
State=AAAA/wAAAAD9AAAAAgAAAAAAAADtAAADG/wCAAAAAvwAAABgAAABdwAAAHYBAAAc+gAAAAACAAAAA/sAAAAYAFQAcgBlAGUAVgBpAGUAdwBEAG8AYwBrAQAAAAD/////AAAAWQD////7AAAAIgBTAHQAZQByAGUAbwB0AHkAcABlAHMAVwBpAG4AZABvAHcBAAAAAP////8AAABZAP////sAAAAcAEQAaQBhAGcAcgBhAG0AcwBXAGkAbgBkAG8AdwEAAAAA/////wAAAFkA/////AAAAd0AAAGeAAAAkgEAABz6AAAAAAIAAAAE+wAAACIARABvAGMAdQBtAGUAbgB0AGEAdABpAG8AbgBEAG8AYwBrAQAAAAD/////AAAAdQD////7AAAAHABDAG0AZABIAGkAcwB0AG8AcgB5AEQAbwBjAGsBAAAAAP////8AAABZAP////sAAAAOAEwAbwBnAEQAbwBjAGsBAAAAAP////8AAABZAP////sAAAASAEQAZQBiAHUAZwBEAG8AYwBrAQAAAAD/////AAAAWQD///8AAAABAAABCQAAAxv8AgAAAAL7AAAAGABCAGkAcgBkAFYAaQBlAHcARABvAGMAawEAAABgAAABxgAAAFkA////+wAAABYAVwBlAGwAYwBvAG0AZQBEAG8AYwBrAQAAAiwAAAFPAAAAEwD///8AAAU7AAADGwAAAAQAAAAEAAAACAAAAAj8AAAAAgAAAAIAAAABAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAAAAAAIAAAABAAAAFgB3AG8AcgBrAHQAbwBvAGwAYgBhAHIBAAAAAP////8AAAAAAAAAAA==
ToolBarsMovable=Disabled
Width 1920=1853
Window-Maximized 1015x1920=true
Window-Maximized 975x1920=true

[MainWindow][Toolbar worktoolbar]
ToolButtonStyle=IconOnly

[Recent Files]
File1[$e]=$HOME/projects/BSSim/umbrellogen
Name1[$e]=umbrellogen

[UI Options]
fillColor=255,255,192
gridDotColor=247,245,243

[workbar]
ToolButtonStyle=IconOnly
Comment 6 Carsten Behling 2019-10-29 18:13:13 UTC
(In reply to Ralf Habacker from comment #4)
> I tried that with a build from git branch Applications/19.08, but was not
> able to reproduce that with default settings. I always get 
> 
> #include <string> 
> 
> in the header file. Please provide more information to reproduce this issue.
> 
> It may be that related attributes are in the umbrello application config
> file named "umbrellorc" and located in the path returned from kf5-config
> --path config.

Not sure if you overlooked that small info that this only happens through
'Code->Code Generation Wizard...'. With 'Code->Generate All Code' it woks well.
Comment 7 Ralf Habacker 2019-11-09 23:03:41 UTC
(In reply to Carsten Behling from comment #6)
> Not sure if you overlooked that small info that this only happens through
> 'Code->Code Generation Wizard...'. With 'Code->Generate All Code' it woks
> well.
It looks that the <string> include is added uncoditional. See 
https://cgit.kde.org/umbrello.git/tree/umbrello/codegenerators/cpp/cppwriter.cpp?h=Applications/19.08#n349 for details
Comment 8 Ralf Habacker 2019-11-16 13:21:40 UTC
Git commit ccb62d3128a5ca6dd3edf7b4c5bad565bbac3758 by Ralf Habacker.
Committed on 16/11/2019 at 13:14.
Pushed by habacker into branch 'release/19.12'.

Fix of string includes in c++ code generator

Since the types used are collected in writeClassDecl(), it is necessary
to determine the required includes afterwards.
FIXED-IN:2.29.90 (KDE Release 19.11.90)

M  +33   -14   umbrello/codegenerators/cpp/cppwriter.cpp
M  +2    -2    umbrello/codegenerators/cpp/cppwriter.h

https://commits.kde.org/umbrello/ccb62d3128a5ca6dd3edf7b4c5bad565bbac3758