Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
DotNode Class Reference

#include <dot.h>

Public Types

enum  GraphType {
  Dependency, Inheritance, Collaboration, Hierarchy,
  CallGraph
}
 
enum  TruncState { Unknown, Truncated, Untruncated }
 

Public Member Functions

 DotNode (int n, const char *lab, const char *tip, const char *url, bool rootNode=FALSE, ClassDef *cd=0)
 
 ~DotNode ()
 
void addChild (DotNode *n, int edgeColor=EdgeInfo::Purple, int edgeStyle=EdgeInfo::Solid, const char *edgeLab=0, const char *edgeURL=0, int edgeLabCol=-1)
 
void addParent (DotNode *n)
 
void deleteNode (DotNodeList &deletedList, SDict< DotNode > *skipNodes=0)
 
void removeChild (DotNode *n)
 
void removeParent (DotNode *n)
 
int findParent (DotNode *n)
 
void write (FTextStream &t, GraphType gt, GraphOutputFormat f, bool topDown, bool toChildren, bool backArrows, bool reNumber)
 
void clearWriteFlag ()
 
void writeXML (FTextStream &t, bool isClassGraph)
 
void writeDocbook (FTextStream &t, bool isClassGraph)
 
void writeDEF (FTextStream &t)
 
QCString label () const
 
int number () const
 
bool isVisible () const
 
TruncState isTruncated () const
 
int distance () const
 

Public Attributes

int m_subgraphId
 

Private Member Functions

void colorConnectedNodes (int curColor)
 
void writeBox (FTextStream &t, GraphType gt, GraphOutputFormat f, bool hasNonReachableChildren, bool reNumber=FALSE)
 
void writeArrow (FTextStream &t, GraphType gt, GraphOutputFormat f, DotNode *cn, EdgeInfo *ei, bool topDown, bool pointBack=TRUE, bool reNumber=FALSE)
 
void setDistance (int distance)
 
const DotNodefindDocNode () const
 
void markAsVisible (bool b=TRUE)
 
void markAsTruncated (bool b=TRUE)
 

Private Attributes

int m_number
 
QCString m_label
 label text More...
 
QCString m_tooltip
 node's tooltip More...
 
QCString m_url
 url of the node (format: remote$local) More...
 
QList< DotNode > * m_parents
 list of parent nodes (incoming arrows) More...
 
QList< DotNode > * m_children
 list of child nodes (outgoing arrows) More...
 
QList< EdgeInfo > * m_edgeInfo
 edge info for each child More...
 
bool m_deleted
 used to mark a node as deleted More...
 
bool m_written
 used to mark a node as written More...
 
bool m_hasDoc
 used to mark a node as documented More...
 
bool m_isRoot
 indicates if this is a root node More...
 
ClassDefm_classDef
 class representing this node (can be 0) More...
 
bool m_visible
 is the node visible in the output More...
 
TruncState m_truncated
 does the node have non-visible children/parents More...
 
int m_distance
 shortest path to the root node More...
 

Friends

class DotGfxHierarchyTable
 
class DotClassGraph
 
class DotInclDepGraph
 
class DotNodeList
 
class DotCallGraph
 
class DotGroupCollaboration
 
class DotInheritanceGraph
 
QCString computeMd5Signature (DotNode *root, GraphType gt, GraphOutputFormat f, bool lrRank, bool renderParents, bool backArrows, const QCString &title, QCString &graphStr)
 

Detailed Description

A node in a dot graph

Definition at line 60 of file dot.h.

Member Enumeration Documentation

Enumerator
Dependency 
Inheritance 
Collaboration 
Hierarchy 
CallGraph 

Definition at line 63 of file dot.h.

Enumerator
Unknown 
Truncated 
Untruncated 

Definition at line 64 of file dot.h.

Constructor & Destructor Documentation

DotNode::DotNode ( int  n,
const char *  lab,
const char *  tip,
const char *  url,
bool  rootNode = FALSE,
ClassDef cd = 0 
)

Definition at line 1452 of file dot.cpp.

1454  : m_subgraphId(-1)
1455  , m_number(n)
1456  , m_label(lab)
1457  , m_tooltip(tip)
1458  , m_url(url)
1459  , m_parents(0)
1460  , m_children(0)
1461  , m_edgeInfo(0)
1462  , m_deleted(FALSE)
1463  , m_written(FALSE)
1464  , m_hasDoc(FALSE)
1465  , m_isRoot(isRoot)
1466  , m_classDef(cd)
1467  , m_visible(FALSE)
1468  , m_truncated(Unknown)
1469  , m_distance(1000)
1470 {
1471 }
TruncState m_truncated
does the node have non-visible children/parents
Definition: dot.h:116
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
QCString m_tooltip
node&#39;s tooltip
Definition: dot.h:105
bool m_isRoot
indicates if this is a root node
Definition: dot.h:113
const bool FALSE
Definition: qglobal.h:370
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
std::void_t< T > n
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
bool m_written
used to mark a node as written
Definition: dot.h:111
int m_number
Definition: dot.h:103
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
ClassDef * m_classDef
class representing this node (can be 0)
Definition: dot.h:114
int m_subgraphId
Definition: dot.h:82
bool m_hasDoc
used to mark a node as documented
Definition: dot.h:112
bool m_deleted
used to mark a node as deleted
Definition: dot.h:110
QCString m_label
label text
Definition: dot.h:104
bool m_visible
is the node visible in the output
Definition: dot.h:115
int m_distance
shortest path to the root node
Definition: dot.h:117
DotNode::~DotNode ( )

