简体   繁体   中英

Counting the number of methods defined in a C++ header

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

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

I dunno if doxygen --> http://www.doxygen.nl/ 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM