31 #include "Helper/Logger/Logger.h" 57 for(
Tree* child : children){
71 for(
Tree* child : children){
72 node->children << child->copy();
87 this->children << node;
102 deleted_node->parent =
nullptr;
104 for(
int i=0; i < children.size(); i++){
106 Tree* node = children[i];
108 if(node == deleted_node){
109 deleted_node = children.takeAt(i);
135 if(children.isEmpty()){
140 return (a->data < b->data);
143 std::sort(children.begin(), children.end(), lambda);
147 for(
Tree* child : children){
149 child->sort(recursive);
156 void print(
int lvl)
const {
158 for(
Tree* child : children){
161 for(
int i=0; i<lvl; i++){
void move(Tree *new_parent)
move current node to a new parent
Definition: Tree.h:122
Tree * remove_child(Tree *deleted_node)
remove a node from the current node
Definition: Tree.h:100
The Tree class.
Definition: LibraryGenreView.h:45
void sort(bool recursive)
sort children of all nodes in ascending way according to their data
Definition: Tree.h:132
Tree * copy()
Definition: Tree.h:68
Tree(const T &data_)
Tree constructor.
Definition: Tree.h:50
Tree * add_child(Tree *node)
adds a child to the given node
Definition: Tree.h:84