Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
DotClassGraph Class Reference

#include <dot.h>

Public Member Functions

 DotClassGraph (ClassDef *cd, DotNode::GraphType t)
 
 ~DotClassGraph ()
 
bool isTrivial () const
 
bool isTooBig () const
 
QCString writeGraph (FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE, bool imageMap=TRUE, int graphId=-1) const
 
void writeXML (FTextStream &t)
 
void writeDocbook (FTextStream &t)
 
void writeDEF (FTextStream &t)
 
QCString diskName () const
 

Private Member Functions

void buildGraph (ClassDef *cd, DotNode *n, bool base, int distance)
 
bool determineVisibleNodes (DotNode *rootNode, int maxNodes, bool includeParents)
 
void determineTruncatedNodes (QList< DotNode > &queue, bool includeParents)
 
void addClass (ClassDef *cd, DotNode *n, int prot, const char *label, const char *usedName, const char *templSpec, bool base, int distance)
 

Private Attributes

DotNodem_startNode
 
QDict< DotNode > * m_usedNodes
 
DotNode::GraphType m_graphType
 
QCString m_diskName
 
bool m_lrRank
 

Static Private Attributes

static int m_curNodeNumber = 0
 

Detailed Description

Representation of a class inheritance or dependency graph

Definition at line 168 of file dot.h.

Constructor & Destructor Documentation

DotClassGraph::DotClassGraph ( ClassDef cd,
DotNode::GraphType  t 
)

Definition at line 2939 of file dot.cpp.

2940 {
2941  //printf("--------------- DotClassGraph::DotClassGraph `%s'\n",cd->displayName().data());
2942  m_graphType = t;
2943  QCString tmp_url="";
2944  if (cd->isLinkable() && !cd->isHidden())
2945  {
2946  tmp_url=cd->getReference()+"$"+cd->getOutputFileBase();
2947  if (!cd->anchor().isEmpty())
2948  {
2949  tmp_url+="#"+cd->anchor();
2950  }
2951  }
2952  QCString className = cd->displayName();
2953  QCString tooltip = cd->briefDescriptionAsTooltip();
2955  className,
2956  tooltip,
2957  tmp_url.data(),
2958  TRUE, // is a root node
2959  cd
2960  );
2962  m_usedNodes = new QDict<DotNode>(1009);
2963  m_usedNodes->insert(className,m_startNode);
2964 
2965  //printf("Root node %s\n",cd->name().data());
2966  //if (m_recDepth>0)
2967  //{
2968  buildGraph(cd,m_startNode,TRUE,1);
2970  //}
2971 
2972  static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
2973  //int directChildNodes = 1;
2974  //if (m_startNode->m_children!=0)
2975  // directChildNodes+=m_startNode->m_children->count();
2976  //if (t==DotNode::Inheritance && m_startNode->m_parents!=0)
2977  // directChildNodes+=m_startNode->m_parents->count();
2978  //if (directChildNodes>maxNodes) maxNodes=directChildNodes;
2979  //openNodeQueue.append(m_startNode);
2981  QList<DotNode> openNodeQueue;
2982  openNodeQueue.append(m_startNode);
2984 
2985  m_diskName = cd->getFileBase().copy();
2986 }
bool m_lrRank
Definition: dot.h:197
bool determineVisibleNodes(DotNode *rootNode, int maxNodes, bool includeParents)
Definition: dot.cpp:2709
bool isEmpty() const
Definition: qcstring.h:189
void append(const type *d)
Definition: qlist.h:73
Definition: dot.h:60
const bool FALSE
Definition: qglobal.h:370
static QCString className
Definition: declinfo.cpp:669
QCString displayName(bool includeScope=TRUE) const
Definition: classdef.cpp:312
QCString getReference() const
Definition: classdef.cpp:3814
QCString copy() const
Definition: qcstring.h:250
#define Config_getInt(val)
Definition: config.cpp:661
void buildGraph(ClassDef *cd, DotNode *n, bool base, int distance)
Definition: dot.cpp:2804
QCString getFileBase() const
Definition: classdef.cpp:3591
void setDistance(int distance)
Definition: dot.cpp:1559
QCString anchor() const
Definition: classdef.cpp:4606
void determineTruncatedNodes(QList< DotNode > &queue, bool includeParents)
Definition: dot.cpp:2672
const char * data() const
Definition: qcstring.h:207
bool isLinkable() const
Definition: classdef.cpp:2729
QCString m_diskName
Definition: dot.h:196
DotNode * m_startNode
Definition: dot.h:192
QCString getOutputFileBase() const
Definition: classdef.cpp:3533
bool isHidden() const
static int m_curNodeNumber
Definition: dot.h:194
QCString briefDescriptionAsTooltip() const
QDict< DotNode > * m_usedNodes
Definition: dot.h:193
const bool TRUE
Definition: qglobal.h:371
DotNode::GraphType m_graphType
Definition: dot.h:195
DotClassGraph::~DotClassGraph ( )

