[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-core-dev] Manipulate Include statements in C++ source file
|
Title: Manipulate Include statements in C++ source file
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