Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] question about ASTRewrite

You can do something like ASTNodeFactoryFactory.getDefaultCPPNodeFactory().newCompositeTypeSpecifier(...). In order to override any of the methods you would have to provide your own implementation of ICPPASTCompositeTypeSpecifier.

-sergey


On Wed, Jul 10, 2013 at 11:57 AM, Ayupov, Andrey <andrey.ayupov@xxxxxxxxx> wrote:

Hi there,

 

I am trying to assess the Eclipse CDT features in the area of code refactoring and have a naïve question about how to deal with ASTRewrite (sorry if the questions was answered at some point, and I could not find it).

 

In order to do a change in the AST, e.g. to insert an IASTNode (e.g. using ASTRewrite.insertBefore method), I need to create that ASTNode first.

For example, if I am interested in creating a new node of type ICPPASTCompositeTypeSpecifier, how do I create it?

 

There’s an internal non-interface class CPPASTCompositeTypeSpecifier that I can instantiate, but Eclipse is saying it is not recommended to use it. Also, I am not sure if it will allow me to override some of its methods.

 

Another option is to create my custom class and implement ICPPASTCompositeTypeSpecifier interface, however, it seems like it an overkill to implement all the virtual methods of ICPPASTCompositeTypeSpecifier and others interface classes that it extends.

 

So what is the best option you would recommend?

 

Thanks,

Andrey

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top