DoxyGen文档之九

类别:VC语言 点击:0 评论:0 推荐:
第六章:Graphs&diagrams图表

Doxygen有内建生成生成对C++类层次图的功能。

Doxygen使用graphviz 1.5中的”dot”工具来生成更多高级图。Graphviz由AT&T的Bell Labs开发,网址是http://www.research.att.com/sw/tools/graphviz/

如果你已经有了”dot”工具,那么可以将HAVE_DOT设置为YES

注意:必须下载dot工具才能对使用高级功能

Doxygen使用”dot”来生成下列图

·如果GRAPHICAL_HIERARCHY设置为YES,将和文本一起,生成一个类层次图,该特性目前只在HTML中支持
警告:在一个大的层次图中,当很多类从一个base class中派生时,可能创建出的图像超过浏览器限制

·如果CLASS_GRAPH设置为YES,将为每个documented类创建图来展示直接和间接的继承关系这个就禁用了内建的类继承图

·如果INCLUDE_GRAPH设置为YES,针对每个至少include一个其他文件的documented类产生一个include依赖图。该特性目前只在HTML和RTF中支持

·如果COLLABORATION_GRAPH设置为YES,针对每个documented类和结构将产生一个图:

o       从base class的继承关系

o       和其他struct及类的使用关系(例如类A有个成员变量m_a是class B类型的,那么A就有个指向B的箭头上面标明m_a)

HTML和RTF中类图的元素有以下含义:

·A yellow box 表示一个类. A box can have a little marker in the lower right corner to indicate that the class contains base classes that are hidden. For the class diagrams the maximum tree width is currently 8 elements. If a tree is wider some nodes will be hidden. If the box is filled with a dashed pattern the inheritance relation is virtual.

·A white box indicates that the documentation of the class is currently shown.

·A grey box表示一个undocumented类.

·A solid dark blue arrow表示public inheritance.

·A dashed dark green arrow表示protected inheritance.

·A dotted dark green arrow表示private inheritance.

The elements in the class diagram in have the following meaning:

·A white box indicates a class. A marker in the lower right corner of the box indicates that the class has base classes that are hidden. If the box has a dashed border this indicates virtual inheritance.

·A solid arrow indicates public inheritance.

·A dashed arrow indicates protected inheritance.

·A dotted arrow indicates private inheritance.

dot工具生成的图中元素的有以下意义:

·A white box 代表一个类/结构/文件

·A box with a red border代表有一个node有还有更多箭头,不能完全显示!换句话:对该node而言,这个图是被删节了(truncated)。一个图有时被删节了,这是放置图过大。Doxygen所产生的图宽度限制在1024个pixel以下。

·A black box 代表这个class的文档正在当前显示

·A dark blue arrow 代表一个include关系(对include依赖图)或public继承(其他图)

·A dark green arrow代表protected继承

·A dark red arrow代表private继承

·A purple dashed arrow代表一个“usage”关系。箭头的边缘以相关的variable(s)标记。类A使用类B,如果类A有个C类型的member variable m,而B是C的一个subtype(例如C可能是B,B*,T<B>*)。

这里有一组.h文件演示了doxygen可以生成的各种图:

diagrams_a.h

#ifndef _DIAGRAMS_A_H

#define _DIAGRAMS_A_H

class A { public: A *m_self; };

#endif

diagrams_b.h

#ifndef _DIAGRAMS_B_H

#define _DIAGRAMS_B_H

class A;

class B { public: A *m_a; };

#endif

diagrams_c.h

#ifndef _DIAGRAMS_C_H

#define _DIAGRAMS_C_H

#include "diagrams_c.h"

class D;

class C : public A { public: D *m_d; };

#endif

diagrams_d.h

#ifndef _DIAGRAM_D_H

#define _DIAGRAM_D_H

#include "diagrams_a.h"

#include "diagrams_b.h"

class C;

class D : virtual protected  A, private B { public: C m_c; };

#endif

diagrams_e.h

#ifndef _DIAGRAM_E_H

#define _DIAGRAM_E_H

#include "diagrams_d.h"

class E : public D {};

#endif

Click here for the corresponding HTML documentation that is generated by doxygen
(EXTRACT_ALL = YES is used here).

本文地址:http://com.8s8s.com/it/it1254.htm