Book a Demo

Author Topic: C++ Code Engineering - %packagePath% wrong?  (Read 3802 times)

austin_hastings

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
C++ Code Engineering - %packagePath% wrong?
« on: August 24, 2010, 07:02:31 am »
Using 855 - Unicode.

I've got a test class created inside a hierarchy like:

Model
+ VM (view)
-- + Bronze (package)
------ + Memory (package)
--------- Memory(diagram)
--------- Arena (class object)

With VM tagged as "Namespace Root", and with Bronze and Memory both tagged as Language=C++.

Arena, the class, is tagged Language=C++.

I made a change to the C++ File template to include the %packagePath% macro, but the value I get is "Bronze".

I expected to see "Bronze.Memory".

The source code generates the namespace blocks correctly - that is, the contents of the file are

namespace Bronze {
namespace Memory {
class Arena {...};
}
}

So why is the packagePath wrong? Alternatively, what setting have I overlooked to get this to come out right?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ Code Engineering - %packagePath% wrong?
« Reply #1 on: August 24, 2010, 11:09:14 am »
The packagePath macro is the path for the current package that is in scope.  From the File template you will either get the top level package or an empty string.

austin_hastings

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: C++ Code Engineering - %packagePath% wrong?
« Reply #2 on: August 24, 2010, 08:07:40 pm »
Thanks for the info. This kind of thing doesn't appear to be documented in the EA help, but is there a list of what variables/macros take on meaningful values in what contexts?

Anyway, I've written this recursive macro:
Code: [Select]
%if packagePath == "" %
%endTemplate%
/%packageName%%list="Namespace__ExpNamespacePath"%
which is called as:
Code: [Select]
$path = %list="Namespace__ExpNamespacePath" @separator="<error in NamespacePath macro>"%

Which appears to be giving me what I want - that is "/Bronze/Memory"

Is there a way to return a list datatype, or to get access to the @separator value from within my macro, so I could generate the correct delimiter between the path elements?

Thanks,

=Austin