goat3d
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/node.h Sat Aug 17 16:10:26 2013 +0300 1.3 @@ -0,0 +1,32 @@ 1.4 +#ifndef NODE_H_ 1.5 +#define NODE_H_ 1.6 + 1.7 +#include <string> 1.8 +#include <vector> 1.9 + 1.10 +class Node { 1.11 +private: 1.12 + std::string name; 1.13 + Node *parent; 1.14 + std::vector<Node*> children; 1.15 + 1.16 +public: 1.17 + Node(); 1.18 + virtual ~Node(); 1.19 + 1.20 + virtual void set_name(const char *name); 1.21 + virtual const char *get_name() const; 1.22 + 1.23 + virtual void add_child(Node *c); 1.24 + virtual int get_num_children() const; 1.25 + 1.26 + virtual Node *get_child(int idx) const; 1.27 + virtual Node *get_child(const char *name) const; 1.28 + virtual Node *get_descendant(const char *name) const; 1.29 + 1.30 + virtual Node *get_parent() const; 1.31 + // passing 0 will return the root 1.32 + virtual Node *get_ancestor(const char *name) const; 1.33 +}; 1.34 + 1.35 +#endif // NODE_H_