是否有一些工具通过检查
Linux中的C代码生成类层次结构/依赖关系图?
我有这么大的C文件收集给我,这样一个工具将是无价的帮助我
了解源代码.我有点纠结了解它.
解决方法
尝试
doxygen.它也可能与您的发行版一起发货.
您可能需要GraphViz生成图形.有a simple example和output.
这是由doxgen生成的图例文件中的一个更复杂的例子:
代码(注意:如果只想生成图形,则不需要注释.):
/*! Invisible class because of truncation */ class Invisible { }; /*! Truncated class,inheritance relation is hidden */ class Truncated : public Invisible { }; /* Class not documented with doxygen comments */ class Undocumented { }; /*! Class that is inherited using public inheritance */ class PublicBase : public Truncated { }; /*! A template class */ template<class T> class Templ { }; /*! Class that is inherited using protected inheritance */ class ProtectedBase { }; /*! Class that is inherited using private inheritance */ class PrivateBase { }; /*! Class that is used by the Inherited class */ class Used { }; /*! Super class that inherits a number of other classes */ class Inherited : public PublicBase,protected ProtectedBase,private PrivateBase,public Undocumented,public Templ<int> { private: Used *m_usedClass; };
结果:
您不需要对代码进行评论来生成这些图形.第一个例子根本没有任何意见.第二个例子有一个没有Doxygen风格评论的类.只需设置相应的参数(至少应该设置EXTRACT_ALL = YES),我不记得是否需要这样做).