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

Class representing a row in the built-in class diagram. More...

+ Collaboration diagram for DiagramRow:

Public Types

using Ptr = std::unique_ptr<DiagramItem>
 
using Vec = std::vector<Ptr>
 
using iterator = typename Vec::iterator
 
using reverse_iterator = typename Vec::reverse_iterator
 

Public Member Functions

 DiagramRow (TreeDiagram *d, uint32_t l)
 
void insertClass (DiagramItem *parent, const ClassDef *cd, bool doBases, Protection prot, Specifier virt, const QCString &ts)
 
uint32_t number ()
 
DiagramItemitem (int index)
 
uint32_t numItems () const
 
iterator begin ()
 
iterator end ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 

Private Attributes

TreeDiagramm_diagram
 
uint32_t m_level
 
Vec m_items
 

Detailed Description

Class representing a row in the built-in class diagram.

Definition at line 78 of file diagram.cpp.

Member Typedef Documentation

◆ iterator

using DiagramRow::iterator = typename Vec::iterator

Definition at line 83 of file diagram.cpp.

◆ Ptr

using DiagramRow::Ptr = std::unique_ptr<DiagramItem>

Definition at line 81 of file diagram.cpp.

◆ reverse_iterator

using DiagramRow::reverse_iterator = typename Vec::reverse_iterator

Definition at line 84 of file diagram.cpp.

◆ Vec

using DiagramRow::Vec = std::vector<Ptr>

Definition at line 82 of file diagram.cpp.

Constructor & Destructor Documentation

◆ DiagramRow()

DiagramRow::DiagramRow ( TreeDiagram * d,
uint32_t l )
inline

Definition at line 85 of file diagram.cpp.

85: m_diagram(d), m_level(l) {}
TreeDiagram * m_diagram
Definition diagram.cpp:97
uint32_t m_level
Definition diagram.cpp:98

References m_diagram, and m_level.

Referenced by insertClass().

Member Function Documentation

◆ begin()

iterator DiagramRow::begin ( )
inline

Definition at line 92 of file diagram.cpp.

92{ return m_items.begin(); }
Vec m_items
Definition diagram.cpp:99

References m_items.

◆ end()

iterator DiagramRow::end ( )
inline

Definition at line 93 of file diagram.cpp.

93{ return m_items.end(); }

References m_items.

◆ insertClass()

void DiagramRow::insertClass ( DiagramItem * parent,
const ClassDef * cd,
bool doBases,
Protection prot,
Specifier virt,
const QCString & ts )

Definition at line 356 of file diagram.cpp.

358{
359 auto di = std::make_unique<DiagramItem>(parent, m_diagram->row(m_level)->numItems(),
360 cd,prot,virt,ts);
361 DiagramItem *di_ptr = di.get();
362 if (parent) parent->addChild(di_ptr);
363 di->move(static_cast<int>(m_items.size()*gridWidth),static_cast<int>(m_level*gridHeight));
364 m_items.push_back(std::move(di));
365 int count=0;
366 for (const auto &bcd : doBases ? cd->baseClasses() : cd->subClasses())
367 {
368 /* there are base/sub classes */
369 ClassDef *ccd=bcd.classDef;
370 if (ccd && ccd->isVisibleInHierarchy()) count++;
371 }
372 if (count>0 && (prot!=Protection::Private || !doBases))
373 {
374 DiagramRow *row=nullptr;
375 if (m_diagram->numRows()<=m_level+1) /* add new row */
376 {
377 row=m_diagram->addRow(m_level+1);
378 }
379 else /* get next row */
380 {
381 row=m_diagram->row(m_level+1);
382 }
383 for (const auto &bcd : doBases ? cd->baseClasses() : cd->subClasses())
384 {
385 ClassDef *ccd=bcd.classDef;
386 if (ccd && ccd->isVisibleInHierarchy())
387 {
388 row->insertClass(di_ptr,ccd,doBases,bcd.prot,
389 doBases ? bcd.virt : Specifier::Normal,
390 doBases ? bcd.templSpecifiers : QCString());
391 }
392 }
393 }
394}
virtual bool isVisibleInHierarchy() const =0
the class is visible in a class diagram, or class hierarchy
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
DiagramRow(TreeDiagram *d, uint32_t l)
Definition diagram.cpp:85
void insertClass(DiagramItem *parent, const ClassDef *cd, bool doBases, Protection prot, Specifier virt, const QCString &ts)
Definition diagram.cpp:356
const uint32_t gridWidth
Definition diagram.cpp:140
const uint32_t gridHeight
Definition diagram.cpp:141
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324
@ Private
Definition types.h:26
@ Normal
Definition types.h:29

References ClassDef::baseClasses(), DiagramRow(), gridHeight, gridWidth, insertClass(), ClassDef::isVisibleInHierarchy(), m_diagram, m_items, m_level, Normal, parent(), Private, and ClassDef::subClasses().

Referenced by insertClass(), and TreeDiagram::TreeDiagram().

◆ item()

DiagramItem * DiagramRow::item ( int index)
inline

Definition at line 90 of file diagram.cpp.

90{ return m_items.at(index).get(); }

References m_items.

◆ number()

uint32_t DiagramRow::number ( )
inline

Definition at line 88 of file diagram.cpp.

88{ return m_level; }

References m_level.

◆ numItems()

uint32_t DiagramRow::numItems ( ) const
inline

Definition at line 91 of file diagram.cpp.

91{ return static_cast<uint32_t>(m_items.size()); }

References m_items.

◆ rbegin()

reverse_iterator DiagramRow::rbegin ( )
inline

Definition at line 94 of file diagram.cpp.

94{ return m_items.rbegin(); }

References m_items.

◆ rend()

reverse_iterator DiagramRow::rend ( )
inline

Definition at line 95 of file diagram.cpp.

95{ return m_items.rend(); }

References m_items.

Member Data Documentation

◆ m_diagram

TreeDiagram* DiagramRow::m_diagram
private

Definition at line 97 of file diagram.cpp.

Referenced by DiagramRow(), and insertClass().

◆ m_items

Vec DiagramRow::m_items
private

Definition at line 99 of file diagram.cpp.

Referenced by begin(), end(), insertClass(), item(), numItems(), rbegin(), and rend().

◆ m_level

uint32_t DiagramRow::m_level
private

Definition at line 98 of file diagram.cpp.

Referenced by DiagramRow(), insertClass(), and number().


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