Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-core-dev] Manipulate Include statements in C++ source file

Hmm, for me it sounds not to be wrong including a file more than once in
C/C++! Java might be unhappy about this, but in C/C++ there is nothing wrong
about this. I'd say, for this case you should check yourself if the include
is already there and put it again into the file or not.

e.g. some settings for locator pragma options could be configured in
separate header files, using some special defines for each function/variable
to set up the code area, near/far jumps, near/far data, section renaming
etc.



> --- Ursprüngliche Nachricht ---
> Von: "Veenu Verma (AS/EAB)" <veenu.verma@xxxxxxxxxxxx>
> An: <cdt-core-dev@xxxxxxxxxxx>
> Betreff: [cdt-core-dev] Manipulate Include statements in C++ source file
> Datum: Fri, 5 May 2006 10:16:37 +0200
> 
> 
> Hello
> I am manipulating include statements in a C++ source file using CDT
> API's
> and am facing some problems
> 
> I am doing something like this....
> 
> ICElement cFile = CoreModel.getDefault().create(currentFile);  // Where
> currentFile is c++ source file
> ITranslationUnit trUnit = (ITranslationUnit) cFile;
> trUnit.createInclude(includeSt, true, null, new NullProgressMonitor());
> 
> But I have noticed 3 problems...
> 1. CDT doesn't check for duplication and add the include even if it
> already
> exists.
> 
> 2 .Also, I see that it doesn't add new line character before the include
> statement.
> Include statement is added next to an existing include statement
> Like #include <abc.hh>#include <abc.hh>
> 
> 3. Currently, CDT adds the first include statement at the end of the
> source
> File, if sibling argument is null in createInclude(....)
> I want CDT to add the statement at the beginning of the file. How can i
> achieve that ?
> 
> I have done the same thing in JDT and it behaves in a normal way
> 1. It checks for duplication.
> 2. Add imports in a new line.
> 3. Add import as a first statement even if import statement or package
> statements are not there
> 
> The difference is that JDT uses ASTRewrite. 
> 
> I am using Eclipse 3.1.2 and CDT 3.0.0
> 
> Can someone help me and confirm if there is a bug or all the points are
> solvable by some means ?
> 
> Regards
> Veenu
> 
> 
> 

-- 
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl


Back to the top