-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFolder.h
More file actions
54 lines (52 loc) · 1.06 KB
/
Folder.h
File metadata and controls
54 lines (52 loc) · 1.06 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
#pragma once
#include <list>
#include<vector>
#include<string>
#include<iostream>
#include<ctime>
using namespace std;
class Folder
{
public:
string name;
vector<Folder*> Folders;
vector<string> Files;
Folder* parent;
time_t creation_time;
string owner;
string path;
bool hidden;
public:
Folder(string n = "NUL", string p = "",Folder* parant = nullptr, vector<string> fs = vector<string>(), vector<Folder*> Fs = vector<Folder*>())
{
name = n;
Folders = Fs;
Files = fs;
hidden = false;
path = p;
parent = parant;
}
void remove_file(string name)
{
for (int i = 0; i < Files.size(); i++)
{
if (Files[i] == name)
{
swap(Files[i], Files[Files.size() - 1]);
Files.pop_back();
}
}
}
void print()
{
cout << "Directory of " << path << endl << endl;
for (int i = 0; i < Folders.size(); i++)
{
cout << " <DIR> " << Folders[i]->name << endl;
}
for (int i = 0; i < Files.size(); i++)
{
cout << " " << Files[i] << endl;
}
}
};