c++ header generation

c++ header generation

Postby Dan » Wed 23 May 2018 13:40

Hi all,

Is there anyway to prevent code generation placing an extra blank line between class members ?

I've looked in the edit generation settings panel and cannot see any setting.

Maybe its something to do with the ${definition} in c++[1] ?

For example I get this:

Code: Select all
 private:
    int m_code;

    int m_value;

    int m_called;

    Test2 m_test2;


But want this:

Code: Select all
 private:
    int m_code;
    int m_value;
    int m_called;
    Test2 m_test2;


Thanks.
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England

Re: c++ header generation

Postby Bruno Pagès » Wed 23 May 2018 14:57

Hello,

The code generation replaces the keywords by their values and writes the other characters unchanged.

If you edit your attributes/relations/operations and look at their definition in the C++ tab you will see that their C++ declarations ends by a line break, so the code generation produces that line break, then generates a final line break to end the declaration => you have a blank line after each member declaration. To remove the blank line just remove the line break at the end of the declarations, and of course remove it also into the default attribute/relation/operation declarations in the generation setting to have that behavior for the future members.

I put that extra line break in the default declarations because a priori a member is commented and is more readable to have that extra blank line between the blocks comment+declaration
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 585
Joined: Mon 20 Feb 2012 09:23
Location: France

Re: c++ header generation

Postby Dan » Wed 23 May 2018 15:43

I removed all extra lines in any of the generation settings panel but there was still a line.

New attributes do not have the extra line any more.

But I also had to remove extra lines in the attribute generation panel - removed these and now ok.

Thanks.
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England

Re: c++ header generation

Postby Bruno Pagès » Wed 23 May 2018 15:52

The generation settings give the default definition for the element you will create.

When you modify the generation settings the already existing elements are unchanged, hopefully, else you will have to go on all of them to check/modify their definitions :?

Anyway you may want to adapt the definition of the already existing elements to follow your new generation rules, or for any other reasons, to help I made the "plug-out" global change
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 585
Joined: Mon 20 Feb 2012 09:23
Location: France

Re: c++ header generation

Postby Dan » Wed 23 May 2018 16:01

Good grief - don't throw more stuff at me to look at ... ;)
Dan
 
Posts: 33
Joined: Sat 12 May 2018 13:55
Location: England


Return to Examples - How to do / Exemples - Comment faire

Who is online

Users browsing this forum: No registered users and 1 guest

cron