-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathfiletree.h
More file actions
29 lines (24 loc) · 784 Bytes
/
filetree.h
File metadata and controls
29 lines (24 loc) · 784 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
#ifndef _FILE_TREE_H
#define _FILE_TREE_H
#include <string>
#include <map>
struct TreeNode{
std::string value_;
bool isFile;
TreeNode *parent;
TreeNode *firstSon;
TreeNode *nextSibling;
TreeNode(const std::string &_value, const bool &_isFile): value_(_value), isFile(_isFile), parent(nullptr), firstSon(nullptr), nextSibling(nullptr){};
};
class FileTree{
private:
TreeNode *_root;
public:
FileTree();
bool insert_node(const std::string &path, const bool isFile);
bool find_node(const std::string &path, TreeNode **parent)const;
void list(TreeNode *node, std::map<std::string, std::pair<int, int>>& meta);
void list(std::map<std::string, std::pair<int, int>>& meta);
const std::string list_node_path(TreeNode* node);
};
#endif