Definition at line 3009 of file dot.cpp.

3010 {
3012  delete m_usedNodes;
3013 }
static void deleteNodes(DotNode *node, SDict< DotNode > *skipNodes=0)
Definition: dot.cpp:1443
DotNode * m_startNode
Definition: dot.h:192
QDict< DotNode > * m_usedNodes
Definition: dot.h:193

Member Function Documentation

void DotClassGraph::addClass ( ClassDef cd,
DotNode n,
int  prot,
const char *  label,
const char *  usedName,
const char *  templSpec,
bool  base,
int  distance 
)
private

Definition at line 2590 of file dot.cpp.

2592 {
2593  if (Config_getBool("HIDE_UNDOC_CLASSES") && !cd->isLinkable()) return;
2594 
2595  int edgeStyle = (label || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid;
2597  if (cd->isAnonymous())
2598  {
2599  className="anonymous:";
2600  className+=label;
2601  }
2602  else if (usedName) // name is a typedef
2603  {
2604  className=usedName;
2605  }
2606  else if (templSpec) // name has a template part
2607  {
2608  className=insertTemplateSpecifierInScope(cd->name(),templSpec);
2609  }
2610  else // just a normal name
2611  {
2612  className=cd->displayName();
2613  }
2614  //printf("DotClassGraph::addClass(class=`%s',parent=%s,prot=%d,label=%s,dist=%d,usedName=%s,templSpec=%s,base=%d)\n",
2615  // className.data(),n->m_label.data(),prot,label,distance,usedName,templSpec,base);
2616  DotNode *bn = m_usedNodes->find(className);
2617  if (bn) // class already inserted
2618  {
2619  if (base)
2620  {
2621  n->addChild(bn,prot,edgeStyle,label);
2622  bn->addParent(n);
2623  }
2624  else
2625  {
2626  bn->addChild(n,prot,edgeStyle,label);
2627  n->addParent(bn);
2628  }
2629  bn->setDistance(distance);
2630  //printf(" add exiting node %s of %s\n",bn->m_label.data(),n->m_label.data());
2631  }
2632  else // new class
2633  {
2634  QCString displayName=className;
2635  if (Config_getBool("HIDE_SCOPE_NAMES")) displayName=stripScope(displayName);
2636  QCString tmp_url;
2637  if (cd->isLinkable() && !cd->isHidden())
2638  {
2639  tmp_url=cd->getReference()+"$"+cd->getOutputFileBase();
2640  if (!cd->anchor().isEmpty())
2641  {
2642  tmp_url+="#"+cd->anchor();
2643  }
2644  }
2645  QCString tooltip = cd->briefDescriptionAsTooltip();
2646  bn = new DotNode(m_curNodeNumber++,
2647  displayName,
2648  tooltip,
2649  tmp_url.data(),
2650  FALSE, // rootNode
2651  cd
2652  );
2653  if (base)
2654  {
2655  n->addChild(bn,prot,edgeStyle,label);
2656  bn->addParent(n);
2657  }
2658  else
2659  {
2660  bn->addChild(n,prot,edgeStyle,label);
2661  n->addParent(bn);
2662  }
2663  bn->setDistance(distance);
2664  m_usedNodes->insert(className,bn);
2665  //printf(" add new child node `%s' to %s hidden=%d url=%s\n",
2666  // className.data(),n->m_label.data(),cd->isHidden(),tmp_url.data());
2667 
2668  buildGraph(cd,bn,base,distance+1);
2669  }
2670 }
void addParent(DotNode *n)
Definition: dot.cpp:1507
bool isEmpty() const
Definition: qcstring.h:189
Definition: dot.h:60
const bool FALSE
Definition: qglobal.h:370
static QCString className
Definition: declinfo.cpp:669
QCString displayName(bool includeScope=TRUE) const
Definition: classdef.cpp:312
void addChild(DotNode *n, int edgeColor=EdgeInfo::Purple, int edgeStyle=EdgeInfo::Solid, const char *edgeLab=0, const char *edgeURL=0, int edgeLabCol=-1)
Definition: dot.cpp:1480
QCString getReference() const
Definition: classdef.cpp:3814
void buildGraph(ClassDef *cd, DotNode *n, bool base, int distance)
Definition: dot.cpp:2804
const QCString & name() const
Definition: definition.h:114
void setDistance(int distance)
Definition: dot.cpp:1559
bool isAnonymous() const
Definition: classdef.cpp:4749
QCString anchor() const
Definition: classdef.cpp:4606
const char * data() const
Definition: qcstring.h:207
bool isLinkable() const
Definition: classdef.cpp:2729
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
#define Config_getBool(val)
Definition: config.cpp:664
QCString getOutputFileBase() const
Definition: classdef.cpp:3533
bool isHidden() const
QCString stripScope(const char *name)
Definition: util.cpp:5605
static int m_curNodeNumber
Definition: dot.h:194
QCString insertTemplateSpecifierInScope(const QCString &scope, const QCString &templ)
Definition: util.cpp:5527
QCString briefDescriptionAsTooltip() const
QDict< DotNode > * m_usedNodes
Definition: dot.h:193
void DotClassGraph::buildGraph ( ClassDef cd,
DotNode n,
bool  base,
int  distance 
)
private

Definition at line 2804 of file dot.cpp.

2805 {
2806  static bool templateRelations = Config_getBool("TEMPLATE_RELATIONS");
2807  //printf("DocClassGraph::buildGraph(%s,distance=%d,base=%d)\n",
2808  // cd->name().data(),distance,base);
2809  // ---- Add inheritance relations
2810 
2812  {
2813  BaseClassList *bcl = base ? cd->baseClasses() : cd->subClasses();
2814  if (bcl)
2815  {
2816  BaseClassListIterator bcli(*bcl);
2817  BaseClassDef *bcd;
2818  for ( ; (bcd=bcli.current()) ; ++bcli )
2819  {
2820  //printf("-------- inheritance relation %s->%s templ=`%s'\n",
2821  // cd->name().data(),bcd->classDef->name().data(),bcd->templSpecifiers.data());
2822  addClass(bcd->classDef,n,bcd->prot,0,bcd->usedName,
2823  bcd->templSpecifiers,base,distance);
2824  }
2825  }
2826  }
2828  {
2829  // ---- Add usage relations
2830 
2831  UsesClassDict *dict =
2834  ;
2835  if (dict)
2836  {
2837  UsesClassDictIterator ucdi(*dict);
2838  UsesClassDef *ucd;
2839  for (;(ucd=ucdi.current());++ucdi)
2840  {
2841  QCString label;
2842  QDictIterator<void> dvi(*ucd->accessors);
2843  const char *s;
2844  bool first=TRUE;
2845  int count=0;
2846  int maxLabels=10;
2847  for (;(s=dvi.currentKey()) && count<maxLabels;++dvi,++count)
2848  {
2849  if (first)
2850  {
2851  label=s;
2852  first=FALSE;
2853  }
2854  else
2855  {
2856  label+=QCString("\n")+s;
2857  }
2858  }
2859  if (count==maxLabels) label+="\n...";
2860  //printf("addClass: %s templSpec=%s\n",ucd->classDef->name().data(),ucd->templSpecifiers.data());
2861  addClass(ucd->classDef,n,EdgeInfo::Purple,label,0,
2863  }
2864  }
2865  }
2866  if (templateRelations && base)
2867  {
2869  if (dict)
2870  {
2871  ConstraintClassDictIterator ccdi(*dict);
2872  ConstraintClassDef *ccd;
2873  for (;(ccd=ccdi.current());++ccdi)
2874  {
2875  QCString label;
2876  QDictIterator<void> dvi(*ccd->accessors);
2877  const char *s;
2878  bool first=TRUE;
2879  int count=0;
2880  int maxLabels=10;
2881  for (;(s=dvi.currentKey()) && count<maxLabels;++dvi,++count)
2882  {
2883  if (first)
2884  {
2885  label=s;
2886  first=FALSE;
2887  }
2888  else
2889  {
2890  label+=QCString("\n")+s;
2891  }
2892  }
2893  if (count==maxLabels) label+="\n...";
2894  //printf("addClass: %s templSpec=%s\n",ucd->classDef->name().data(),ucd->templSpecifiers.data());
2895  addClass(ccd->classDef,n,EdgeInfo::Orange2,label,0,
2896  0,TRUE,distance);
2897  }
2898  }
2899  }
2900 
2901  // ---- Add template instantiation relations
2902 
2903  if (templateRelations)
2904  {
2905  if (base) // template relations for base classes
2906  {
2907  ClassDef *templMaster=cd->templateMaster();
2908  if (templMaster)
2909  {
2910  QDictIterator<ClassDef> cli(*templMaster->getTemplateInstances());
2911  ClassDef *templInstance;
2912  for (;(templInstance=cli.current());++cli)
2913  {
2914  if (templInstance==cd)
2915  {
2916  addClass(templMaster,n,EdgeInfo::Orange,cli.currentKey(),0,
2917  0,TRUE,distance);
2918  }
2919  }
2920  }
2921  }
2922  else // template relations for super classes
2923  {
2924  QDict<ClassDef> *templInstances = cd->getTemplateInstances();
2925  if (templInstances)
2926  {
2927  QDictIterator<ClassDef> cli(*templInstances);
2928  ClassDef *templInstance;
2929  for (;(templInstance=cli.current());++cli)
2930  {
2931  addClass(templInstance,n,EdgeInfo::Orange,cli.currentKey(),0,
2932  0,FALSE,distance);
2933  }
2934  }
2935  }
2936  }
2937 }
ClassDef * classDef
Definition: classdef.h:520
BaseClassList * subClasses() const
Definition: classdef.cpp:4404
void addClass(ClassDef *cd, DotNode *n, int prot, const char *label, const char *usedName, const char *templSpec, bool base, int distance)
Definition: dot.cpp:2590
QDict< void > * accessors
Definition: classdef.h:597
const bool FALSE
Definition: qglobal.h:370
Protection prot
Definition: classdef.h:530
ClassDef * classDef
Definition: classdef.h:477
QCString templSpecifiers
Definition: classdef.h:485
ClassDef * templateMaster() const
Definition: classdef.cpp:4439
def cli(ctx)
Definition: main.py:7
ConstraintClassDict * templateTypeConstraints() const
Definition: classdef.cpp:4469
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
#define Config_getBool(val)
Definition: config.cpp:664
UsesClassDict * usedByImplementationClasses() const
Definition: classdef.cpp:4459
QCString templSpecifiers
Definition: classdef.h:538
QDict< ClassDef > * getTemplateInstances() const
Definition: classdef.cpp:4434
QCString usedName
Definition: classdef.h:525
UsesClassDict * usedImplementationClasses() const
Definition: classdef.cpp:4454
ClassDef * classDef
Definition: classdef.h:592
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
BaseClassList * baseClasses() const
Definition: classdef.cpp:4399
DotNode::GraphType m_graphType
Definition: dot.h:195
QDict< void > * accessors
Definition: classdef.h:482
void DotClassGraph::determineTruncatedNodes ( QList< DotNode > &  queue,
bool  includeParents 
)
private

Definition at line 2672 of file dot.cpp.

2673 {
2674  while (queue.count()>0)
2675  {
2676  DotNode *n = queue.take(0);
2677  if (n->isVisible() && n->isTruncated()==DotNode::Unknown)
2678  {
2679  bool truncated = FALSE;
2680  if (n->m_children)
2681  {
2683  DotNode *dn;
2684  for (li.toFirst();(dn=li.current());++li)
2685  {
2686  if (!dn->isVisible())
2687  truncated = TRUE;
2688  else
2689  queue.append(dn);
2690  }
2691  }
2692  if (n->m_parents && includeParents)
2693  {
2695  DotNode *dn;
2696  for (li.toFirst();(dn=li.current());++li)
2697  {
2698  if (!dn->isVisible())
2699  truncated = TRUE;
2700  else
2701  queue.append(dn);
2702  }
2703  }
2704  n->markAsTruncated(truncated);
2705  }
2706  }
2707 }
void append(const type *d)
Definition: qlist.h:73
Definition: dot.h:60
TruncState isTruncated() const
Definition: dot.h:90
const bool FALSE
Definition: qglobal.h:370
uint count() const
Definition: qlist.h:66
std::void_t< T > n
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
void markAsTruncated(bool b=TRUE)
Definition: dot.h:102
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
type * take(uint i)
Definition: qlist.h:81
bool isVisible() const
Definition: dot.h:89
const bool TRUE
Definition: qglobal.h:371
bool DotClassGraph::determineVisibleNodes ( DotNode rootNode,
int  maxNodes,
bool  includeParents 
)
private

Definition at line 2709 of file dot.cpp.

2711 {
2712  QList<DotNode> childQueue;
2713  QList<DotNode> parentQueue;
2714  QArray<int> childTreeWidth;
2715  QArray<int> parentTreeWidth;
2716  childQueue.append(rootNode);
2717  if (includeParents) parentQueue.append(rootNode);
2718  bool firstNode=TRUE; // flag to force reprocessing rootNode in the parent loop
2719  // despite being marked visible in the child loop
2720  while ((childQueue.count()>0 || parentQueue.count()>0) && maxNodes>0)
2721  {
2722  static int maxDistance = Config_getInt("MAX_DOT_GRAPH_DEPTH");
2723  if (childQueue.count()>0)
2724  {
2725  DotNode *n = childQueue.take(0);
2726  int distance = n->distance();
2727  if (!n->isVisible() && distance<=maxDistance) // not yet processed
2728  {
2729  if (distance>0)
2730  {
2731  int oldSize=(int)childTreeWidth.size();
2732  if (distance>oldSize)
2733  {
2734  childTreeWidth.resize(QMAX(childTreeWidth.size(),(uint)distance));
2735  int i; for (i=oldSize;i<distance;i++) childTreeWidth[i]=0;
2736  }
2737  childTreeWidth[distance-1]+=n->label().length();
2738  }
2739  n->markAsVisible();
2740  maxNodes--;
2741  // add direct children
2742  if (n->m_children)
2743  {
2745  DotNode *dn;
2746  for (li.toFirst();(dn=li.current());++li)
2747  {
2748  childQueue.append(dn);
2749  }
2750  }
2751  }
2752  }
2753  if (includeParents && parentQueue.count()>0)
2754  {
2755  DotNode *n = parentQueue.take(0);
2756  if ((!n->isVisible() || firstNode) && n->distance()<=maxDistance) // not yet processed
2757  {
2758  firstNode=FALSE;
2759  int distance = n->distance();
2760  if (distance>0)
2761  {
2762  int oldSize = (int)parentTreeWidth.size();
2763  if (distance>oldSize)
2764  {
2765  parentTreeWidth.resize(QMAX(parentTreeWidth.size(),(uint)distance));
2766  int i; for (i=oldSize;i<distance;i++) parentTreeWidth[i]=0;
2767  }
2768  parentTreeWidth[distance-1]+=n->label().length();
2769  }
2770  n->markAsVisible();
2771  maxNodes--;
2772  // add direct parents
2773  if (n->m_parents)
2774  {
2776  DotNode *dn;
2777  for (li.toFirst();(dn=li.current());++li)
2778  {
2779  parentQueue.append(dn);
2780  }
2781  }
2782  }
2783  }
2784  }
2785  if (Config_getBool("UML_LOOK")) return FALSE; // UML graph are always top to bottom
2786  int maxWidth=0;
2787  int maxHeight=(int)QMAX(childTreeWidth.size(),parentTreeWidth.size());
2788  uint i;
2789  for (i=0;i<childTreeWidth.size();i++)
2790  {
2791  if (childTreeWidth.at(i)>maxWidth) maxWidth=childTreeWidth.at(i);
2792  }
2793  for (i=0;i<parentTreeWidth.size();i++)
2794  {
2795  if (parentTreeWidth.at(i)>maxWidth) maxWidth=parentTreeWidth.at(i);
2796  }
2797  //printf("max tree width=%d, max tree height=%d\n",maxWidth,maxHeight);
2798  return maxWidth>80 && maxHeight<12; // used metric to decide to render the tree
2799  // from left to right instead of top to bottom,
2800  // with the idea to render very wide trees in
2801  // left to right order.
2802 }
uint length() const
Definition: qcstring.h:195
void append(const type *d)
Definition: qlist.h:73
bool resize(uint size)
Definition: qarray.h:69
Definition: dot.h:60
const bool FALSE
Definition: qglobal.h:370
Definition: qarray.h:46
QCString label() const
Definition: dot.h:87
int distance() const
Definition: dot.h:91
#define Config_getInt(val)
Definition: config.cpp:661
uint count() const
Definition: qlist.h:66
#define QMAX(a, b)
Definition: qglobal.h:390
std::void_t< T > n
QList< DotNode > * m_children
list of child nodes (outgoing arrows)
Definition: dot.h:108
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
QList< DotNode > * m_parents
list of parent nodes (incoming arrows)
Definition: dot.h:107
#define Config_getBool(val)
Definition: config.cpp:664
void markAsVisible(bool b=TRUE)
Definition: dot.h:101
type * take(uint i)
Definition: qlist.h:81
type & at(uint i) const
Definition: qarray.h:98
uint size() const
Definition: qarray.h:65
unsigned uint
Definition: qglobal.h:351
bool isVisible() const
Definition: dot.h:89
const bool TRUE
Definition: qglobal.h:371
QCString DotClassGraph::diskName ( ) const

Definition at line 3112 of file dot.cpp.

3113 {
3115  switch (m_graphType)
3116  {
3118  result+="_coll_graph";
3119  break;
3120  //case Interface:
3121  // result+="_intf_graph";
3122  // break;
3123  case DotNode::Inheritance:
3124  result+="_inherit_graph";
3125  break;
3126  default:
3127  ASSERT(0);
3128  break;
3129  }
3130  return result;
3131 }
static QCString result
QCString copy() const
Definition: qcstring.h:250
QCString m_diskName
Definition: dot.h:196
DotNode::GraphType m_graphType
Definition: dot.h:195
#define ASSERT(x)
Definition: qglobal.h:590
bool DotClassGraph::isTooBig ( ) const

Definition at line 2997 of file dot.cpp.

2998 {
2999  static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
3000  int numNodes = 0;
3001  numNodes+= m_startNode->m_children ? m_startNode->m_children->count() : 0;
3003  {
3004  numNodes+= m_startNode->m_parents ? m_startNode->m_parents->count() : 0;
3005  }
3006  return numNodes>=maxNodes;
3007 }
#define Config_getInt(val)
Definition: config.cpp:661
uint count() const
Definition: qlist.h:66
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
DotNode * m_startNode
Definition: dot.h:192
DotNode::GraphType m_graphType
Definition: dot.h:195
bool DotClassGraph::isTrivial ( ) const

Definition at line 2988 of file dot.cpp.

2989 {
2990  static bool umlLook = Config_getBool("UML_LOOK");
2992  return m_startNode->m_children==0 && m_startNode->m_parents==0;
2993  else
2994  return !umlLook && m_startNode->m_children==0;
2995 }
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
#define Config_getBool(val)
Definition: config.cpp:664
DotNode * m_startNode
Definition: dot.h:192
DotNode::GraphType m_graphType
Definition: dot.h:195
void DotClassGraph::writeDEF ( FTextStream t)

Definition at line 3330 of file dot.cpp.

3331 {
3332  QDictIterator<DotNode> dni(*m_usedNodes);
3333  DotNode *node;
3334  for (;(node=dni.current());++dni)
3335  {
3336  node->writeDEF(t);
3337  }
3338 }
Definition: dot.h:60
void writeDEF(FTextStream &t)
Definition: dot.cpp:2103
QDict< DotNode > * m_usedNodes
Definition: dot.h:193
void DotClassGraph::writeDocbook ( FTextStream t)

Definition at line 3320 of file dot.cpp.

3321 {
3322  QDictIterator<DotNode> dni(*m_usedNodes);
3323  DotNode *node;
3324  for (;(node=dni.current());++dni)
3325  {
3326  node->writeDocbook(t,TRUE);
3327  }
3328 }
Definition: dot.h:60
void writeDocbook(FTextStream &t, bool isClassGraph)
Definition: dot.cpp:2033
QDict< DotNode > * m_usedNodes
Definition: dot.h:193
const bool TRUE
Definition: qglobal.h:371
QCString DotClassGraph::writeGraph ( FTextStream t,
GraphOutputFormat  gf,
EmbeddedOutputFormat  ef,
const char *  path,
const char *  fileName,
const char *  relPath,
bool  TBRank = TRUE,
bool  imageMap = TRUE,
int  graphId = -1 
) const

Definition at line 3133 of file dot.cpp.

3142 {
3143  QDir d(path);
3144  // store the original directory
3145  if (!d.exists())
3146  {
3147  err("Output dir %s does not exist!\n",path); exit(1);
3148  }
3149  static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
3150 
3152  QCString mapName;
3153  switch (m_graphType)
3154  {
3156  mapName="coll_map";
3157  break;
3158  //case Interface:
3159  // mapName="intf_map";
3160  // break;
3161  case DotNode::Inheritance:
3162  mapName="inherit_map";
3163  break;
3164  default:
3165  ASSERT(0);
3166  break;
3167  }
3168  baseName = convertNameToFile(diskName());
3169 
3170  // derive target file names from baseName
3171  QCString imgExt = getDotImageExtension();
3172  QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
3173  QCString absBaseName = d.absPath().utf8()+"/"+baseName;
3174  QCString absDotName = absBaseName+".dot";
3175  QCString absMapName = absBaseName+".map";
3176  QCString absPdfName = absBaseName+".pdf";
3177  QCString absEpsName = absBaseName+".eps";
3178  QCString absImgName = absBaseName+"."+imgExt;
3179 
3180  bool regenerate = FALSE;
3182  m_graphType,
3183  absBaseName,
3184  graphFormat,
3185  m_lrRank,
3187  TRUE,
3188  m_startNode->label()
3189  ) ||
3190  !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName :
3191  usePDFLatex ? absPdfName : absEpsName,
3192  graphFormat==GOF_BITMAP && generateImageMap ? absMapName : QCString())
3193  )
3194  {
3195  regenerate=TRUE;
3196  if (graphFormat==GOF_BITMAP) // run dot to create a bitmap image
3197  {
3198  DotRunner *dotRun = new DotRunner(absDotName,
3199  d.absPath().data(),TRUE,absImgName);
3200  dotRun->addJob(imgFmt,absImgName);
3201  if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
3202  DotManager::instance()->addRun(dotRun);
3203 
3204  }
3205  else if (graphFormat==GOF_EPS) // run dot to create a .eps image
3206  {
3207  DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE);
3208  if (usePDFLatex)
3209  {
3210  dotRun->addJob("pdf",absPdfName);
3211  }
3212  else
3213  {
3214  dotRun->addJob("ps",absEpsName);
3215  }
3216  DotManager::instance()->addRun(dotRun);
3217  }
3218  }
3219  Doxygen::indexList->addImageFile(baseName+"."+imgExt);
3220 
3221  if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook)
3222  {
3223  out << "<para>" << endl;
3224  out << " <figure>" << endl;
3225  out << " <title>";
3226  switch (m_graphType)
3227  {
3229  out << "Collaboration graph";
3230  break;
3231  case DotNode::Inheritance:
3232  out << "Inheritance graph";
3233  break;
3234  default:
3235  ASSERT(0);
3236  break;
3237  }
3238  out << "</title>" << endl;
3239  out << " <mediaobject>" << endl;
3240  out << " <imageobject>" << endl;
3241  out << " <imagedata";
3242  out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << relPath << baseName << "." << imgExt << "\">";
3243  out << "</imagedata>" << endl;
3244  out << " </imageobject>" << endl;
3245  out << " </mediaobject>" << endl;
3246  out << " </figure>" << endl;
3247  out << "</para>" << endl;
3248  }
3249  else if (graphFormat==GOF_BITMAP && generateImageMap) // produce HTML to include the image
3250  {
3252  escapeCharsInString(mapName,FALSE);
3253  if (imgExt=="svg") // add link to SVG file without map file
3254  {
3255  out << "<div class=\"center\">";
3256  if (regenerate || !writeSVGFigureLink(out,relPath,baseName,absImgName)) // need to patch the links in the generated SVG file
3257  {
3258  if (regenerate)
3259  {
3260  DotManager::instance()->addSVGConversion(absImgName,relPath,FALSE,QCString(),TRUE,graphId);
3261  }
3262  int mapId = DotManager::instance()->addSVGObject(fileName,baseName,absImgName,relPath);
3263  out << "<!-- SVG " << mapId << " -->" << endl;
3264  }
3265  out << "</div>" << endl;
3266  }
3267  else // add link to bitmap file with image map
3268  {
3269  out << "<div class=\"center\">";
3270  out << "<img src=\"" << relPath << baseName << "."
3271  << imgExt << "\" border=\"0\" usemap=\"#"
3272  << mapLabel << "\" alt=\"";
3273  switch (m_graphType)
3274  {
3276  out << "Collaboration graph";
3277  break;
3278  case DotNode::Inheritance:
3279  out << "Inheritance graph";
3280  break;
3281  default:
3282  ASSERT(0);
3283  break;
3284  }
3285  out << "\"/>";
3286  out << "</div>" << endl;
3287  if (regenerate || !insertMapFile(out,absMapName,relPath,mapLabel))
3288  {
3289  int mapId = DotManager::instance()->addMap(fileName,absMapName,relPath,
3290  FALSE,QCString(),mapLabel);
3291  out << "<!-- MAP " << mapId << " -->" << endl;
3292  }
3293  }
3294  }
3295  else if (graphFormat==GOF_EPS) // produce tex to include the .eps image
3296  {
3297  if (regenerate || !writeVecGfxFigure(out,baseName,absBaseName))
3298  {
3299  int figId = DotManager::instance()->addFigure(fileName,baseName,absBaseName,FALSE /*TRUE*/);
3300  out << endl << "% FIG " << figId << endl;
3301  }
3302  }
3303  if (!regenerate) removeDotGraph(absDotName);
3304 
3305  return baseName;
3306 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
bool m_lrRank
Definition: dot.h:197
int addSVGConversion(const QCString &file, const QCString &relPath, bool urlOnly, const QCString &context, bool zoomable, int graphId)
Definition: dot.cpp:1292
QCString escapeCharsInString(const char *name, bool allowDots, bool allowUnderscore)
Definition: util.cpp:5242
static bool insertMapFile(FTextStream &out, const QCString &mapFile, const QCString &relPath, const QCString &mapLabel)
Definition: dot.cpp:694
Definition: dot.h:356
static bool checkDeliverables(const QCString &file1, const QCString &file2=QCString())
Definition: dot.cpp:758
static DotManager * instance()
Definition: dot.cpp:1221
const bool FALSE
Definition: qglobal.h:370
QCString label() const
Definition: dot.h:87
int addMap(const QCString &file, const QCString &mapFile, const QCString &relPath, bool urlOnly, const QCString &context, const QCString &label)
Definition: dot.cpp:1267
#define Config_getEnum(val)
Definition: config.cpp:663
static void removeDotGraph(const QCString &dotName)
Definition: dot.cpp:714
fileName
Definition: dumpTree.py:9
static bool updateDotGraph(DotNode *root, DotNode::GraphType gt, const QCString &baseName, GraphOutputFormat format, bool lrRank, bool renderParents, bool backArrows, const QCString &title=QCString())
Definition: dot.cpp:3088
static bool writeVecGfxFigure(FTextStream &out, const QCString &baseName, const QCString &figureName)
Definition: dot.cpp:518
int addFigure(const QCString &file, const QCString &baseName, const QCString &figureName, bool heightCheck)
Definition: dot.cpp:1280
void addImageFile(const char *name)
Definition: index.h:147
#define Config_getBool(val)
Definition: config.cpp:664
QCString getDotImageExtension(void)
Definition: util.cpp:8562
#define MAP_CMD
Definition: dot.cpp:51
QCString diskName() const
Definition: dot.cpp:3112
Definition: dot.h:42
void err(const char *fmt,...)
Definition: message.cpp:226
int addSVGObject(const QCString &file, const QCString &baseName, const QCString &figureNAme, const QCString &relPath)
Definition: dot.cpp:1305
DotNode * m_startNode
Definition: dot.h:192
void addJob(const char *format, const char *output)
Definition: dot.cpp:807
static bool writeSVGFigureLink(FTextStream &out, const QCString &relPath, const QCString &baseName, const QCString &absImgName)
Definition: dot.cpp:618
QCString convertNameToFile(const char *name, bool allowDots, bool allowUnderscore)
Definition: util.cpp:5354
QCString m_label
label text
Definition: dot.h:104
static QCString baseName
Definition: scanner.cpp:10890
Definition: dot.h:42
void addRun(DotRunner *run)
Definition: dot.cpp:1262
const bool TRUE
Definition: qglobal.h:371
static IndexList * indexList
Definition: doxygen.h:149
QTextStream & endl(QTextStream &s)
DotNode::GraphType m_graphType
Definition: dot.h:195
#define ASSERT(x)
Definition: qglobal.h:590
void DotClassGraph::writeXML ( FTextStream t)

Definition at line 3310 of file dot.cpp.

3311 {
3312  QDictIterator<DotNode> dni(*m_usedNodes);
3313  DotNode *node;
3314  for (;(node=dni.current());++dni)
3315  {
3316  node->writeXML(t,TRUE);
3317  }
3318 }
Definition: dot.h:60
void writeXML(FTextStream &t, bool isClassGraph)
Definition: dot.cpp:1964
QDict< DotNode > * m_usedNodes
Definition: dot.h:193
const bool TRUE
Definition: qglobal.h:371

Member Data Documentation

int DotClassGraph::m_curNodeNumber = 0
staticprivate

Definition at line 194 of file dot.h.

QCString DotClassGraph::m_diskName
private

Definition at line 196 of file dot.h.

DotNode::GraphType DotClassGraph::m_graphType
private

Definition at line 195 of file dot.h.

bool DotClassGraph::m_lrRank
private

Definition at line 197 of file dot.h.

DotNode* DotClassGraph::m_startNode
private

Definition at line 192 of file dot.h.

QDict<DotNode>* DotClassGraph::m_usedNodes
private

Definition at line 193 of file dot.h.


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