简体   繁体   English

计算C ++标头中定义的方法数

[英]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 :) 我可以自己滚动(在这种特殊情况下,想出适合我的东西很容易),但我想我先尝试stackoverflow :)

Thanks, Yi 谢谢,易

Try this: 尝试这个:

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

To list all functions in the file myfile.h . 列出文件myfile.h中的所有函数。 To count the number of functions in deque.tcc : 要计算deque.tcc的函数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. 我不知道如果doxygen - > http://www.doxygen.nl/这样做,但如果它也这样做我也不会感到惊讶。

It generates documentation from the header files + javadoc like comments. 它从头文件+ javadoc生成文档,如注释。

It will find the functions also so that kinda is counting. 它会找到这些功能,以便有点数。

You can write the Visual Studio plugin. 您可以编写Visual Studio插件。 In which you can access each class, and each methods in it. 您可以在其中访问每个类及其中的每个方法。 This uses COM technology and Visual studio extensibility feature. 这使用COM技术和Visual Studio可扩展性功能。

EDIT: I have never seen the tag cocoa in question. 编辑:我从来没有见过标签可可有问题。 This answer applies only to Visual studio 这个答案仅适用于Visual Studio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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