WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
Container< DataType > Class Template Reference

Generic typed container that manages a set of child Component pointers. More...

#include <Container.h>

Inheritance diagram for Container< DataType >:
[legend]
Collaboration diagram for Container< DataType >:
[legend]

Public Types

typedef std::unordered_set< DataType * >::iterator iterator
 

Public Member Functions

 Container ()
 
virtual ~Container ()
 
virtual bool addChild (DataType *child)
 
virtual bool removeChild (DataType *child)
 
void removeAllChildren ()
 
virtual void onChildAdded (DataType *)
 
virtual void onChildRemoved (DataType *)
 
template<class ChildType >
int removeAllChildrenOfType ()
 
unsigned int nbChildren () const
 
bool findChildComponent (Component *child, bool recursive=false)
 
ComponentgetChild (unsigned int index)
 
const ComponentgetChild (unsigned int index) const
 
iterator begin ()
 
iterator end ()
 
- Public Member Functions inherited from Component
 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.
 
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

std::unordered_set< DataType * > m_children
 

Detailed Description

template<class DataType>
class Container< DataType >

Generic typed container that manages a set of child Component pointers.

Template Parameters
DataTypeThe child element type (must derive from Component).

Children are reference-counted and automatically released on destruction.

Definition at line 12 of file Container.h.

Member Typedef Documentation

◆ iterator

template<class DataType >
typedef std::unordered_set<DataType*>::iterator Container< DataType >::iterator

Definition at line 15 of file Container.h.

Constructor & Destructor Documentation

◆ Container()

template<class DataType >
Container< DataType >::Container ( )

Definition at line 56 of file Container.h.

◆ ~Container()

template<class DataType >
Container< DataType >::~Container ( )
virtual

Definition at line 63 of file Container.h.

Member Function Documentation

◆ addChild()

template<class DataType >
bool Container< DataType >::addChild ( DataType *  child)
virtual

Definition at line 73 of file Container.h.

◆ begin()

template<class DataType >
iterator Container< DataType >::begin ( )
inline

Definition at line 41 of file Container.h.

Here is the caller graph for this function:

◆ end()

template<class DataType >
iterator Container< DataType >::end ( )
inline

Definition at line 46 of file Container.h.

Here is the caller graph for this function:

◆ findChildComponent()

template<class DataType >
bool Container< DataType >::findChildComponent ( Component child,
bool  recursive = false 
)
virtual

Reimplemented from Component.

Definition at line 132 of file Container.h.

◆ getChild() [1/2]

template<class DataType >
Component * Container< DataType >::getChild ( unsigned int  index)
virtual

Reimplemented from Component.

Definition at line 154 of file Container.h.

◆ getChild() [2/2]

template<class DataType >
const Component * Container< DataType >::getChild ( unsigned int  index) const
virtual

Reimplemented from Component.

Definition at line 171 of file Container.h.

◆ nbChildren()

template<class DataType >
unsigned int Container< DataType >::nbChildren ( ) const
inlinevirtual

Reimplemented from Component.

Definition at line 35 of file Container.h.

◆ onChildAdded()

template<class DataType >
virtual void Container< DataType >::onChildAdded ( DataType *  )
inlinevirtual

Reimplemented in core::GameFolder, and wow::WoWFolder.

Definition at line 24 of file Container.h.

◆ onChildRemoved()

template<class DataType >
virtual void Container< DataType >::onChildRemoved ( DataType *  )
inlinevirtual

Reimplemented in core::GameFolder, and wow::WoWFolder.

Definition at line 28 of file Container.h.

◆ removeAllChildren()

template<class DataType >
void Container< DataType >::removeAllChildren ( )
virtual

Reimplemented from Component.

Definition at line 100 of file Container.h.

◆ removeAllChildrenOfType()

template<class DataType >
template<class ChildType >
int Container< DataType >::removeAllChildrenOfType ( )

Definition at line 110 of file Container.h.

◆ removeChild()

template<class DataType >
bool Container< DataType >::removeChild ( DataType *  child)
virtual

Definition at line 86 of file Container.h.

Member Data Documentation

◆ m_children

template<class DataType >
std::unordered_set<DataType*> Container< DataType >::m_children
private

Definition at line 52 of file Container.h.


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