Request: smart-pointers smart auto completion

General questions regarding the usage of CodeLite
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Request: smart-pointers smart auto completion

Post by asterisc »

Hey guys, I just took a look at this CodeLite IDE, and I'm very happy to see how it works. However, I found a thing I wish CodeLite should have, smart pointers smart auto-complete.
Take a look at this brief example:

class A
{
public:
void print() {}
};

auto_ptr<A> spA( new A );
spA. <-- should display auto_ptr methods, like it does today
spA-> <-- should display the things in class A

Same for boost::shared_ptr...
Maybe a rule is to check if it has the "operator->" overloaded, and if it has, check if it returns a pointer and if it does, display the pointer's things.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Request: smart-pointers smart auto completion

Post by eranif »

asterisc wrote:Same for boost::shared_ptr...
Maybe a rule is to check if it has the "operator->" overloaded, and if it has, check if it returns a pointer and if it does, display the pointer's things.
I believe that you did not test it with shared_ptr, since it is already working for boost shared_ptr

Eran
Make sure you have read the HOW TO POST thread
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Re: Request: smart-pointers smart auto completion

Post by asterisc »

I only tested it with auto_ptr. Not working for me.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Request: smart-pointers smart auto completion

Post by eranif »

What is not working for you? std::auto_ptr or boost::shared_ptr?

See screen shot.
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
sdolim
CodeLite Veteran
Posts: 69
Joined: Fri Oct 24, 2008 10:29 pm
Contact:

Re: Request: smart-pointers smart auto completion

Post by sdolim »

One difference I see in the respective header files: Boost uses a standard namespace declaration:

Code: Select all

namespace boost {
    template <class T> class shared_ptr ...
}
But the declaration of auto_ptr is wrapped in a namespace macro:

Code: Select all

_GLIBCXX_BEGIN_NAMESPACE(std)

template <typename _Tp> class auto_ptr ...

_GLIBCXX_END_NAMESPACE
Also, there is an explicit template specialization for type void in the same file:

Code: Select all

template <> class auto_ptr<void> ...
Boost does not have this, since it uses a separate traits class, which does have specializations.

Eran, does ctags_le handle template specializations correctly?

Scott
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Request: smart-pointers smart auto completion

Post by eranif »

Hi Scott,

If you open the pre-processor list (settings -> tags settings -> advanced tab -> preprocessors), you will see that I entered an entire section to handle STL oddities:

Code: Select all

_GLIBCXX_BEGIN_NAMESPACE(std)=namespace std{
_GLIBCXX_END_NAMESPACE=}
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)=namespace std{
_GLIBCXX_END_NESTED_NAMESPACE=}
_GLIBCXX_STD=std
These replacements are preformed inline by ctags-le (NOT supported by regular ctags), so when the yacc parser tries to parse the text, it sees standard namespace declaration.
BTW: without this, typing std:: would have fail (for STL 4.2 and up I think)

I will need to check deeper about auto_ptr
Eran
Make sure you have read the HOW TO POST thread
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Re: Request: smart-pointers smart auto completion

Post by asterisc »

I only tested std::auto_ptr which isn't currently working. I assumed shared_ptr isn't working as well, but I was wrong.
You do a very good job and you guys are very responsive! Keep up the good work!
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Re: Request: smart-pointers smart auto completion

Post by asterisc »

Not smart-pointer related, but auto-completion isn't working for iterators.
Example:

Code: Select all

class C
{
public:
    void foo() const {}
};

int main()
{
    vector<C> c_vec;
    for( vector<C>::const_iterator it = c_vec.begin(); it != c_vec.end(); ++it )
        it->... //< nothing is shown
}
I'm using Kubuntu 8.10 and CL 1.0.2527, downloaded from the CL website.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Request: smart-pointers smart auto completion

Post by eranif »

Yes, the entire STL library is problematic for parsing. Dont expect any solution in the near future

Eran
Make sure you have read the HOW TO POST thread
asterisc
CodeLite Enthusiast
Posts: 12
Joined: Sat Dec 20, 2008 3:01 am
Contact:

Re: Request: smart-pointers smart auto completion

Post by asterisc »

Sorry to announce, but auto-completion isn't working in this case as well:

Code: Select all

class C
{
public:
	void foo() {}
};

nt main()
{
	typedef C D;
	D c;
	c.    //< nothing is displayed
}
using CodeLite Revision 2527, for Windows, this time.
Post Reply