My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
DiagramItem Class Reference

Public Member Functions

 DiagramItem (DiagramItem *p, int number, ClassDef *cd, Protection prot, Specifier virt, const char *ts)
 
 ~DiagramItem ()
 
QCString label () const
 
QCString fileName () const
 
DiagramItemparentItem ()
 
DiagramItemListgetChildren ()
 
void move (int dx, int dy)
 
int xPos () const
 
int yPos () const
 
int avgChildPos () const
 
int numChildren () const
 
void addChild (DiagramItem *di)
 
int number () const
 
Protection protection () const
 
Specifier virtualness () const
 
void putInList ()
 
bool isInList () const
 
ClassDefgetClassDef () const
 

Private Attributes

DiagramItemListchildren
 
DiagramItemparent
 
int x
 
int y
 
int num
 
Protection prot
 
Specifier virt
 
QCString templSpec
 
bool inList
 
ClassDefclassDef
 

Detailed Description

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

Definition at line 42 of file diagram.cpp.

Constructor & Destructor Documentation

DiagramItem::DiagramItem ( DiagramItem p,
int  number,
ClassDef cd,
Protection  prot,
Specifier  virt,
const char *  ts 
)

Definition at line 286 of file diagram.cpp.

References children, classDef, inList, num, number(), parent, prot, templSpec, virt, x, and y.

{
parent=p;
x=y=0;
//name=n;
prot=pr;
virt=vi;
inList=FALSE;
}
DiagramItem::~DiagramItem ( )

Definition at line 301 of file diagram.cpp.

References children.

{
delete children;
}

Member Function Documentation

void DiagramItem::addChild ( DiagramItem di)

Definition at line 352 of file diagram.cpp.

References children.

Referenced by DiagramRow::insertClass().

{
children->append(di);
}
int DiagramItem::avgChildPos ( ) const

Definition at line 333 of file diagram.cpp.

References children, isInList(), and xPos().

Referenced by TreeDiagram::layoutTree().

{
int c=children->count();
if (c==0) // no children -> don't move
return xPos();
if ((di=children->getFirst())->isInList()) // children should be in a list
return di->xPos();
if (c&1) // odd number of children -> get pos of middle child
return children->at(c/2)->xPos();
else // even number of children -> get middle of most middle children
return (children->at(c/2-1)->xPos()+children->at(c/2)->xPos())/2;
}
QCString DiagramItem::fileName ( ) const

Definition at line 328 of file diagram.cpp.

References classDef, and ClassDef::getOutputFileBase().

{
}
DiagramItemList* DiagramItem::getChildren ( )
inline
ClassDef* DiagramItem::getClassDef ( ) const
inline

Definition at line 63 of file diagram.cpp.

References classDef.

Referenced by TreeDiagram::drawBoxes().

{ return classDef; }
bool DiagramItem::isInList ( ) const
inline
QCString DiagramItem::label ( ) const

Definition at line 306 of file diagram.cpp.

References classDef, Config_getBool, ClassDef::displayName(), insertTemplateSpecifierInScope(), Definition::name(), stripScope(), and templSpec.

Referenced by TreeDiagram::computeExtremes(), writeBitmapBox(), ClassDiagram::writeFigure(), and writeVectorBox().

{
QCString result;
if (!templSpec.isEmpty())
{
// we use classDef->name() here and not diplayName() in order
// to get the name used in the inheritance relation.
QCString n = classDef->name();
if (/*n.right(2)=="-g" ||*/ n.right(2)=="-p")
{
n = n.left(n.length()-2);
}
}
else
{
result=classDef->displayName();
}
if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result);
return result;
}
void DiagramItem::move ( int  dx,
int  dy 
)
inline

Definition at line 52 of file diagram.cpp.

References x, and y.

Referenced by ClassDiagram::ClassDiagram(), TreeDiagram::computeLayout(), DiagramRow::insertClass(), and TreeDiagram::moveChildren().

{ x+=dx; y+=dy; }
int DiagramItem::number ( ) const
inline

Definition at line 58 of file diagram.cpp.

References num.

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

{ return num; }
int DiagramItem::numChildren ( ) const

Definition at line 347 of file diagram.cpp.

References children.

{
return children->count();
}
DiagramItem* DiagramItem::parentItem ( )
inline
Protection DiagramItem::protection ( ) const
inline

Definition at line 59 of file diagram.cpp.

References prot.

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

{ return prot; }
void DiagramItem::putInList ( )
inline

Definition at line 61 of file diagram.cpp.

References inList.

Referenced by TreeDiagram::computeLayout().

{ inList=TRUE; }
Specifier DiagramItem::virtualness ( ) const
inline

Definition at line 60 of file diagram.cpp.

References virt.

Referenced by writeBitmapBox(), and writeVectorBox().

{ return virt; }
int DiagramItem::xPos ( ) const
inline
int DiagramItem::yPos ( ) const
inline

Definition at line 54 of file diagram.cpp.

References y.

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

{ return y; }

Member Data Documentation

DiagramItemList* DiagramItem::children
private

Definition at line 65 of file diagram.cpp.

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

ClassDef* DiagramItem::classDef
private

Definition at line 73 of file diagram.cpp.

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

bool DiagramItem::inList
private

Definition at line 72 of file diagram.cpp.

Referenced by DiagramItem(), isInList(), and putInList().

int DiagramItem::num
private

Definition at line 68 of file diagram.cpp.

Referenced by DiagramItem(), and number().

DiagramItem* DiagramItem::parent
private

Definition at line 66 of file diagram.cpp.

Referenced by DiagramItem(), and parentItem().

Protection DiagramItem::prot
private

Definition at line 69 of file diagram.cpp.

Referenced by DiagramItem(), and protection().

QCString DiagramItem::templSpec
private

Definition at line 71 of file diagram.cpp.

Referenced by DiagramItem(), and label().

Specifier DiagramItem::virt
private

Definition at line 70 of file diagram.cpp.

Referenced by DiagramItem(), and virtualness().

int DiagramItem::x
private

Definition at line 67 of file diagram.cpp.

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

int DiagramItem::y
private

Definition at line 67 of file diagram.cpp.

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


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