Definition at line 1473 of file dot.cpp.

1474 {
1475  delete m_children;
1476  delete m_parents;
1477  delete m_edgeInfo;
1478 }
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107

Member Function Documentation

void DotNode::addChild ( DotNode n,
int  edgeColor = EdgeInfo::Purple,
int  edgeStyle = EdgeInfo::Solid,
const char *  edgeLab = 0,
const char *  edgeURL = 0,
int  edgeLabCol = -1 
)

Definition at line 1480 of file dot.cpp.

1487 {
1488  if (m_children==0)
1489  {
1490  m_children = new QList<DotNode>;
1493  }
1494  m_children->append(n);
1495  EdgeInfo *ei = new EdgeInfo;
1496  ei->m_color = edgeColor;
1497  ei->m_style = edgeStyle;
1498  ei->m_label = edgeLab;
1499  ei->m_url = edgeURL;
1500  if (edgeLabCol==-1)
1501  ei->m_labColor=edgeColor;
1502  else
1503  ei->m_labColor=edgeLabCol;
1504  m_edgeInfo->append(ei);
1505 }
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
void append(const type *d)
Definition: qlist.h:73
QCString m_label
Definition: dot.h:54
int m_style
Definition: dot.h:53
QCString m_url
Definition: dot.h:55
int m_labColor
Definition: dot.h:56
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
int m_color
Definition: dot.h:52
Definition: dot.h:46
void setAutoDelete(bool enable)
Definition: qlist.h:99
const bool TRUE
Definition: qglobal.h:371
void DotNode::addParent ( DotNode n)

Definition at line 1507 of file dot.cpp.

1508 {
1509  if (m_parents==0)
1510  {
1511  m_parents = new QList<DotNode>;
1512  }
1513  m_parents->append(n);
1514 }
void append(const type *d)
Definition: qlist.h:73
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
void DotNode::clearWriteFlag ( )

Definition at line 2168 of file dot.cpp.

2169 {
2170  m_written=FALSE;
2171  if (m_parents!=0)
2172  {
2174  DotNode *pn;
2175  for (dnlip.toFirst();(pn=dnlip.current());++dnlip)
2176  {
2177  if (pn->m_written)
2178  {
2179  pn->clearWriteFlag();
2180  }
2181  }
2182  }
2183  if (m_children!=0)
2184  {
2186  DotNode *cn;
2187  for (dnlic.toFirst();(cn=dnlic.current());++dnlic)
2188  {
2189  if (cn->m_written)
2190  {
2191  cn->clearWriteFlag();
2192  }
2193  }
2194  }
2195 }
void clearWriteFlag()
Definition: dot.cpp:2168
Definition: dot.h:60
const bool FALSE
Definition: qglobal.h:370
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
bool m_written
used to mark a node as written
Definition: dot.h:111
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
void DotNode::colorConnectedNodes ( int  curColor)
private

Definition at line 2197 of file dot.cpp.

2198 {
2199  if (m_children)
2200  {
2202  DotNode *cn;
2203  for (dnlic.toFirst();(cn=dnlic.current());++dnlic)
2204  {
2205  if (cn->m_subgraphId==-1) // uncolored child node
2206  {
2207  cn->m_subgraphId=curColor;
2208  cn->markAsVisible();
2209  cn->colorConnectedNodes(curColor);
2210  //printf("coloring node %s (%p): %d\n",cn->m_label.data(),cn,cn->m_subgraphId);
2211  }
2212  }
2213  }
2214 
2215  if (m_parents)
2216  {
2218  DotNode *pn;
2219  for (dnlip.toFirst();(pn=dnlip.current());++dnlip)
2220  {
2221  if (pn->m_subgraphId==-1) // uncolored parent node
2222  {
2223  pn->m_subgraphId=curColor;
2224  pn->markAsVisible();
2225  pn->colorConnectedNodes(curColor);
2226  //printf("coloring node %s (%p): %d\n",pn->m_label.data(),pn,pn->m_subgraphId);
2227  }
2228  }
2229  }
2230 }
Definition: dot.h:60
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
int m_subgraphId
Definition: dot.h:82
void colorConnectedNodes(int curColor)
Definition: dot.cpp:2197
void markAsVisible(bool b=TRUE)
Definition: dot.h:101
void DotNode::deleteNode ( DotNodeList deletedList,
SDict< DotNode > *  skipNodes = 0 
)

Definition at line 1526 of file dot.cpp.

