CodeModel result for a class Function definition

Lior Mualem lior.m.kde at gmail.com
Wed Mar 18 22:30:17 UTC 2009


On Wed, Mar 18, 2009 at 10:21 PM, David Nolden <
david.nolden.kdevelop at art-master.de> wrote:

> 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.
>
Why is it supposed to be like that? I mean the class is not within a scope
but the class function IS within a scope, logically (the class scope)
because the global function is not within a scope - the global scope.
The same rule that applies for the class function when it's defined in the
header, should also apply here, in my opinion (meaning that it should be
scoped by the class).


> 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.
>
My problem is not really the class function - I don't care about that.
I care about the global function, I have no way to access it so it needs to
appear on the root node in the tree. The problem is that I keep getting the
class function also in the root node because I can't distinguish between the
global functions and the class function and I don't want to go through much
overhead to filter out the class functions because in a normal project it
should constitute for about 90% of the functions in the project.


>
> To jump between function-definition and -declaration, the functions within
> KDevelop::FunctionDefinition can be used.
>
As I explained above - I don't care much about the class function, but it's
good to know ;)


>
> Greetings, David
>

Thanks,
Lior
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090319/00f6dabb/attachment.html>


More information about the KDevelop-devel mailing list