Doxygen
Loading...
Searching...
No Matches
DiagramItem Class Reference

Class representing a single node in the built-in class diagram. More...

+ Collaboration diagram for DiagramItem:

Public Member Functions

 DiagramItem (DiagramItem *p, uint32_t number, const ClassDef *cd, Protection prot, Specifier virt, const QCString &ts)
 
QCString label () const
 
QCString fileName () const
 
DiagramItemparentItem ()
 
DiagramItemList getChildren ()
 
void move (int dx, int dy)
 
uint32_t xPos () const
 
uint32_t yPos () const
 
float xfPos () const
 
float yfPos () const
 
uint32_t avgChildPos () const
 
uint32_t numChildren () const
 
void addChild (DiagramItem *di)
 
uint32_t number () const
 
Protection protection () const
 
Specifier virtualness () const
 
void putInList ()
 
bool isInList () const
 
const ClassDefgetClassDef () const
 

Private Attributes

DiagramItemList m_children
 
DiagramItemm_parent
 
uint32_t m_x = 0
 
uint32_t m_y = 0
 
uint32_t m_num
 
Protection m_prot
 
Specifier m_virt
 
QCString m_templSpec
 
bool m_inList = false
 
const ClassDefm_classDef
 

Detailed Description

Class representing a single node in the built-in class diagram.

Definition at line 41 of file diagram.cpp.

Constructor & Destructor Documentation

◆ DiagramItem()

DiagramItem::DiagramItem ( DiagramItem * p,
uint32_t number,
const ClassDef * cd,
Protection prot,
Specifier virt,
const QCString & ts )

Definition at line 297 of file diagram.cpp.

299 : m_parent(p), m_num(number), m_prot(pr), m_virt(vi), m_templSpec(ts), m_classDef(cd)
300{
301}
Specifier m_virt
Definition diagram.cpp:71
uint32_t m_num
Definition diagram.cpp:69
uint32_t number() const
Definition diagram.cpp:58
const ClassDef * m_classDef
Definition diagram.cpp:74
DiagramItem * m_parent
Definition diagram.cpp:66
QCString m_templSpec
Definition diagram.cpp:72
Protection m_prot
Definition diagram.cpp:70

References DiagramItem(), m_classDef, m_num, m_parent, m_prot, m_templSpec, m_virt, and number().

Referenced by addChild(), avgChildPos(), DiagramItem(), and parentItem().

Member Function Documentation

◆ addChild()

void DiagramItem::addChild ( DiagramItem * di)

Definition at line 349 of file diagram.cpp.

350{
351 m_children.push_back(di);
352}
DiagramItemList m_children
Definition diagram.cpp:65

References DiagramItem(), and m_children.

◆ avgChildPos()

uint32_t DiagramItem::avgChildPos ( ) const

Definition at line 330 of file diagram.cpp.

331{
332 DiagramItem *di = nullptr;
333 size_t c=m_children.size();
334 if (c==0) // no children -> don't move
335 return xPos();
336 if ((di=m_children.front())->isInList()) // children should be in a list
337 return di->xPos();
338 if (c&1) // odd number of children -> get pos of middle child
339 return m_children.at(c/2)->xPos();
340 else // even number of children -> get middle of most middle children
341 return (m_children.at(c/2-1)->xPos()+m_children.at(c/2)->xPos())/2;
342}
DiagramItem(DiagramItem *p, uint32_t number, const ClassDef *cd, Protection prot, Specifier virt, const QCString &ts)
Definition diagram.cpp:297
uint32_t xPos() const
Definition diagram.cpp:51

References DiagramItem(), m_children, and xPos().

Referenced by TreeDiagram::layoutTree().

◆ fileName()

QCString DiagramItem::fileName ( ) const

Definition at line 325 of file diagram.cpp.

326{
327 return m_classDef->getOutputFileBase();
328}

References m_classDef.

◆ getChildren()

DiagramItemList DiagramItem::getChildren ( )
inline

Definition at line 49 of file diagram.cpp.

49{ return m_children; }

References m_children.

Referenced by TreeDiagram::drawConnectors(), TreeDiagram::layoutTree(), and TreeDiagram::moveChildren().

◆ getClassDef()

const ClassDef * DiagramItem::getClassDef ( ) const
inline

Definition at line 63 of file diagram.cpp.

63{ return m_classDef; }

References m_classDef.

Referenced by TreeDiagram::drawBoxes().

◆ isInList()

bool DiagramItem::isInList ( ) const
inline

Definition at line 62 of file diagram.cpp.

62{ return m_inList; }
bool m_inList
Definition diagram.cpp:73

References m_inList.

Referenced by TreeDiagram::drawBoxes(), and TreeDiagram::drawConnectors().

◆ label()

QCString DiagramItem::label ( ) const

Definition at line 303 of file diagram.cpp.