1527 {
1528  if (m_deleted) return; // avoid recursive loops in case the graph has cycles
1529  m_deleted=TRUE;
1530  if (m_parents!=0) // delete all parent nodes of this node
1531  {
1533  DotNode *pn;
1534  for (dnlip.toFirst();(pn=dnlip.current());++dnlip)
1535  {
1536  //pn->removeChild(this);
1537  pn->deleteNode(deletedList,skipNodes);
1538  }
1539  }
1540  if (m_children!=0) // delete all child nodes of this node
1541  {
1543  DotNode *cn;
1544  for (dnlic.toFirst();(cn=dnlic.current());++dnlic)
1545  {
1546  //cn->removeParent(this);
1547  cn->deleteNode(deletedList,skipNodes);
1548  }
1549  }
1550  // add this node to the list of deleted nodes.
1551  //printf("skipNodes=%p find(%p)=%p\n",skipNodes,this,skipNodes ? skipNodes->find((int)this) : 0);
1552  if (skipNodes==0 || skipNodes->find((char*)this)==0)
1553  {
1554  //printf("deleting\n");
1555  deletedList.append(this);
1556  }
1557 }
void append(const type *d)
Definition: qlist.h:73
Definition: dot.h:60
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
bool m_deleted
used to mark a node as deleted
Definition: dot.h:110
T * find(const char *key)
Definition: sortdict.h:232
void deleteNode(DotNodeList &deletedList, SDict< DotNode > *skipNodes=0)
Definition: dot.cpp:1526
const bool TRUE
Definition: qglobal.h:371
int DotNode::distance ( ) const
inline

Definition at line 91 of file dot.h.

91 { return m_distance; }
int m_distance
shortest path to the root node
Definition: dot.h:117
const DotNode * DotNode::findDocNode ( ) const
private

Definition at line 2232 of file dot.cpp.

2233 {
2234  if (!m_url.isEmpty()) return this;
2235  //printf("findDocNode(): `%s'\n",m_label.data());
2236  if (m_parents)
2237  {
2239  DotNode *pn;
2240  for (dnli.toFirst();(pn=dnli.current());++dnli)
2241  {
2242  if (!pn->m_hasDoc)
2243  {
2244  pn->m_hasDoc=TRUE;
2245  const DotNode *dn = pn->findDocNode();
2246  if (dn) return dn;
2247  }
2248  }
2249  }
2250  if (m_children)
2251  {
2253  DotNode *cn;
2254  for (dnli.toFirst();(cn=dnli.current());++dnli)
2255  {
2256  if (!cn->m_hasDoc)
2257  {
2258  cn->m_hasDoc=TRUE;
2259  const DotNode *dn = cn->findDocNode();
2260  if (dn) return dn;
2261  }
2262  }
2263  }
2264  return 0;
2265 }
bool isEmpty() const
Definition: qcstring.h:189
Definition: dot.h:60
const DotNode * findDocNode() const
Definition: dot.cpp:2232
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
bool m_hasDoc
used to mark a node as documented
Definition: dot.h:112
const bool TRUE
Definition: qglobal.h:371
int DotNode::findParent ( DotNode n)
inline

Definition at line 778 of file dot.cpp.

779 {
780  if ( !m_parents ) return -1;
781  return m_parents->find(n);
782 }
int find(const type *d) const
Definition: qlist.h:88
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
TruncState DotNode::isTruncated ( ) const
inline

Definition at line 90 of file dot.h.

90 { return m_truncated; }
TruncState m_truncated
does the node have non-visible children/parents
Definition: dot.h:116
bool DotNode::isVisible ( ) const
inline

Definition at line 89 of file dot.h.

89 { return m_visible; }
bool m_visible
is the node visible in the output
Definition: dot.h:115
QCString DotNode::label ( ) const
inline

Definition at line 87 of file dot.h.

87 { return m_label; }
QCString m_label
label text
Definition: dot.h:104
void DotNode::markAsTruncated ( bool  b = TRUE)
inlineprivate

Definition at line 102 of file dot.h.

TruncState m_truncated
does the node have non-visible children/parents
Definition: dot.h:116
static bool * b
Definition: config.cpp:1043
void DotNode::markAsVisible ( bool  b = TRUE)
inlineprivate

Definition at line 101 of file dot.h.

101 { m_visible=b; }
static bool * b
Definition: config.cpp:1043
bool m_visible
is the node visible in the output
Definition: dot.h:115
int DotNode::number ( ) const
inline

Definition at line 88 of file dot.h.

88 { return m_number; }
int m_number
Definition: dot.h:103
void DotNode::removeChild ( DotNode n)

Definition at line 1516 of file dot.cpp.

1517 {
1518  if (m_children) m_children->remove(n);
1519 }
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
bool remove(uint i)
Definition: qlist.h:76
void DotNode::removeParent ( DotNode n)

Definition at line 1521 of file dot.cpp.

1522 {
1523  if (m_parents) m_parents->remove(n);
1524 }
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
bool remove(uint i)
Definition: qlist.h:76
void DotNode::setDistance ( int  distance)
private

Definition at line 1559 of file dot.cpp.

1560 {
1562 }
int distance() const
Definition: dot.h:91
int m_distance
shortest path to the root node
Definition: dot.h:117
void DotNode::write ( FTextStream t,
GraphType  gt,
GraphOutputFormat  f,
bool  topDown,
bool  toChildren,
bool  backArrows,
bool  reNumber 
)

Definition at line 1906 of file dot.cpp.

