Sign in to follow this  

Is it possible to hide classes and variables from intelisense?

This topic is 2955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently making a win32 controls library and I have a couple of classes that have inherited classes which are only used within that class, which is of no relevant use to the user. I was wondering if it is possible to hide such classes and functions that are of no concern to the user? If not is there a way around it? Thanks Kelvin

Share this post


Link to post
Share on other sites
Intellisense works by examining your project's source. So the only things it will see on your end user's end are those that are exposed in the source you give to them, i.e., if you are providing a binary library and associated headers, only what appears in those headers.

Therefore, you can 'hide' things from the end user's Intellisense database by not exposing them at a source level in the first place. Use techniques like the pimpl idiom to keep things out of class definitions, and keep a careful eye on what is appearing in code you're shipping to your end user with your library.

However, consider the benefit you get for these efforts. It might be enough to simply not document these parts, or mark them "not documented, private use only".

EDIT: This is all assuming C(++). If you're using a .NET language, there are apparently attributes to hide things from Intellisense.

Share this post


Link to post
Share on other sites
Antheus in your example are you just not declaring a class in the private space of the class Visible?? If so how does that help? If you meant to declare an instance of the Hidden class in the class Visible.

eg

class Visible {

private:

class Hidden m_Hidden;

public:

};

It does not solve my problem because the user can still see that class instance as a private member I only want the relevant classes/functions to be shown. Like when you use STL you don't see any private functions or inherited functions that are of not relevance to you. I want to do the same thing.

Share this post


Link to post
Share on other sites
Quote:
Original post by nivlekio

It does not solve my problem because the user can still see that class instance as a private member I only want the relevant classes/functions to be shown. Like when you use STL you don't see any private functions or inherited functions that are of not relevance to you. I want to do the same thing.


Under 2008, I see all members, including private and inherited ones.

The reason for this has to do with naming convention - all non-public, non-STL members are prefixed with _, so they are placed at the end of the list.

Share this post


Link to post
Share on other sites
When you are done editing that code create some macros with #define that will generate the code. The Visual Studio c++ intelisense is really stupid and on most cases is unable to understand that code. Also it has a really hart time understanding templates. You may create a combination of those 2 in order to stop intelisense from working anymore.


Raxvan

Share this post


Link to post
Share on other sites
Quote:
Original post by Makaan
When you are done editing that code create some macros with #define that will generate the code. The Visual Studio c++ intelisense is really stupid and on most cases is unable to understand that code. Also it has a really hart time understanding templates. You may create a combination of those 2 in order to stop intelisense from working anymore.

Please don't abuse macros to confuse intellisense. This at the least assumes intellisense won't improve. Another issues is macro abuse is annoying and can create weird errors that are time consuming to solve. Just my two cents.

Share this post


Link to post
Share on other sites
Quote:
Original post by nobodynews
Quote:
Original post by Makaan
When you are done editing that code create some macros with #define that will generate the code. The Visual Studio c++ intelisense is really stupid and on most cases is unable to understand that code. Also it has a really hart time understanding templates. You may create a combination of those 2 in order to stop intelisense from working anymore.

Please don't abuse macros to confuse intellisense. This at the least assumes intellisense won't improve. Another issues is macro abuse is annoying and can create weird errors that are time consuming to solve. Just my two cents.
In my experience Visual Studio 2010 Beta 2's C++ Intellisense does tremendously well in understanding both macros and templates, including STL and several different smart pointer libraries, so abusing macros and templates to disable Intellisense will only lead to pain in the future.

Share this post


Link to post
Share on other sites

This topic is 2955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this