我需要浏览 C/C++ 文件并提取类和方法的列表以及它们在文件中的位置。
libclang 是最好的选择吗?或者对于这项任务来说“太多了”?
只寻找配对支架会更好吗?
如果选择 libclang:有没有办法从 c# 调用它?
Thanks!
你可以考虑ctags http://ctags.sourceforge.net/,可在许多平台上使用。输出很容易解析,并且包含您所需的信息。
更多信息对于你的问题,我不得不寻找许多可用的选项,过了一会儿我找到了它。例如:
ctags -N -x --c-kinds=+p crowd.*
产生这个输出
CrowdSim class 44 crowd.h class CrowdSim
CrowdSim function 47 crowd.h CrowdSim( const std::string& contentDir ) : _contentDir( contentDir ) {}
Particle function 35 crowd.h Particle()
Particle struct 25 crowd.h struct Particle
_contentDir member 56 crowd.h std::string _contentDir;
_crowd_H_ macro 18 crowd.h #define _crowd_H_
_particles member 57 crowd.h std::vector< Particle > _particles;
animTime member 32 crowd.h float animTime;
chooseDestination function 24 crowd.cpp void CrowdSim::chooseDestination( Particle &p )
chooseDestination prototype 53 crowd.h void chooseDestination( Particle &p );
dx member 28 crowd.h float dx, dz; // Destination position
dz member 28 crowd.h float dx, dz; // Destination position
fx member 29 crowd.h float fx, fz; // Force on particle
fz member 29 crowd.h float fx, fz; // Force on particle
init function 35 crowd.cpp void CrowdSim::init()
init prototype 49 crowd.h void init();
node member 31 crowd.h H3DNode node;
ox member 30 crowd.h float ox, oz; // Orientation vector
oz member 30 crowd.h float ox, oz; // Orientation vector
px member 27 crowd.h float px, pz; // Current postition
pz member 27 crowd.h float px, pz; // Current postition
update function 68 crowd.cpp void CrowdSim::update( float fps )
update prototype 50 crowd.h void update( float fps );
(注:-x只是为了方便用户检查)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)