1914 {
1915  //printf("DotNode::write(%d) name=%s this=%p written=%d visible=%d\n",m_distance,m_label.data(),this,m_written,m_visible);
1916  if (m_written) return; // node already written to the output
1917  if (!m_visible) return; // node is not visible
1918  writeBox(t,gt,format,m_truncated==Truncated,reNumber);
1919  m_written=TRUE;
1920  QList<DotNode> *nl = toChildren ? m_children : m_parents;
1921  if (nl)
1922  {
1923  if (toChildren)
1924  {
1925  QListIterator<DotNode> dnli1(*nl);
1927  DotNode *cn;
1928  for (dnli1.toFirst();(cn=dnli1.current());++dnli1,++dnli2)
1929  {
1930  if (cn->isVisible())
1931  {
1932  //printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",cn->label().data());
1933  writeArrow(t,gt,format,cn,dnli2.current(),topDown,backArrows,reNumber);
1934  }
1935  cn->write(t,gt,format,topDown,toChildren,backArrows,reNumber);
1936  }
1937  }
1938  else // render parents
1939  {
1940  QListIterator<DotNode> dnli(*nl);
1941  DotNode *pn;
1942  for (dnli.toFirst();(pn=dnli.current());++dnli)
1943  {
1944  if (pn->isVisible())
1945  {
1946  //printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",pn->label().data());
1947  writeArrow(t,
1948  gt,
1949  format,
1950  pn,
1951  pn->m_edgeInfo->at(pn->m_children->findRef(this)),
1952  FALSE,
1953  backArrows,
1954  reNumber
1955  );
1956  }
1957  pn->write(t,gt,format,TRUE,FALSE,backArrows,reNumber);
1958  }
1959  }
1960  }
1961  //printf("end DotNode::write(%d) name=%s\n",distance,m_label.data());
1962 }
TruncState m_truncated
does the node have non-visible children/parents
Definition: dot.h:116
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
void writeBox(FTextStream &t, GraphType gt, GraphOutputFormat f, bool hasNonReachableChildren, bool reNumber=FALSE)
Definition: dot.cpp:1722
void write(FTextStream &t, GraphType gt, GraphOutputFormat f, bool topDown, bool toChildren, bool backArrows, bool reNumber)
Definition: dot.cpp:1906
int findRef(const type *d) const
Definition: qlist.h:89
Definition: dot.h:60
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
const bool FALSE
Definition: qglobal.h:370
type * at(uint i) const
Definition: qlist.h:94
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
bool m_written
used to mark a node as written
Definition: dot.h:111
void writeArrow(FTextStream &t, GraphType gt, GraphOutputFormat f, DotNode *cn, EdgeInfo *ei, bool topDown, bool pointBack=TRUE, bool reNumber=FALSE)
Definition: dot.cpp:1854
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
bool m_visible
is the node visible in the output
Definition: dot.h:115
std::string nl(std::size_t i=1)
bool isVisible() const
Definition: dot.h:89
const bool TRUE
Definition: qglobal.h:371
void DotNode::writeArrow ( FTextStream t,
GraphType  gt,
GraphOutputFormat  f,
DotNode cn,
EdgeInfo ei,
bool  topDown,
bool  pointBack = TRUE,
bool  reNumber = FALSE 
)
private

Definition at line 1854 of file dot.cpp.

1863 {
1864  t << " Node";
1865  if (topDown)
1866  t << reNumberNode(cn->number(),reNumber);
1867  else
1868  t << reNumberNode(m_number,reNumber);
1869  t << " -> Node";
1870  if (topDown)
1871  t << reNumberNode(m_number,reNumber);
1872  else
1873  t << reNumberNode(cn->number(),reNumber);
1874  t << " [";
1875 
1876  static bool umlLook = Config_getBool("UML_LOOK");
1877  const EdgeProperties *eProps = umlLook ? &umlEdgeProps : &normalEdgeProps;
1878  QCString aStyle = eProps->arrowStyleMap[ei->m_color];
1879  bool umlUseArrow = aStyle=="odiamond";
1880 
1881  if (pointBack && !umlUseArrow) t << "dir=\"back\",";
1882  t << "color=\"" << eProps->edgeColorMap[ei->m_color]
1883  << "\",fontsize=\"" << FONTSIZE << "\",";
1884  t << "style=\"" << eProps->edgeStyleMap[ei->m_style] << "\"";
1885  if (!ei->m_label.isEmpty())
1886  {
1887  t << ",label=\" " << convertLabel(ei->m_label) << "\" ";
1888  }
1889  if (umlLook &&
1890  eProps->arrowStyleMap[ei->m_color] &&
1892  )
1893  {
1894  bool rev = pointBack;
1895  if (umlUseArrow) rev=!rev; // UML use relates has arrow on the start side
1896  if (rev)
1897  t << ",arrowtail=\"" << eProps->arrowStyleMap[ei->m_color] << "\"";
1898  else
1899  t << ",arrowhead=\"" << eProps->arrowStyleMap[ei->m_color] << "\"";
1900  }
1901 
1902  if (format==GOF_BITMAP) t << ",fontname=\"" << FONTNAME << "\"";
1903  t << "];" << endl;
1904 }
bool isEmpty() const
Definition: qcstring.h:189
const char *const * arrowStyleMap
Definition: dot.cpp:218
static QCString convertLabel(const QCString &l)
Definition: dot.cpp:1564
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
QCString m_label
Definition: dot.h:54
int m_style
Definition: dot.h:53
static EdgeProperties normalEdgeProps
Definition: dot.cpp:222
int reNumberNode(int number, bool doReNumbering)
Definition: dot.cpp:403
static EdgeProperties umlEdgeProps
Definition: dot.cpp:227
int m_color
Definition: dot.h:52
#define FONTNAME
Definition: dot.cpp:54
int m_number
Definition: dot.h:103
#define Config_getBool(val)
Definition: config.cpp:664
const char *const * edgeColorMap
Definition: dot.cpp:217
int number() const
Definition: dot.h:88
#define FONTSIZE
Definition: dot.cpp:55
const char *const * edgeStyleMap
Definition: dot.cpp:219
Definition: dot.h:42
QTextStream & endl(QTextStream &s)
void DotNode::writeBox ( FTextStream t,
GraphType  gt,
GraphOutputFormat  f,
bool  hasNonReachableChildren,
bool  reNumber = FALSE 
)
private

