Sayonara Player
Public Member Functions | Public Attributes | List of all members
Util::Tree< T > Class Template Reference

The Tree class. More...

#include <Tree.h>

Public Member Functions

 Tree (const T &data)
 
TreeaddChild (Tree *node)
 adds a child to the given node More...
 
TreeaddChild (const T &data)
 
TreeremoveChild (Tree *deletedNode)
 remove a node from the current node More...
 
void sort (bool recursive)
 sort children of all nodes in ascending way according to their data More...
 

Public Attributes

Treeparent = nullptr
 
data
 
QList< Tree * > children
 

Detailed Description

template<typename T>
class Util::Tree< T >

The Tree class.

Member Function Documentation

◆ addChild()

template<typename T >
Tree* Util::Tree< T >::addChild ( Tree< T > *  node)
inline

adds a child to the given node

Parameters
nodethe parent node
Returns
pointer to inserted node

◆ removeChild()

template<typename T >
Tree* Util::Tree< T >::removeChild ( Tree< T > *  deletedNode)
inline

remove a node from the current node

Parameters
deletedNodenode to remove
Returns
pointer to deletedNode

◆ sort()

template<typename T >
void Util::Tree< T >::sort ( bool  recursive)
inline

sort children of all nodes in ascending way according to their data

Parameters
recursiveif set to true, do it for all subnodes, too