IBM Support

How to remove the Includes of user defined Header file in Rational Rhapsody

Question & Answer


Question

How do you remove Header file Includes which are generated for Files in IBM Rational Rhapsody using a post processing script?

Cause

You would like to remove the user defined header files which are included automatically for Files in Rational Rhapsody. The property C_CG::Class::GenerateIncludeForHeaderFile works only for classes and not for Files

Answer

Use the following C++ post processing script to remove the Header Includes of Files in Rational Rhapsody in C:

Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.




#import "<Rhapsody Install Path>\rhapsody.tlb" raw_interfaces_only, no_namespace, named_guids

#include "stdio.h"

#include <atlbase.h>

#include <string>

#include <conio.h>

#include <iostream>

#include <fstream>

using namespace std;

static void process( const char* filename ) {

string lineString, fileString, descString;

int found;

fstream in( filename );

if ( !in ) {

cout << filename << " does not exist!" << endl;

} else {

while ( getline(in, lineString,'\n')) {

if( lineString.substr(0,10) == "#include \"" )

{

getline(in, lineString, '\n');

}

fileString += lineString + '\n';

}

in.close();

ofstream out(filename, ios::ate );

out.seekp(ios::beg);

out << fileString;

out.close();

}

}

int main(int argc, char* argv[]) {

char fileName[80];

if ( argc > 1 ) {

strcpy (fileName, argv[1] );

process(fileName);

} else {

printf ("Missing arguments\n");

}

return 0;

}

You will need to convert the above code to an executable using any C++ IDE and use the same in the property CG::File::InvokePostProcessor.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.2;7.5.3;7.6;7.6.0.1;7.6.1;7.6.1.1;7.6.1.2;7.6.1.3;8.0;8.0.1","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21635786