Request: smart-pointers smart auto completion
-
- CodeLite Enthusiast
- Posts: 12
- Joined: Sat Dec 20, 2008 3:01 am
- Contact:
Request: smart-pointers smart auto completion
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.
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.
- 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
I believe that you did not test it with shared_ptr, since it is already working for boost shared_ptrasterisc 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.
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 12
- Joined: Sat Dec 20, 2008 3:01 am
- Contact:
Re: Request: smart-pointers smart auto completion
I only tested it with auto_ptr. Not working for me.
- 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
What is not working for you? std::auto_ptr or boost::shared_ptr?
See screen shot.
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
-
- CodeLite Veteran
- Posts: 69
- Joined: Fri Oct 24, 2008 10:29 pm
- Contact:
Re: Request: smart-pointers smart auto completion
One difference I see in the respective header files: Boost uses a standard namespace declaration:
But the declaration of auto_ptr is wrapped in a namespace macro:
Also, there is an explicit template specialization for type void in the same file:
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
Code: Select all
namespace boost {
template <class T> class shared_ptr ...
}
Code: Select all
_GLIBCXX_BEGIN_NAMESPACE(std)
template <typename _Tp> class auto_ptr ...
_GLIBCXX_END_NAMESPACE
Code: Select all
template <> class auto_ptr<void> ...
Eran, does ctags_le handle template specializations correctly?
Scott
- 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
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:
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
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
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
-
- CodeLite Enthusiast
- Posts: 12
- Joined: Sat Dec 20, 2008 3:01 am
- Contact:
Re: Request: smart-pointers smart auto completion
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!
You do a very good job and you guys are very responsive! Keep up the good work!
-
- CodeLite Enthusiast
- Posts: 12
- Joined: Sat Dec 20, 2008 3:01 am
- Contact:
Re: Request: smart-pointers smart auto completion
Not smart-pointer related, but auto-completion isn't working for iterators.
Example:
I'm using Kubuntu 8.10 and CL 1.0.2527, downloaded from the CL website.
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
}
- 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
Yes, the entire STL library is problematic for parsing. Dont expect any solution in the near future
Eran
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 12
- Joined: Sat Dec 20, 2008 3:01 am
- Contact:
Re: Request: smart-pointers smart auto completion
Sorry to announce, but auto-completion isn't working in this case as well:
using CodeLite Revision 2527, for Windows, this time.
Code: Select all
class C
{
public:
void foo() {}
};
nt main()
{
typedef C D;
D c;
c. //< nothing is displayed
}