304{
305 QCString result;
306 if (!m_templSpec.isEmpty())
307 {
308 // we use classDef->name() here and not displayName() in order
309 // to get the name used in the inheritance relation.
310 QCString n = m_classDef->name();
311 if (n.endsWith("-p"))
312 {
313 n = n.left(n.length()-2);
314 }
316 }
317 else
318 {
319 result=m_classDef->displayName();
320 }
321 if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result);
322 return result;
323}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
bool endsWith(const char *s) const
Definition qcstring.h:509
QCString left(size_t len) const
Definition qcstring.h:214
#define Config_getBool(name)
Definition config.h:33
QCString insertTemplateSpecifierInScope(const QCString &scope, const QCString &templ)
Definition util.cpp:4100
QCString stripScope(const QCString &name)
Definition util.cpp:4133

References Config_getBool, QCString::endsWith(), insertTemplateSpecifierInScope(), QCString::left(), QCString::length(), m_classDef, m_templSpec, and stripScope().

Referenced by writeBitmapBox(), and writeVectorBox().

◆ move()

void DiagramItem::move ( int dx,
int dy )
inline

Definition at line 50 of file diagram.cpp.

50{ m_x=static_cast<uint32_t>(m_x+dx); m_y=static_cast<uint32_t>(m_y+dy); }
uint32_t m_x
Definition diagram.cpp:67
uint32_t m_y
Definition diagram.cpp:68

References m_x, and m_y.

Referenced by ClassDiagram::ClassDiagram(), and TreeDiagram::computeLayout().

◆ number()

uint32_t DiagramItem::number ( ) const
inline

Definition at line 58 of file diagram.cpp.

58{ return m_num; }

References m_num.

Referenced by DiagramItem(), and TreeDiagram::layoutTree().

◆ numChildren()

uint32_t DiagramItem::numChildren ( ) const

Definition at line 344 of file diagram.cpp.

345{
346 return static_cast<uint32_t>(m_children.size());
347}

References m_children.

Referenced by TreeDiagram::computeLayout(), TreeDiagram::drawBoxes(), and TreeDiagram::layoutTree().

◆ parentItem()

DiagramItem * DiagramItem::parentItem ( )
inline

◆ protection()

Protection DiagramItem::protection ( ) const
inline

Definition at line 59 of file diagram.cpp.

59{ return m_prot; }

References m_prot.

Referenced by TreeDiagram::drawConnectors().

◆ putInList()

void DiagramItem::putInList ( )
inline

Definition at line 61 of file diagram.cpp.

61{ m_inList=TRUE; }
#define TRUE
Definition qcstring.h:37

References m_inList, and TRUE.

◆ virtualness()

Specifier DiagramItem::virtualness ( ) const
inline

Definition at line 60 of file diagram.cpp.

60{ return m_virt; }

References m_virt.

Referenced by writeBitmapBox(), and writeVectorBox().

◆ xfPos()

float DiagramItem::xfPos ( ) const
inline

Definition at line 53 of file diagram.cpp.

53{ return static_cast<float>(m_x); }

References m_x.

Referenced by TreeDiagram::drawBoxes(), and TreeDiagram::drawConnectors().

◆ xPos()

uint32_t DiagramItem::xPos ( ) const
inline

◆ yfPos()

float DiagramItem::yfPos ( ) const
inline

Definition at line 54 of file diagram.cpp.

54{ return static_cast<float>(m_y); }

References m_y.

Referenced by TreeDiagram::drawBoxes(), and TreeDiagram::drawConnectors().

◆ yPos()

uint32_t DiagramItem::yPos ( ) const
inline

Definition at line 52 of file diagram.cpp.

52{ return m_y; }

References m_y.

Referenced by TreeDiagram::drawBoxes(), and TreeDiagram::drawConnectors().

Member Data Documentation

◆ m_children

DiagramItemList DiagramItem::m_children
private

Definition at line 65 of file diagram.cpp.

Referenced by addChild(), avgChildPos(), getChildren(), and numChildren().

◆ m_classDef

const ClassDef* DiagramItem::m_classDef
private

Definition at line 74 of file diagram.cpp.

Referenced by DiagramItem(), fileName(), getClassDef(), and label().

◆ m_inList

bool DiagramItem::m_inList = false
private

Definition at line 73 of file diagram.cpp.

Referenced by isInList(), and putInList().

◆ m_num

uint32_t DiagramItem::m_num
private

Definition at line 69 of file diagram.cpp.

Referenced by DiagramItem(), and number().

◆ m_parent

DiagramItem* DiagramItem::m_parent
private

Definition at line 66 of file diagram.cpp.

Referenced by DiagramItem(), and parentItem().

◆ m_prot

Protection DiagramItem::m_prot
private

Definition at line 70 of file diagram.cpp.

Referenced by DiagramItem(), and protection().

◆ m_templSpec

QCString DiagramItem::m_templSpec
private

Definition at line 72 of file diagram.cpp.

Referenced by DiagramItem(), and label().

◆ m_virt

Specifier DiagramItem::m_virt
private

Definition at line 71 of file diagram.cpp.

Referenced by DiagramItem(), and virtualness().

◆ m_x

uint32_t DiagramItem::m_x = 0
private

Definition at line 67 of file diagram.cpp.

Referenced by move(), xfPos(), and xPos().

◆ m_y

uint32_t DiagramItem::m_y = 0
private

Definition at line 68 of file diagram.cpp.

Referenced by move(), yfPos(), and yPos().


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