-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.hpp
More file actions
108 lines (89 loc) · 2.4 KB
/
Directory.hpp
File metadata and controls
108 lines (89 loc) · 2.4 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef SEMESTRALNIPRACE_DIRECTORY_HPP
#define SEMESTRALNIPRACE_DIRECTORY_HPP
#include <string>
#include "DirectoryItem.hpp"
using std::string;
/**
* Class representing a directory
*/
class Directory {
public:
/**
* Default constructor for directory class
*/
Directory() = default;
/**
* Constructor for directory item
* @param parent - parent directory
* @param current - current directory
* @param subdir - subdirectory
* @param file - file
*/
Directory(Directory* parent, DirectoryItem* current, DirectoryItem* subdir, DirectoryItem* file);
/**
* Destructor for directory class
*/
~Directory();
/**
* Gets the parent of the directory
* @return parent of the directory
*/
Directory* getParent() const;
/**
* Sets the parent of the directory
* @param newParent - new parent
*/
void setParent(Directory* parent);
/**
* Gets the current item of the directory
* @return current item of the directory
*/
DirectoryItem* getCurrent() const;
/**
* Sets the current item of the directory
* @param newCurrent - new current item
*/
void setCurrent(DirectoryItem* current);
/**
* Gets the subdirectory of the directory
* @return subdirectory of the directory
*/
DirectoryItem*& getSubdir();
/**
* Sets the subdirectory of the directory
* @param newSubdir - new subdirectory
*/
void setSubdir(DirectoryItem* subdir);
/**
* Gets the file of the directory
* @return file of the directory
*/
DirectoryItem*& getFile();
/**
* Sets the file of the directory
* @param newFile - new file
*/
void setFile(DirectoryItem* file);
/**
* Adds a subdirectory to the directory
* @param item - subdirectory to add
*/
void addSubdirectory(DirectoryItem* item);
/**
* Adds a file to the directory
* @param item - file to add
*/
void addFile(DirectoryItem* item);
/**
* Deletes a file from the directory
* @param fileName - name of the file to delete
* @return deleted file or nullptr if the file was not found
*/
DirectoryItem* deleteFileFromDirectory(const string& fileName);
private:
Directory* parent;
DirectoryItem* current;
DirectoryItem* subdir;
DirectoryItem* file;
};
#endif //SEMESTRALNIPRACE_DIRECTORY_HPP