-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTree.h
53 lines (41 loc) · 1.18 KB
/
Tree.h
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
#pragma once
#include "Node.h"
#include <unistd.h>
#define PATH_MAX 4096 /* # chars in a path name including nul */
class Node;
class Tree
{
Node* root = NULL;
Node* current_Dir;
int numberOfNodes = 0;
int lastNodeAdded;
char cwd[PATH_MAX];
public:
Tree();
~Tree();
//funciones especiales
Node* addChild(Node* son, Node* father);
Node* findNode(Node* father, int id);
void updateChild(Node* node);
void removeChild(Node* node);
//void setNewNode(Node* father, string type);
void setRoot(Node* newRoot);
void setCurrentDir(Node* newDir);
//Utilities
bool isFatherFolder(Node* father);
bool isAlreadyOnFather(Node* father, Node* son);
//void printTreeStructure();
Node* getCurrentDir();
int getNumberOfNodes();
int getLastNodeId();
Node* getRoot();
//Save Structure
Node* searchByIdRecursive(Node* nodeToSearch, int id);
Node* searchById(int id);
void saveTreeRecursive(Node* nodeToSave, std::ofstream &of);
void WriteBinaryFile();
void saveTree(std::ofstream &of);
void loadTree();
//Utilities
Node* findNodeByName(std::string name);
};