Definition at line 1722 of file dot.cpp.

1727 {
1728  const char *labCol =
1729  m_url.isEmpty() ? "grey75" : // non link
1730  (
1731  (hasNonReachableChildren) ? "red" : "black"
1732  );
1733  t << " Node" << reNumberNode(m_number,reNumber) << " [label=\"";
1734  static bool umlLook = Config_getBool("UML_LOOK");
1735 
1736  if (m_classDef && umlLook && (gt==Inheritance || gt==Collaboration))
1737  {
1738  // add names shown as relations to a dictionary, so we don't show
1739  // them as attributes as well
1740  QDict<void> arrowNames(17);
1741  if (m_edgeInfo)
1742  {
1743  // for each edge
1745  EdgeInfo *ei;
1746  for (li.toFirst();(ei=li.current());++li)
1747  {
1748  if (!ei->m_label.isEmpty()) // labels joined by \n
1749  {
1750  int li=ei->m_label.find('\n');
1751  int p=0;
1752  QCString lab;
1753  while ((li=ei->m_label.find('\n',p))!=-1)
1754  {
1755  lab = stripProtectionPrefix(ei->m_label.mid(p,li-p));
1756  arrowNames.insert(lab,(void*)0x8);
1757  p=li+1;
1758  }
1759  lab = stripProtectionPrefix(ei->m_label.right(ei->m_label.length()-p));
1760  arrowNames.insert(lab,(void*)0x8);
1761  }
1762  }
1763  }
1764 
1765  //printf("DotNode::writeBox for %s\n",m_classDef->name().data());
1766  static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
1767  t << "{" << convertLabel(m_label);
1768  t << "\\n|";
1776  if (extractPrivate)
1777  {
1780  }
1781  t << "|";
1790  if (extractPrivate)
1791  {
1795  }
1798  {
1800  MemberGroup *mg;
1801  for (mgdi.toFirst();(mg=mgdi.current());++mgdi)
1802  {
1803  if (mg->members())
1804  {
1805  writeBoxMemberList(t,'*',mg->members(),m_classDef,FALSE,&arrowNames);
1806  }
1807  }
1808  }
1809  t << "}";
1810  }
1811  else // standard look
1812  {
1813  t << convertLabel(m_label);
1814  }
1815  t << "\",height=0.2,width=0.4";
1816  if (m_isRoot)
1817  {
1818  t << ",color=\"black\", fillcolor=\"grey75\", style=\"filled\", fontcolor=\"black\"";
1819  }
1820  else
1821  {
1822  static bool dotTransparent = Config_getBool("DOT_TRANSPARENT");
1823  if (!dotTransparent)
1824  {
1825  t << ",color=\"" << labCol << "\", fillcolor=\"";
1826  t << "white";
1827  t << "\", style=\"filled\"";
1828  }
1829  else
1830  {
1831  t << ",color=\"" << labCol << "\"";
1832  }
1833  if (!m_url.isEmpty())
1834  {
1835  int anchorPos = m_url.findRev('#');
1836  if (anchorPos==-1)
1837  {
1838  t << ",URL=\"" << m_url << Doxygen::htmlFileExtension << "\"";
1839  }
1840  else
1841  {
1842  t << ",URL=\"" << m_url.left(anchorPos) << Doxygen::htmlFileExtension
1843  << m_url.right(m_url.length()-anchorPos) << "\"";
1844  }
1845  }
1846  if (!m_tooltip.isEmpty())
1847  {
1848  t << ",tooltip=\"" << escapeTooltip(m_tooltip) << "\"";
1849  }
1850  }
1851  t << "];" << endl;
1852 }
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
QCString m_tooltip
node&#39;s tooltip
Definition: dot.h:105
bool isEmpty() const
Definition: qcstring.h:189
static void writeBoxMemberList(FTextStream &t, char prot, MemberList *ml, ClassDef *scope, bool isStatic=FALSE, const QDict< void > *skipNames=0)
Definition: dot.cpp:1651
uint length() const
Definition: qcstring.h:195
static QCString htmlFileExtension
Definition: doxygen.h:130
static QCString convertLabel(const QCString &l)
Definition: dot.cpp:1564
bool m_isRoot
indicates if this is a root node
Definition: dot.h:113
const bool FALSE
Definition: qglobal.h:370
friend class Iterator
Definition: sortdict.h:598
QCString m_label
Definition: dot.h:54
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
static constexpr double mg
Definition: Units.h:145
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
static QCString escapeTooltip(const QCString &tooltip)
Definition: dot.cpp:1634
int reNumberNode(int number, bool doReNumbering)
Definition: dot.cpp:403
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
static QCString stripProtectionPrefix(const QCString &s)
Definition: dot.cpp:1710
QCString right(uint len) const
Definition: qcstring.cpp:231
SrcLangExt getLanguage() const
p
Definition: test.py:223
int m_number
Definition: dot.h:103
#define Config_getBool(val)
Definition: config.cpp:664
Definition: dot.h:46
QCString & insert(uint index, const char *s)
Definition: qcstring.cpp:355
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
MemberGroupSDict * getMemberGroupSDict() const
Definition: classdef.cpp:4524
ClassDef * m_classDef
class representing this node (can be 0)
Definition: dot.h:114
QCString m_label
label text
Definition: dot.h:104
MemberList * getMemberList(MemberListType lt)
Definition: classdef.cpp:4021
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)
void DotNode::writeDEF ( FTextStream t)

