goat3d
annotate 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 |
rev | line source |
---|---|
nuclear@0 | 1 #ifndef NODE_H_ |
nuclear@0 | 2 #define NODE_H_ |
nuclear@0 | 3 |
nuclear@0 | 4 #include <string> |
nuclear@0 | 5 #include <vector> |
nuclear@0 | 6 |
nuclear@0 | 7 class Node { |
nuclear@0 | 8 private: |
nuclear@0 | 9 std::string name; |
nuclear@0 | 10 Node *parent; |
nuclear@0 | 11 std::vector<Node*> children; |
nuclear@0 | 12 |
nuclear@0 | 13 public: |
nuclear@0 | 14 Node(); |
nuclear@0 | 15 virtual ~Node(); |
nuclear@0 | 16 |
nuclear@0 | 17 virtual void set_name(const char *name); |
nuclear@0 | 18 virtual const char *get_name() const; |
nuclear@0 | 19 |
nuclear@0 | 20 virtual void add_child(Node *c); |
nuclear@0 | 21 virtual int get_num_children() const; |
nuclear@0 | 22 |
nuclear@0 | 23 virtual Node *get_child(int idx) const; |
nuclear@0 | 24 virtual Node *get_child(const char *name) const; |
nuclear@0 | 25 virtual Node *get_descendant(const char *name) const; |
nuclear@0 | 26 |
nuclear@0 | 27 virtual Node *get_parent() const; |
nuclear@0 | 28 // passing 0 will return the root |
nuclear@0 | 29 virtual Node *get_ancestor(const char *name) const; |
nuclear@0 | 30 }; |
nuclear@0 | 31 |
nuclear@0 | 32 #endif // NODE_H_ |