goat3d

annotate src/node.cc @ 45:8da36540e2e9

fixed memory leak in readxml and reversed error return
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Dec 2013 02:27:32 +0200
parents 2918358f5e6d
children 498ca7ac7047
rev   line source
nuclear@0 1 #include <algorithm>
nuclear@0 2 #include <string.h>
nuclear@0 3 #include "node.h"
nuclear@0 4
nuclear@0 5 Node::Node()
nuclear@0 6 {
nuclear@8 7 obj = 0;
nuclear@0 8 }
nuclear@0 9
nuclear@8 10 void Node::set_object(Object *obj)
nuclear@0 11 {
nuclear@8 12 this->obj = obj;
nuclear@0 13 }
nuclear@0 14
nuclear@8 15 Object *Node::get_object()
nuclear@0 16 {
nuclear@8 17 return obj;
nuclear@0 18 }
nuclear@0 19
nuclear@8 20 const Object *Node::get_object() const
nuclear@0 21 {
nuclear@8 22 return obj;
nuclear@0 23 }
nuclear@0 24
nuclear@8 25 void delete_node_tree(Node *n)
nuclear@0 26 {
nuclear@8 27 for(int i=0; i<n->get_children_count(); i++) {
nuclear@8 28 delete_node_tree((Node*)n->get_child(i));
nuclear@0 29 }
nuclear@8 30 delete n;
nuclear@0 31 }