Definition at line 2103 of file dot.cpp.

2104 {
2105  const char* nodePrefix = " node-";
2106 
2107  t << " node = {" << endl;
2108  t << nodePrefix << "id = " << m_number << ';' << endl;
2109  t << nodePrefix << "label = '" << m_label << "';" << endl;
2110 
2111  if (!m_url.isEmpty())
2112  {
2113  QCString url(m_url);
2114  const char *refPtr = url.data();
2115  char *urlPtr = strchr(url.rawData(),'$');
2116  if (urlPtr)
2117  {
2118  *urlPtr++='\0';
2119  t << nodePrefix << "link = {" << endl << " "
2120  << nodePrefix << "link-id = '" << urlPtr << "';" << endl;
2121 
2122  if (*refPtr!='\0')
2123  {
2124  t << " " << nodePrefix << "link-external = '"
2125  << refPtr << "';" << endl;
2126  }
2127  t << " };" << endl;
2128  }
2129  }
2130  if (m_children)
2131  {
2134  DotNode *childNode;
2135  EdgeInfo *edgeInfo;
2136  for (;(childNode=nli.current());++nli,++eli)
2137  {
2138  edgeInfo=eli.current();
2139  t << " node-child = {" << endl;
2140  t << " child-id = '" << childNode->m_number << "';" << endl;
2141  t << " relation = ";
2142 
2143  switch(edgeInfo->m_color)
2144  {
2145  case EdgeInfo::Blue: t << "public-inheritance"; break;
2146  case EdgeInfo::Green: t << "protected-inheritance"; break;
2147  case EdgeInfo::Red: t << "private-inheritance"; break;
2148  case EdgeInfo::Purple: t << "usage"; break;
2149  case EdgeInfo::Orange: t << "template-instance"; break;
2150  case EdgeInfo::Orange2: t << "type-constraint"; break;
2151  case EdgeInfo::Grey: ASSERT(0); break;
2152  }
2153  t << ';' << endl;
2154 
2155  if (!edgeInfo->m_label.isEmpty())
2156  {
2157  t << " edgelabel = <<_EnD_oF_dEf_TeXt_" << endl
2158  << edgeInfo->m_label << endl
2159  << "_EnD_oF_dEf_TeXt_;" << endl;
2160  }
2161  t << " }; /* node-child */" << endl;
2162  } /* for (;childNode...) */
2163  }
2164  t << " }; /* node */" << endl;
2165 }
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
bool isEmpty() const
Definition: qcstring.h:189
Definition: dot.h:60
QCString m_label
Definition: dot.h:54
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
int m_color
Definition: dot.h:52
int m_number
Definition: dot.h:103
Definition: dot.h:46
QCString m_label
label text
Definition: dot.h:104
QTextStream & endl(QTextStream &s)
#define ASSERT(x)
Definition: qglobal.h:590
void DotNode::writeDocbook ( FTextStream t,
bool  isClassGraph 
)

Definition at line 2033 of file dot.cpp.

2034 {
2035  t << " <node id=\"" << m_number << "\">" << endl;
2036  t << " <label>" << convertToXML(m_label) << "</label>" << endl;
2037  if (!m_url.isEmpty())
2038  {
2039  QCString url(m_url);
2040  const char *refPtr = url.data();
2041  char *urlPtr = strchr(url.rawData(),'$');
2042  if (urlPtr)
2043  {
2044  *urlPtr++='\0';
2045  t << " <link refid=\"" << convertToXML(urlPtr) << "\"";
2046  if (*refPtr!='\0')
2047  {
2048  t << " external=\"" << convertToXML(refPtr) << "\"";
2049  }
2050  t << "/>" << endl;
2051  }
2052  }
2053  if (m_children)
2054  {
2057  DotNode *childNode;
2058  EdgeInfo *edgeInfo;
2059  for (;(childNode=nli.current());++nli,++eli)
2060  {
2061  edgeInfo=eli.current();
2062  t << " <childnode refid=\"" << childNode->m_number << "\" relation=\"";
2063  if (isClassGraph)
2064  {
2065  switch(edgeInfo->m_color)
2066  {
2067  case EdgeInfo::Blue: t << "public-inheritance"; break;
2068  case EdgeInfo::Green: t << "protected-inheritance"; break;
2069  case EdgeInfo::Red: t << "private-inheritance"; break;
2070  case EdgeInfo::Purple: t << "usage"; break;
2071  case EdgeInfo::Orange: t << "template-instance"; break;
2072  case EdgeInfo::Orange2: t << "type-constraint"; break;
2073  case EdgeInfo::Grey: ASSERT(0); break;
2074  }
2075  }
2076  else // include graph
2077  {
2078  t << "include";
2079  }
2080  t << "\">" << endl;
2081  if (!edgeInfo->m_label.isEmpty())
2082  {
2083  int p=0;
2084  int ni;
2085  while ((ni=edgeInfo->m_label.find('\n',p))!=-1)
2086  {
2087  t << " <edgelabel>"
2088  << convertToXML(edgeInfo->m_label.mid(p,ni-p))
2089  << "</edgelabel>" << endl;
2090  p=ni+1;
2091  }
2092  t << " <edgelabel>"
2093  << convertToXML(edgeInfo->m_label.right(edgeInfo->m_label.length()-p))
2094  << "</edgelabel>" << endl;
2095  }
2096  t << " </childnode>" << endl;
2097  }
2098  }
2099  t << " </node>" << endl;
2100 }
QCString convertToXML(const char *s)
Definition: util.cpp:5717
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
Definition: dot.h:60
QCString m_label
Definition: dot.h:54
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
QCString right(uint len) const
Definition: qcstring.cpp:231
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
int m_color
Definition: dot.h:52
p
Definition: test.py:223
int m_number
Definition: dot.h:103
Definition: dot.h:46
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString m_label
label text
Definition: dot.h:104
QTextStream & endl(QTextStream &s)
#define ASSERT(x)
Definition: qglobal.h:590
void DotNode::writeXML ( FTextStream t,
bool  isClassGraph 
)

