The codec is always set when reading the GPI header
[GPXSee.git] / src / common / treenode.h
blob664e25d1aad4847b73b266ab38753b10d97a9082
1 #ifndef TREENODE_H
2 #define TREENODE_H
4 #include <QList>
5 #include <QString>
7 template <typename T>
8 class TreeNode
10 public:
11 TreeNode() {}
12 TreeNode(const QString &name) : _name(name) {}
14 const QString &name() const {return _name;}
15 const QList<TreeNode<T> > &childs() const {return _childs;}
16 const QList<T> &items() const {return _items;}
18 void addItem(T node) {_items.append(node);}
19 void addChild(const TreeNode<T> &child) {_childs.append(child);}
21 bool isEmpty() const {return _childs.isEmpty() && _items.isEmpty();}
22 void clear() {clear(*this);}
24 private:
25 void clear(TreeNode<T> &node)
27 for (int i = 0; i < node._childs.size(); i++)
28 clear(node._childs[i]);
29 node._items.clear();
32 QString _name;
33 QList<TreeNode<T> > _childs;
34 QList<T> _items;
37 #endif // TREENODE_H