goat3d

view src/node.h @ 0:2918358f5e6d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 Aug 2013 16:10:26 +0300
parents
children 97139303348c
line source
1 #ifndef NODE_H_
2 #define NODE_H_
4 #include <string>
5 #include <vector>
7 class Node {
8 private:
9 std::string name;
10 Node *parent;
11 std::vector<Node*> children;
13 public:
14 Node();
15 virtual ~Node();
17 virtual void set_name(const char *name);
18 virtual const char *get_name() const;
20 virtual void add_child(Node *c);
21 virtual int get_num_children() const;
23 virtual Node *get_child(int idx) const;
24 virtual Node *get_child(const char *name) const;
25 virtual Node *get_descendant(const char *name) const;
27 virtual Node *get_parent() const;
28 // passing 0 will return the root
29 virtual Node *get_ancestor(const char *name) const;
30 };
32 #endif // NODE_H_