Definition at line 1964 of file dot.cpp.

1965 {
1966  t << " <node id=\"" << m_number << "\">" << endl;
1967  t << " <label>" << convertToXML(m_label) << "</label>" << endl;
1968  if (!m_url.isEmpty())
1969  {
1970  QCString url(m_url);
1971  const char *refPtr = url.data();
1972  char *urlPtr = strchr(url.rawData(),'$');
1973  if (urlPtr)
1974  {
1975  *urlPtr++='\0';
1976  t << " <link refid=\"" << convertToXML(urlPtr) << "\"";
1977  if (*refPtr!='\0')
1978  {
1979  t << " external=\"" << convertToXML(refPtr) << "\"";
1980  }
1981  t << "/>" << endl;
1982  }
1983  }
1984  if (m_children)
1985  {
1988  DotNode *childNode;
1989  EdgeInfo *edgeInfo;
1990  for (;(childNode=nli.current());++nli,++eli)
1991  {
1992  edgeInfo=eli.current();
1993  t << " <childnode refid=\"" << childNode->m_number << "\" relation=\"";
1994  if (isClassGraph)
1995  {
1996  switch(edgeInfo->m_color)
1997  {
1998  case EdgeInfo::Blue: t << "public-inheritance"; break;
1999  case EdgeInfo::Green: t << "protected-inheritance"; break;
2000  case EdgeInfo::Red: t << "private-inheritance"; break;
2001  case EdgeInfo::Purple: t << "usage"; break;
2002  case EdgeInfo::Orange: t << "template-instance"; break;
2003  case EdgeInfo::Orange2: t << "type-constraint"; break;
2004  case EdgeInfo::Grey: ASSERT(0); break;
2005  }
2006  }
2007  else // include graph
2008  {
2009  t << "include";
2010  }
2011  t << "\">" << endl;
2012  if (!edgeInfo->m_label.isEmpty())
2013  {
2014  int p=0;
2015  int ni;
2016  while ((ni=edgeInfo->m_label.find('\n',p))!=-1)
2017  {
2018  t << " <edgelabel>"
2019  << convertToXML(edgeInfo->m_label.mid(p,ni-p))
2020  << "</edgelabel>" << endl;
2021  p=ni+1;
2022  }
2023  t << " <edgelabel>"
2024  << convertToXML(edgeInfo->m_label.right(edgeInfo->m_label.length()-p))
2025  << "</edgelabel>" << endl;
2026  }
2027  t << " </childnode>" << endl;
2028  }
2029  }
2030  t << " </node>" << endl;
2031 }
QCString convertToXML(const char *s)
Definition: util.cpp:5717
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
Definition: dot.h:60
QCString m_label
Definition: dot.h:54
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
QCString m_url
url of the node (format: remote$local)
Definition: dot.h:106
QCString right(uint len) const
Definition: qcstring.cpp:231
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
int m_color
Definition: dot.h:52
p
Definition: test.py:223
int m_number
Definition: dot.h:103
Definition: dot.h:46
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString m_label
label text
Definition: dot.h:104
QTextStream & endl(QTextStream &s)
#define ASSERT(x)
Definition: qglobal.h:590

Friends And Related Function Documentation

QCString computeMd5Signature ( DotNode root,
DotNode::GraphType  gt,
GraphOutputFormat  f,
bool  lrRank,
bool  renderParents,
bool  backArrows,
const QCString title,
QCString graphStr 
)
friend

Computes a 16 byte md5 checksum for a given dot graph. The md5 checksum is returned as a 32 character ASCII string.

Definition at line 3018 of file dot.cpp.

