Book a Demo

Author Topic: C++ code generation and roundtrip engineering  (Read 4594 times)

stegeto22

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
C++ code generation and roundtrip engineering
« on: February 22, 2006, 06:50:38 am »
Hi,

I've defined this class:

Code: [Select]

class MyClass
{
public:

typedef int tMyType;

void MyFunction(tMyType myParam);
};


If I now reverse engineer this code to EA and then generate code from it again, the MyFunction has changed to this:
Code: [Select]

void MyFunction(MyClass::tMyType myParam);


Everytime I do these two steps I get another MyClass:: prefix:
Code: [Select]

void MyFunction(MyClass::MyClass::tMyType myParam);


But I don't want the 'MyClass::' prefix.
Is this the correct behavior? Could I prevent this somehow?

Thanks
« Last Edit: February 22, 2006, 07:42:06 am by stegeto22 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #1 on: February 22, 2006, 01:10:06 pm »
This is a bug that we're currently in the process of fixing.

The only work around that I know of is removing the namespace qualifier code from the code templates.

You can do this yourself by replacing the following in the Attribute Declaration template, and similar changes in the Linked Attribute Declaration, Linked Class Base, Operation Declaration and Parameter templates.

Code: [Select]
$type=%attQualType? value : "int"%
$type=%REPLACE($type,".","::")%
$qualType=%packagePath% + "::" + %attType%
%if genOptCPPGenNamespace == "T" and $type == $qualType%
$type=%attType%
%endIf%
$type

Code: [Select]
%attType=="" ? "int" : value%
Or, you can send an email in to Sparx support briefly mentioning the problem and asking for the templates to fix it and I can email you a file to import into EA.

stegeto22

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #2 on: March 10, 2006, 01:02:38 am »
I have tried it now with the new build 788 again. But the problem is going worse.

Code: [Select]

class MyClass
{
public:
void MyFunction(tMyType myParam);
typedef int tMyType;
};


I reverse engineer this code to EA and generate code from it. But now I get this output:

Code: [Select]

class MyClass
{
public:
void MyFunction(tMyType myParam);

Attribute VB_Name = "tMyType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" , "Yes"
Attribute VB_Ext_KEY = "Top_Level" , "Yes"
Option Explicit
};


What's going wrong?

Thanks
« Last Edit: March 10, 2006, 01:04:27 am by stegeto22 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #3 on: March 13, 2006, 04:46:54 pm »
EA appears to be trying to generate the type tMyType as Visual Basic.

My current investigations suggest that it is only happening to inner classes on synchronisation.  If you generate the file from scratch it doesn't appear to be hapenning.

stegeto22

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #4 on: March 13, 2006, 11:12:31 pm »
That's right, when I generate it the first time from scratch, it's ok. But once I synchronize it, it'll be generated as Visual Basic.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #5 on: March 14, 2006, 01:09:29 pm »
This problem should be fixed in our next patch release.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #6 on: March 15, 2006, 01:04:20 am »
VB instead of C++ ?
Yikes ! Let's hope it doesn't start generating Michael Jackson JSP structure diagrams instead of UML !

SnowMan

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #7 on: April 07, 2006, 02:07:40 am »
Is this problem resolved in 4th Apr version of Sparx EA?..

stegeto22

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: C++ code generation and roundtrip engineering
« Reply #8 on: April 07, 2006, 09:29:09 am »
Yes, it's fixed now.