Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] How to find binding definition

You should limit your index to the project of interest, then the other 
projects will not be searched. (IIndexManager.getIndex(ICProject))

Markus.

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sanjesh R Nair
> Sent: Friday, November 07, 2008 5:14 AM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] How to find binding definition
> Importance: Low
> 
> 
> Hi All,
> 
>       How can we find the definition of a given binding?
> 
>       Say, I have a class like below:
>       #include "Class2.h"
>       class Class1 {
>             private:
>                   Class2 attribute1;
>       };
> 
> And Class2 is declared in a different project. I have the 
> ASTTranslationUnit of this file, which I am processing and 
> find the attribute with type Class2(a binding). I need to 
> identify the file containing the declaration of this binding 
> type. How can I achieve this programmatically?
> 
> One of the ways I found that can be used was to get the 
> index(IIndex) of the project containing Class1 and then 
> finding the binding with it by calling:
>       index.findDefinitions(binding);
> 
> This method returns me back an array of IndexName. This is 
> fine if there is only one definition for the given binding. 
> But if there are multiple definitions(say, there is a class 
> named Class2 declared in a third project as well) then this 
> method would return multiple IndexNames. In this, scenario 
> how can I identify the correct definition referenced in the project?
> 
> Is there any other way to get the definition? Right now I 
> just want to find the file containing the referenced 
> definition. I am using CDT 5.0.
> 
> Thanks,
> Sanjesh.
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top