3027 {
3028  bool reNumber=TRUE;
3029 
3030  //printf("computeMd5Signature\n");
3031  QGString buf;
3032  FTextStream md5stream(&buf);
3033  writeGraphHeader(md5stream,title);
3034  if (lrRank)
3035  {
3036  md5stream << " rankdir=\"LR\";" << endl;
3037  }
3038  root->clearWriteFlag();
3039  root->write(md5stream,
3040  gt,
3041  format,
3043  TRUE,
3044  backArrows,
3045  reNumber);
3046  if (renderParents && root->m_parents)
3047  {
3048  QListIterator<DotNode> dnli(*root->m_parents);
3049  DotNode *pn;
3050  for (dnli.toFirst();(pn=dnli.current());++dnli)
3051  {
3052  if (pn->isVisible())
3053  {
3054  root->writeArrow(md5stream, // stream
3055  gt, // graph type
3056  format, // output format
3057  pn, // child node
3058  pn->m_edgeInfo->at(pn->m_children->findRef(root)), // edge info
3059  FALSE, // topDown?
3060  backArrows, // point back?
3061  reNumber // renumber nodes
3062  );
3063  }
3064  pn->write(md5stream, // stream
3065  gt, // graph type
3066  format, // output format
3067  TRUE, // topDown?
3068  FALSE, // toChildren?
3069  backArrows, // backward pointing arrows?
3070  reNumber // renumber nodes?
3071  );
3072  }
3073  }
3074  writeGraphFooter(md5stream);
3075  uchar md5_sig[16];
3076  QCString sigStr(33);
3077  MD5Buffer((const unsigned char *)buf.data(),buf.length(),md5_sig);
3078  MD5SigToString(md5_sig,sigStr.rawData(),33);
3079  if (reNumber)
3080  {
3081  resetReNumbering();
3082  }
3083  graphStr=buf.data();
3084  //printf("md5: %s | file: %s\n",sigStr,baseName.data());
3085  return sigStr;
3086 }
QList< EdgeInfo > * m_edgeInfo
edge info for each child
Definition: dot.h:109
static void resetReNumbering()
Definition: dot.cpp:436
char * data() const
Definition: qgstring.h:42
void clearWriteFlag()
Definition: dot.cpp:2168
uint length() const
Definition: qgstring.h:40
void write(FTextStream &t, GraphType gt, GraphOutputFormat f, bool topDown, bool toChildren, bool backArrows, bool reNumber)
Definition: dot.cpp:1906
int findRef(const type *d) const
Definition: qlist.h:89
Definition: dot.h:60
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
const bool FALSE
Definition: qglobal.h:370
type * at(uint i) const
Definition: qlist.h:94
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
unsigned char uchar
Definition: nybbler.cc:11
static void writeGraphHeader(FTextStream &t, const QCString &title=QCString())
Definition: dot.cpp:251
void MD5Buffer(const unsigned char *buf, unsigned int len, unsigned char sig[16])
Definition: md5.c:275
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
void writeArrow(FTextStream &t, GraphType gt, GraphOutputFormat f, DotNode *cn, EdgeInfo *ei, bool topDown, bool pointBack=TRUE, bool reNumber=FALSE)
Definition: dot.cpp:1854
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
static void writeGraphFooter(FTextStream &t)
Definition: dot.cpp:281
void MD5SigToString(unsigned char signature[16], char *str, int len)
Definition: md5.c:285
bool isVisible() const
Definition: dot.h:89
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)
friend class DotCallGraph
friend

Definition at line 123 of file dot.h.

friend class DotClassGraph
friend

Definition at line 120 of file dot.h.

friend class DotGfxHierarchyTable
friend

Definition at line 119 of file dot.h.

friend class DotGroupCollaboration
friend

Definition at line 124 of file dot.h.

friend class DotInclDepGraph
friend

Definition at line 121 of file dot.h.

friend class DotInheritanceGraph
friend

Definition at line 125 of file dot.h.

friend class DotNodeList
friend

Definition at line 122 of file dot.h.

Member Data Documentation

QList<DotNode>* DotNode::m_children
private

list of child nodes (outgoing arrows)

Definition at line 108 of file dot.h.

ClassDef* DotNode::m_classDef
private

class representing this node (can be 0)

Definition at line 114 of file dot.h.

bool DotNode::m_deleted
private

used to mark a node as deleted

Definition at line 110 of file dot.h.

int DotNode::m_distance
private

shortest path to the root node

Definition at line 117 of file dot.h.

QList<EdgeInfo>* DotNode::m_edgeInfo
private

edge info for each child

Definition at line 109 of file dot.h.

bool DotNode::m_hasDoc
private

used to mark a node as documented

Definition at line 112 of file dot.h.

bool DotNode::m_isRoot
private

indicates if this is a root node

Definition at line 113 of file dot.h.

QCString DotNode::m_label
private

label text

Definition at line 104 of file dot.h.

int DotNode::m_number
private

Definition at line 103 of file dot.h.

QList<DotNode>* DotNode::m_parents
private

list of parent nodes (incoming arrows)

Definition at line 107 of file dot.h.

int DotNode::m_subgraphId

Definition at line 82 of file dot.h.

QCString DotNode::m_tooltip
private

node's tooltip

Definition at line 105 of file dot.h.

TruncState DotNode::m_truncated
private

does the node have non-visible children/parents

Definition at line 116 of file dot.h.

QCString DotNode::m_url
private

url of the node (format: remote$local)

Definition at line 106 of file dot.h.

bool DotNode::m_visible
private

is the node visible in the output

Definition at line 115 of file dot.h.

bool DotNode::m_written
private

used to mark a node as written

Definition at line 111 of file dot.h.


The documentation for this class was generated from the following files: