Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comment pop-up windows for C++ (Visual Studio), similar to Eclipse and Javadoc

In my years at college I've learned to program Java, which I did in Eclipse. I loved the feature in Eclipse on how Javadoc comments were able to pop-up in a window. At the moment I'm programming C++ and I'm really starting to miss this feature.

That's why I'm asking: is there a plug-in of something that acchieves the same result. Currently I am programming c++ with Visual Studio Express 2010, that does not have anything like this except for showing a function interface in the auto completion window. I would like to read more info such as reading up on pre- and postconditions for example, either for code from existing libraries (if they exist) or otherwise only for code I wrote myself.

Now I know of Doxygen, but that it not really what I'm looking for. It is a good enough fall back mechanism, but I really like to have it readily available from the same window I'm writing my code in.

Does something like this exist for Visual Studio? Or can I start using the C++ version of Eclipse and run the Javadoc generator there (I actually haven't tried this!) to get those nice pop-up comments?

EDIT: I've been trying to get XML style comments working, but something like:

/// <summary>This constructor takes parameters to set the 
/// members of the Cow class.
/// <param name="ho">Hobby as string of the cow.</param>
/// <param name="wt">Weight of the cow as a double.</param>
/// </summary>
Cow(const char * nm, double wt);

still only gives me the string "Cow(const char * nm, double wt)" in the pop-up window. Built with the \doc option, I do have a .xml file generated (in my Debug folder).

like image 728
Xilconic Avatar asked Jan 06 '12 08:01

Xilconic


Video Answer


1 Answers

In C# you can write

///

And it will generate a XML style comment like:

/// <summary>
///
/// </summary>
/// <param name="parameter"> </param>
/// <returns> </returns>

You can let Visual Studio generate an XML file, which can be processed to get something like javadoc. I'm 100% sure it works on C#, but it seems that C++ uses a different style. If I go to project options > Configuration Options > XML Document Generator > General, and set the "Validate IntelliSense" to Yes, you can place comments in your .h file:

class Test {
    public:
        // The constructor
        Test(void);
        // The destructor
        ~Test(void);
        // The function description
        void Function();
};

If I go to my main.cpp, and type this:

Test * test = new Test();
test->

As soon as I hit the '>', a box pops up with a list of functions (destructor and the function in this case). If I select Function for example, a tooltip pops up with "The function description":

void Test::Function();

The function description
File: test.h

I'm not sure if there are any plugins, but I hope I helped you a bit here!

like image 106
Carlito Avatar answered Nov 24 '22 12:11

Carlito