Hi,
I felt a little disappointed about the C::B's code completion,
e.g.
typedef struct tagABC
{
int a;
int b;
} ABC;
and the completion won't find the ABC's members!
so does the OPENFILENAME ,PAINTSTRUCT.......
however,
e.g.
struct M
{
int a;
int b;
};
M m;
it finds the m's members immediately!
See this thread.
http://forums.next.codeblocks.org/index.php/topic,9225.msg65886.html#msg65886
I found this patch haven't applied.
Edit:
I investigate the source code in void ParserThread::HandleTypedef(), in parserthread.cpp. This file needs to be modified to parse C type typedef and struct correctly :D.
In the beginning, it has these comments.
void ParserThread::HandleTypedef()
{
// typedefs are handled as tkClass and we put the typedef'd type as the class's
// ancestor. this way, it will work through inheritance.
The typedef's type as the class's ancestor.
Here is my test code:
class Ancestor{
public:
int m_aaaa;
int m_bbbb;
};
class Child:public Ancestor {
public:
int m_cccc;
int m_dddd;
};
int main()
{
Child obj;
obj. // works ok! all the four members will be shown.
return 0;
}
See the screen shot below.
But the code below can't work.
typedef class Ancestor{
public:
int m_aaaa;
int m_bbbb;
} Parent;
//typedef class Ancestor Parent;
int main()
{
Parent obj;
obj. //Show nothing! works badly.
return 0;
}
If the Parent was treated as Ancestor's parents(said by the comments), I think the public member of Ancestor should be shown. So, it can't work though it's inheritance.
[attachment deleted by admin]
Quote from: ollydbg on March 14, 2009, 03:40:33 AM
See this thread.
http://forums.next.codeblocks.org/index.php/topic,9225.msg65886.html#msg65886
I found this patch haven't applied.
Edit:
I investigate the source code in void ParserThread::HandleTypedef(), in parserthread.cpp. This file needs to be modified to parse C type typedef and struct correctly :D.
THX a lot!
but,How to use the patch? [or install ,compile...whatever]
I'm just a beginner on C::B.
I'm examining the code.
In the parsethread.cpp line 1570, I enable the output to report a typedef token information.
Manager::Get()->GetLogManager()->DebugLog(F(_("Adding typedef: name '%s', ancestor: '%s'"), components.front().c_str(), ancestor.c_str()));
It seems that when I parse the code like this:
typedef class Ancestor{
public:
int m_aaaa;
int m_bbbb;
} Parent;
Then the output is like this:
Adding typedef: name 'Parent', ancestor: ''
Note that the ancestor is an empty string. This is the reason that code completion can't give the correct tooltips.
If the ancestor is string named "Ancestor", I think the code completion will work ok!
Edit: This has been confirmed, I just tested by assigning the ancestor = _T("Ancestor") , in the line 1564 of parsethread.cpp.
ancestor << typ;
ancestor = _T("Ancestor");
then, the tips can show correctly.
I'm trying to solve it, but all the codes are hard to understand(currently no document were supplied), so, it will take times, also, I will enrich the wiki page if I find the solution.
There is another issue: If I try to parse this code
class Ancestor{
public:
int m_aaaa;
int m_bbbb;
};
typedef class Ancestor Parent;
Then no typedef token was recognized. :(
Quote from: pingf on March 14, 2009, 02:02:56 PM
Quote from: ollydbg on March 14, 2009, 03:40:33 AM
See this thread.
http://forums.next.codeblocks.org/index.php/topic,9225.msg65886.html#msg65886
I found this patch haven't applied.
Edit:
I investigate the source code in void ParserThread::HandleTypedef(), in parserthread.cpp. This file needs to be modified to parse C type typedef and struct correctly :D.
THX a lot!
but,How to use the patch? [or install ,compile...whatever]
I'm just a beginner on C::B.
Apply a patch is something like you will build the code::blocks from it's source.
You can follow the wiki page
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Code::Blocks_sources
also, I have wrote a page in
http://wiki.codeblocks.org/index.php?title=Code_Completion_Design
Quote from: ollydbg on March 14, 2009, 02:20:31 PM
Quote from: pingf on March 14, 2009, 02:02:56 PM
Quote from: ollydbg on March 14, 2009, 03:40:33 AM
See this thread.
http://forums.next.codeblocks.org/index.php/topic,9225.msg65886.html#msg65886
I found this patch haven't applied.
Edit:
I investigate the source code in void ParserThread::HandleTypedef(), in parserthread.cpp. This file needs to be modified to parse C type typedef and struct correctly :D.
THX a lot!
but,How to use the patch? [or install ,compile...whatever]
I'm just a beginner on C::B.
Apply a path is something like you will build the code::blocks from it's source.
You can follow the wiki page
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Code::Blocks_sources
also, I have write a page in
http://wiki.codeblocks.org/index.php?title=Code_Completion_Design
WOW!
It seems a little tough for me now!
if I had enough time, I will try.
I try to solve this.
See this thread.
http://forums.next.codeblocks.org/index.php/topic,10241.msg70863.html#msg70863