Book a Demo

Author Topic: generating code with full path information  (Read 3686 times)

ballukex

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
generating code with full path information
« on: February 13, 2009, 10:27:49 pm »
Hello,

I want to generate source code in C++. But I have problems with the statement include.
I miss the option to add the full file path information. For example:

Code: [Select]
#include "./code/main.h"
I get only the filename:

Code: [Select]
#include "main.h"
How can I handle it? I need help, please.


Thank you,
ballukex.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: generating code with full path information
« Reply #1 on: February 16, 2009, 08:17:06 am »
You can modify the code templates.  The following should give you a starting point.

Import Section Template
Code: [Select]
$imports = %classImports% + "\n"
$imports += %list="Import" @separator="\n" importFromAggregation=="T" or importFromAssociation=="T" or importFromAtt=="T" or importFromDependency=="T" or importFromGeneralization=="T" or importFromMeth=="T" or importFromParam=="T" or importFromRealization=="T"%
%REMOVE_DUPLICATES($imports, "\n")%

Import Template
Code: [Select]
$file = %importRelativeFilePath%
%if $file == ""%
$file = %importClassName ? value% + %genOptCPPHeaderExtension%
%endIf%
%if $file == "" or importInFile=="T" or $file==fileName%
%endTemplate%

#include %qt%$file%qt%

I hope that helps.

ballukex

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: generating code with full path information
« Reply #2 on: February 16, 2009, 09:17:28 pm »
Hello Simon,

thank you! That is it what I mean!


bye, ballukex.

bnils

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: generating code with full path information
« Reply #3 on: June 30, 2011, 07:24:32 pm »
Hi, looking for a similar thing but using a later version of EA (8.0.858).
I have the following:
PackageA::ClassA realizes PackageB::ClassB
ClassA.h contains:
Code: [Select]
#include "ClassB.h"When i actually want:
Code: [Select]
#include "PackageB/ClassB.h"How do I do this? The hint from Simon above may be obsolete becase the code templates have probably been modified since, now the "Import Section" and "Import Section Impl" templates only refers to "%fileImports%" and "%fileHeaders%".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: generating code with full path information
« Reply #4 on: July 11, 2011, 02:17:27 pm »
My hint is still current. Modify the templates as I said instead of using the macro that doesn't give you any control over what's generated.