-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.hpp
More file actions
34 lines (30 loc) · 791 Bytes
/
Copy pathnode.hpp
File metadata and controls
34 lines (30 loc) · 791 Bytes
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
#ifndef NODE_HPP
#define NODE_HPP
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
class Node
{
private:
char type; // data 1
std::string name; // data 2
std::vector<Node *> children;
Node *parent; // point to child's parent
void deleteSubtree(Node *node);
public:
Node(const std::string&, char);
Node() = default;
void addChild(Node *);
void addChild(const std::string&, char);
bool removeChild(const std::string&);
void setParent(Node *);
void setType(char);
void setName(const std::string&);
Node *getChild(const std::string &);
std::vector<Node *>& getChildren();
Node *getParent();
char getType();
std::string getName();
};
#endif // NODE_HPP