Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: diagram.h,v 1.11 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | *␊ |
6 | * Copyright (C) 1997-2011 by Dimitri van Heesch.␊ |
7 | *␊ |
8 | * Permission to use, copy, modify, and distribute this software and its␊ |
9 | * documentation under the terms of the GNU General Public License is hereby ␊ |
10 | * granted. No representations are made about the suitability of this software ␊ |
11 | * for any purpose. It is provided "as is" without express or implied warranty.␊ |
12 | * See the GNU General Public License for more details.␊ |
13 | *␊ |
14 | * Documents produced by Doxygen are derivative works derived from the␊ |
15 | * input used in their production; they are not affected by this license.␊ |
16 | *␊ |
17 | */␊ |
18 | ␊ |
19 | #include "qtbc.h"␊ |
20 | #include "entry.h"␊ |
21 | ␊ |
22 | class ClassDef;␊ |
23 | class DiagramRow;␊ |
24 | class TreeDiagram;␊ |
25 | class ClassDiagram;␊ |
26 | class DiagramItemList;␊ |
27 | class Image;␊ |
28 | class FTextStream;␊ |
29 | ␊ |
30 | class DiagramItem ␊ |
31 | {␊ |
32 | public:␊ |
33 | DiagramItem(DiagramItem *p,int number,ClassDef *cd,␊ |
34 | Protection prot,Specifier virt,const char *ts);␊ |
35 | ~DiagramItem();␊ |
36 | QCString label() const;␊ |
37 | QCString fileName() const;␊ |
38 | DiagramItem *parentItem() { return parent; } ␊ |
39 | DiagramItemList *getChildren() { return children; }␊ |
40 | void move(int dx,int dy) { x+=dx; y+=dy; }␊ |
41 | int xPos() const { return x; }␊ |
42 | int yPos() const { return y; }␊ |
43 | int avgChildPos() const;␊ |
44 | int numChildren() const;␊ |
45 | void addChild(DiagramItem *di);␊ |
46 | int number() const { return num; }␊ |
47 | Protection protection() const { return prot; }␊ |
48 | Specifier virtualness() const { return virt; }␊ |
49 | void putInList() { inList=TRUE; }␊ |
50 | bool isInList() const { return inList; } ␊ |
51 | ClassDef *getClassDef() const { return classDef; }␊ |
52 | private:␊ |
53 | DiagramItemList *children;␊ |
54 | DiagramItem *parent;␊ |
55 | int x,y;␊ |
56 | int num;␊ |
57 | Protection prot;␊ |
58 | Specifier virt;␊ |
59 | QCString templSpec;␊ |
60 | bool inList;␊ |
61 | ClassDef *classDef;␊ |
62 | };␊ |
63 | ␊ |
64 | class DiagramItemList : public QList<DiagramItem>␊ |
65 | {␊ |
66 | public:␊ |
67 | DiagramItemList() : QList<DiagramItem>() {}␊ |
68 | ~DiagramItemList() {}␊ |
69 | };␊ |
70 | ␊ |
71 | class DiagramRow : public QList<DiagramItem> ␊ |
72 | {␊ |
73 | public:␊ |
74 | DiagramRow(TreeDiagram *d,int l) : QList<DiagramItem>() ␊ |
75 | { ␊ |
76 | diagram=d; ␊ |
77 | level=l;␊ |
78 | setAutoDelete(TRUE); ␊ |
79 | }␊ |
80 | void insertClass(DiagramItem *parent,ClassDef *cd,bool doBases,␊ |
81 | Protection prot,Specifier virt,const char *ts);␊ |
82 | uint number() { return level; }␊ |
83 | private:␊ |
84 | TreeDiagram *diagram;␊ |
85 | uint level;␊ |
86 | };␊ |
87 | ␊ |
88 | class DiagramRowIterator : public QListIterator<DiagramRow>␊ |
89 | {␊ |
90 | public:␊ |
91 | DiagramRowIterator(const QList<DiagramRow> &d) ␊ |
92 | : QListIterator<DiagramRow>(d) {}␊ |
93 | };␊ |
94 | ␊ |
95 | class TreeDiagram : public QList<DiagramRow>␊ |
96 | {␊ |
97 | public:␊ |
98 | TreeDiagram(ClassDef *root,bool doBases);␊ |
99 | ~TreeDiagram();␊ |
100 | void computeLayout();␊ |
101 | uint computeRows();␊ |
102 | //uint computeCols();␊ |
103 | void moveChildren(DiagramItem *root,int dx);␊ |
104 | void computeExtremes(uint *labelWidth,uint *xpos);␊ |
105 | void drawBoxes(FTextStream &t,Image *image,␊ |
106 | bool doBase,bool bitmap,␊ |
107 | uint baseRows,uint superRows,␊ |
108 | uint cellWidth,uint cellHeight,␊ |
109 | QCString relPath="",␊ |
110 | bool generateMap=TRUE);␊ |
111 | void drawConnectors(FTextStream &t,Image *image,␊ |
112 | bool doBase,bool bitmap,␊ |
113 | uint baseRows,uint superRows,␊ |
114 | uint cellWidth,uint cellheight);␊ |
115 | private:␊ |
116 | bool layoutTree(DiagramItem *root,int row);␊ |
117 | TreeDiagram &operator=(const TreeDiagram &);␊ |
118 | TreeDiagram(const TreeDiagram &);␊ |
119 | };␊ |
120 | ␊ |
121 | class ClassDiagram␊ |
122 | {␊ |
123 | public:␊ |
124 | ClassDiagram(ClassDef *root);␊ |
125 | ~ClassDiagram();␊ |
126 | void writeFigure(FTextStream &t,const char *path,␊ |
127 | const char *file) const;␊ |
128 | void writeImage(FTextStream &t,const char *path,const char *relPath,␊ |
129 | const char *file,bool generateMap=TRUE) const;␊ |
130 | private:␊ |
131 | TreeDiagram *base;␊ |
132 | TreeDiagram *super;␊ |
133 | };␊ |
134 |