tags:

views:

156

answers:

3

Hi, Is there a tool to count the number of methods defined in a header? This seems like something that people would want to do from time to time, but I've never heard of such a utility. I could roll my own (and it'd be quite easy to come up with something that works for me in this particular case), but I thought I'd try stackoverflow first :)

Thanks, Yi

A: 

I dunno if doxygen --> http://www.stack.nl/~dimitri/doxygen/ does it, but i wouldn't be surprised if it also does that.

It generates documentation from the header files + javadoc like comments.

It will find the functions also so that kinda is counting.

fmsf
+6  A: 

Try this:

ctags --c++-kinds=f -x myfile.h

To list all functions in the file myfile.h . To count the number of functions in deque.tcc:

$ ctags --c++-kinds=f --language-force=c++ -x deque.tcc | wc -l
24
Johannes Schaub - litb
+1 much better than my solution :)
fmsf
+1, but the ctags I have on my MacBook doesn't support C++; only C, Pascal, Fortran, YACC, lex, and lisp.
Adam Rosenfield
A: 

You can write the Visual Studio plugin. In which you can access each class, and each methods in it. This uses COM technology and Visual studio extensibility feature.

EDIT: I have never seen the tag cocoa in question. This answer applies only to Visual studio

Vinay