-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreeitem.cpp
70 lines (59 loc) · 1.11 KB
/
treeitem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "treeitem.h"
template<class type>
TreeItem<type>::TreeItem(type x)
{
m_value = x;
m_child = vector<TreeItem *>(0);
}
template<class type>
void TreeItem<type>::addChild(TreeItem *item)
{
m_child.push_back(item);
}
template<class type>
void TreeItem<type>::delChild(int index)
{
m_child.erase(m_child.begin() + index);
}
template<class type>
void TreeItem<type>::absDelChild(int index)
{
TreeItem<type> *l = m_child[index];
m_child.erase(m_child.begin() + index);
delete[] l;
}
template<class type>
TreeItem<type> *TreeItem<type>::parent() const
{
return m_parent;
}
template<class type>
void TreeItem<type>::setParent(TreeItem<type> *parent)
{
m_parent = parent;
}
template<class type>
depthVar TreeItem<type>::depth() const
{
return m_depth;
}
template<class type>
void TreeItem<type>::setDepth(const depthVar &depth)
{
m_depth = depth;
}
template<class type>
type TreeItem<type>::value() const
{
return m_value;
}
template<class type>
void TreeItem<type>::setValue(const type &value)
{
m_value = value;
}
template<class type>
vector<TreeItem<type> *> TreeItem<type>::child() const
{
return m_child;
}