views:

239

answers:

3

I'm using Visual Studio 2008 (C++) and would like to produce a list of all classes that are defined in that project. Does anyone know tools that extract those easily?

A simple 'Find in files' will not be sufficient, of course.

Edit: The list of classes should be created automatically and the result should be a simple file of class names (one class each line).

+11  A: 

Doxygen will do that and loads more. Its a really good tool for producing all sorts of documentation

Goz
+3  A: 

You can browse all classes etc. in your project in the Class View window (View > Class View). You can even create your own folders and organize the classes to create your own structure. E.g. you could create folders named Refactor, Unused, Suspect etc.

You cannot print the class view, but the browser might still be helpful to you.

Martin Liversage
+2  A: 

You could use a tool like ctags to produce a tags file containing this class information.

EDIT: I just checked this ctags.exe command line inside the Zeus editor and it seems to do what you require:

 ctags.exe --C++-kinds=+c-d-e-f-g-l-m-M-n-p-s-t-T-u-v-x-X-V somefile.cpp

This command line excludes all but the class information from the tag output, so running this command against a c++ file will result in a tags text file that contains nothing but the class information from that file.

For example, here is contents of the tags file for one of the Zeus header files:

 !_TAG_FILE_FORMAT  2  /extended format; --format=1 will not append ;" to lines/
 !_TAG_FILE_SORTED  1  /0=unsorted, 1=sorted, 2=foldcase/
 !_TAG_PROGRAM_AUTHOR  Darren Hiebert  /[email protected]/
 !_TAG_PROGRAM_NAME  Exuberant Ctags  //
 !_TAG_PROGRAM_URL  http://ctags.sourceforge.net  /official site/
 !_TAG_PROGRAM_VERSION  5.7  //
 ZeusRebar  c:\projects\zeus3.96\zfwbar01.hpp  /^class ZeusRebar : public xRebar$/;"  c
 ZeusToolBar  c:\projects\zeus3.96\zfwbar01.hpp  /^class ZeusToolBar : public xToolBar$/;"  c
 ZeusToolPanel  c:\projects\zeus3.96\zfwbar01.hpp  /^class ZeusToolPanel : public ZeusRebar$/;"  c
jussij
I'm using global (http://www.gnu.org/software/global/) which is similar to ctags. Do you know how to extract a list of classes from the tags file?
Andre
In response to your question, I added some more details to my reply ;)
jussij