f3b61c70d81a7f7eacc48061897d628e310e2ede
[platform/upstream/doxygen.git] / src / dotgroupcollaboration.h
1 /******************************************************************************
2 *
3 * Copyright (C) 1997-2019 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16 #ifndef DOTGROUPCOLLABORATION_H
17 #define DOTGROUPCOLLABORATION_H
18
19 #include <memory>
20
21 #include "dotnode.h"
22 #include "dotgraph.h"
23 #include "groupdef.h"
24
25 class TextStream;
26
27 /** Representation of a group collaboration graph */
28 class DotGroupCollaboration : public DotGraph
29 {
30   public :
31     DotGroupCollaboration(const GroupDef* gd);
32    ~DotGroupCollaboration();
33     QCString writeGraph(TextStream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef,
34                         const QCString &path,const QCString &fileName,const QCString &relPath,
35                         bool writeImageMap=TRUE,int graphId=-1);
36     bool isTrivial() const;
37     bool isTooBig() const;
38     int numNodes() const;
39
40   protected:
41     virtual QCString getBaseName() const;
42     virtual QCString getMapLabel() const;
43     virtual void computeTheGraph();
44
45   private :
46     enum EdgeType
47     {
48       tmember = 0,
49       tclass,
50       tnamespace,
51       tfile,
52       tpages,
53       tdir,
54       thierarchy
55     };
56
57     struct Link
58     {
59       Link(const QCString &lab,const QCString &u) : label(lab), url(u) {}
60       QCString label;
61       QCString url;
62     };
63
64     struct Edge
65     {
66       Edge(DotNode *start,DotNode *end,EdgeType type)
67         : pNStart(start), pNEnd(end), eType(type) {}
68
69       DotNode* pNStart;
70       DotNode* pNEnd;
71       EdgeType eType;
72
73       std::vector<Link> links;
74       void write( TextStream &t ) const;
75     };
76
77     void buildGraph(const GroupDef* gd);
78     void addCollaborationMember(const Definition* def, QCString& url, EdgeType eType );
79     void addMemberList( class MemberList* ml );
80     void writeGraphHeader(TextStream &t,const QCString &title) const;
81     Edge* addEdge( DotNode* _pNStart, DotNode* _pNEnd, EdgeType _eType,
82         const QCString& _label, const QCString& _url );
83
84     DotNode        *m_rootNode;
85     DotNodeMap      m_usedNodes;
86     QCString        m_diskName;
87     std::vector< std::unique_ptr<Edge> >     m_edges;
88 };
89
90 using DotGroupCollaborationPtr = std::shared_ptr<DotGroupCollaboration>;
91
92 #endif