Book a Demo

Author Topic: how do i modyfi namespace genration in cpp  (Read 4547 times)

Martin Brndstatter

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
how do i modyfi namespace genration in cpp
« on: April 07, 2014, 10:56:17 pm »
hello,
When i genrate c++ code from diagram i get this code in cpp

using namespace0::namespace1::namespace2

i would like to have it more like this :

namespace0 {
  namesapce1 {
    namesapce2 {
...
}}}

I am sure it can be achived by modifying the templamlates somehow.
I tried to mess around the templates but i failed ...
Can you help me with this ?
Martin

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: how do i modyfi namespace genration in cpp
« Reply #1 on: April 08, 2014, 02:43:12 am »
Try changing C++ Code option. Tools-> Options-> Source Code Engineering -> C++ -> Generate Namespace

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: how do i modyfi namespace genration in cpp
« Reply #2 on: April 08, 2014, 08:43:11 am »
Tools | Source Code Generation  Templates.
Select C++ in the language.

Copy the Namespace [Body/Declaration] templates into the Namespace [Body/Declaration] Impl templates. Adding Impl to the templates each is calling.

Martin Brndstatter

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: how do i modyfi namespace genration in cpp
« Reply #3 on: April 10, 2014, 12:07:41 am »
ola,
I tried that and it works . Thanx for help .
but the
using namespace0::namespace1::namespace2
is still present in cpp . Can i get rid of that too ?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: how do i modyfi namespace genration in cpp
« Reply #4 on: April 10, 2014, 09:15:44 am »
I think it's generated from the Import Section Impl template. Unfortunately it looks like it's part of the fileHeaders macro. You can't define the contents of that directly, but you can list over imports and use classHeaders for the manually added ones. (I generally refer people to the PHP templates as an example of how this is done)