WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
Component Class Reference

Base class for all scene-graph nodes in the component hierarchy. More...

#include <Component.h>

Inheritance diagram for Component:
[legend]
Collaboration diagram for Component:
[legend]

Public Member Functions

 Component ()
 
virtual ~Component ()
 
virtual bool addChild (Component *)
 Add a child component to this node.
 
virtual bool removeChild (Component *)
 Remove a child component from this node.
 
virtual void removeAllChildren ()
 
virtual unsigned int nbChildren () const
 
virtual bool findChildComponent (Component *, bool)
 
virtual ComponentgetChild (unsigned int)
 
virtual const ComponentgetChild (unsigned int) const
 
void setParentComponent (Component *)
 Set the parent of this component.
 
virtual void onParentSet (Component *)
 Called after the parent has been set; override for custom logic.
 
const Componentparent () const
 Get the parent component (const).
 
Componentparent ()
 Get the parent component.
 
template<class DataType >
const DataType * firstParentOfType ()
 Walk up the parent chain and return the first ancestor of the given type.
 
void ref ()
 Increment the reference counter.
 
void unref ()
 Decrement the reference counter; deletes this when it reaches zero.
 
void setName (const std::string &name)
 
std::string name () const
 
virtual void onNameChanged ()
 
void print (int l_depth=0)
 
virtual void doPrint ()
 
void copy (const Component &component, bool)
 

Private Attributes

Componentm_p_parent
 
unsigned int m_refCounter
 
std::string m_name
 

Detailed Description

Base class for all scene-graph nodes in the component hierarchy.

Supports parent–child relationships, reference counting, and naming. Derived classes (Container, GameFile, WoWItem, etc.) extend this to form the application's object graph.

Definition at line 10 of file Component.h.

Constructor & Destructor Documentation

◆ Component()

Component::Component ( )

Definition at line 5 of file Component.cpp.

◆ ~Component()

Component::~Component ( )
virtualdefault

Member Function Documentation

◆ addChild()

bool Component::addChild ( Component )
virtual

Add a child component to this node.

Definition at line 12 of file Component.cpp.

◆ copy()

void Component::copy ( const Component component,
bool   
)

Definition at line 92 of file Component.cpp.

◆ doPrint()

void Component::doPrint ( )
virtual

Definition at line 97 of file Component.cpp.

Here is the caller graph for this function:

◆ findChildComponent()

virtual bool Component::findChildComponent ( Component ,
bool   
)
inlinevirtual

◆ firstParentOfType()

template<class DataType >
const DataType * Component::firstParentOfType ( )

Walk up the parent chain and return the first ancestor of the given type.

Template Parameters
DataTypeThe type to search for (must be a Component subclass).
Returns
Pointer to the ancestor, or nullptr if none found.

Definition at line 78 of file Component.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChild() [1/2]

virtual Component * Component::getChild ( unsigned int  )
inlinevirtual

Reimplemented in Container< DataType >, Container< GameFile >, Container< LogOutput >, and Container< WoWItem >.

Definition at line 29 of file Component.h.

Here is the caller graph for this function:

◆ getChild() [2/2]

virtual const Component * Component::getChild ( unsigned int  ) const
inlinevirtual

◆ name()

std::string Component::name ( ) const

Definition at line 52 of file Component.cpp.

Here is the caller graph for this function:

◆ nbChildren()

virtual unsigned int Component::nbChildren ( ) const
inlinevirtual

Reimplemented in Container< DataType >, Container< GameFile >, Container< LogOutput >, and Container< WoWItem >.

Definition at line 26 of file Component.h.

Here is the caller graph for this function:

◆ onNameChanged()

void Component::onNameChanged ( )
virtual

Definition at line 57 of file Component.cpp.

Here is the caller graph for this function:

◆ onParentSet()

void Component::onParentSet ( Component )
virtual

Called after the parent has been set; override for custom logic.

Reimplemented in WoWItem.

Definition at line 36 of file Component.cpp.

Here is the caller graph for this function:

◆ parent() [1/2]

Component * Component::parent ( )
inline

Get the parent component.

Definition at line 42 of file Component.h.

◆ parent() [2/2]

const Component * Component::parent ( ) const
inline

Get the parent component (const).

Definition at line 39 of file Component.h.

Here is the caller graph for this function:

◆ print()

void Component::print ( int  l_depth = 0)

Definition at line 61 of file Component.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ref()

void Component::ref ( )

Increment the reference counter.

Definition at line 22 of file Component.cpp.

◆ removeAllChildren()

virtual void Component::removeAllChildren ( )
inlinevirtual

◆ removeChild()

bool Component::removeChild ( Component )
virtual

Remove a child component from this node.

Definition at line 17 of file Component.cpp.

◆ setName()

void Component::setName ( const std::string &  name)

Definition at line 46 of file Component.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setParentComponent()

void Component::setParentComponent ( Component a_p_parent)

Set the parent of this component.

Definition at line 40 of file Component.cpp.

Here is the call graph for this function:

◆ unref()

void Component::unref ( )

Decrement the reference counter; deletes this when it reaches zero.

Definition at line 27 of file Component.cpp.

Member Data Documentation

◆ m_name

std::string Component::m_name
private

Definition at line 74 of file Component.h.

◆ m_p_parent

Component* Component::m_p_parent
private

Definition at line 70 of file Component.h.

◆ m_refCounter

unsigned int Component::m_refCounter
private

Definition at line 72 of file Component.h.


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