如何解析/简单分析C#中的C/C++代码以获取方法列表

前端之家收集整理的这篇文章主要介绍了如何解析/简单分析C#中的C/C++代码以获取方法列表前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要浏览一个C/C++文件提取类和方法列表以及它们在文件中的位置.

libclang是最好的选择吗?或者这项任务“太多”了吗?

只想寻找配对括号会更好吗?

如果选择libclang:有没有办法从c#调用它?

谢谢!

解决方法@H_301_12@
您可以考虑 ctags,可在许多平台上使用.输出很容易解析,并且您需要完整的信息.

更多信息
对于你的问题,我不得不寻找可用的许多选项,稍后我发现它.例如:

  1. ctags -N -x --c-kinds=+p crowd.*

产生这个输出

  1. CrowdSim class 44 crowd.h class CrowdSim
  2. CrowdSim function 47 crowd.h CrowdSim( const std::string& contentDir ) : _contentDir( contentDir ) {}
  3. Particle function 35 crowd.h Particle()
  4. Particle struct 25 crowd.h struct Particle
  5. _contentDir member 56 crowd.h std::string _contentDir;
  6. _crowd_H_ macro 18 crowd.h #define _crowd_H_
  7. _particles member 57 crowd.h std::vector< Particle > _particles;
  8. animTime member 32 crowd.h float animTime;
  9. chooseDestination function 24 crowd.cpp void CrowdSim::chooseDestination( Particle &p )
  10. chooseDestination prototype 53 crowd.h void chooseDestination( Particle &p );
  11. dx member 28 crowd.h float dx,dz; // Destination position
  12. dz member 28 crowd.h float dx,dz; // Destination position
  13. fx member 29 crowd.h float fx,fz; // Force on particle
  14. fz member 29 crowd.h float fx,fz; // Force on particle
  15. init function 35 crowd.cpp void CrowdSim::init()
  16. init prototype 49 crowd.h void init();
  17. node member 31 crowd.h H3DNode node;
  18. ox member 30 crowd.h float ox,oz; // Orientation vector
  19. oz member 30 crowd.h float ox,oz; // Orientation vector
  20. px member 27 crowd.h float px,pz; // Current postition
  21. pz member 27 crowd.h float px,pz; // Current postition
  22. update function 68 crowd.cpp void CrowdSim::update( float fps )
  23. update prototype 50 crowd.h void update( float fps );

(注意:-x仅供用户检查)

猜你在找的C#相关文章