CodeModel result for a class Function definition

David Nolden david.nolden.kdevelop at art-master.de
Wed Mar 18 20:21:27 UTC 2009


Am Mittwoch 18 März 2009 19:47:46 schrieb Lior Mualem:
> Hi,
> While I tried to get list of declarations for a .cpp file from the
> CodeModel, it returns declarations for both class functions and global
> functions.
>
> Consider this cpp file:
> -----------
> void TestClass::TestFunc(int a, int b)
> {
> }
>
> void GlobalTestFunction(int a, int b)
> {
> }
> -----------
>
> It's fine that I get the declaration both declarations but I can't really
> tell from the CodeModel that "TestFunc" belongs to a class.
> What I use to distinguish identifiers relation is by using the
> QualifiedIdentifier class.
> For the "TestFunc" function, the .count() returns 1, it doesn't give me the
> depth for TestClass.
>
> Is that what is supposed to be or is it a bug?

It is supposed to be like that, since the class is not within a scope. 
Actually it is only supposed to be like that because there is no other 
elegemtn way atm. to represent this.

Do you really need alone the code-model to distinguish this? After all, such a 
declaration is always declared within the actuall class as well, so you don't 
need to care about it for showing the correct hierarchy.

To jump between function-definition and -declaration, the functions within 
KDevelop::FunctionDefinition can be used.

Greetings, David





More information about the KDevelop-devel mailing list