-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.h
41 lines (33 loc) · 1.38 KB
/
file.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
/* Data structure for files
* id: The corresponding unique id of the file, see uuid.cpp
* content: content of the file
- If file is a directory, content is name of directory
- If file is a file, content is content of the file
* isExists: determines if file exists. Delete sets isExists = 0
* isDirectory: determines if file is a directory */
class file {
public:
unsigned long long id;
std::string content;
bool isExists;
bool isDirectory;
/* Constructors */
file();
file(unsigned long long id, std::string content, bool isExists, bool isDirectory);
bool operator ==(const file &rhs);
// implements msgpack-c serialization methods
// MSGPACK_DEFINE(id, content, isExists);
};
file::file() {
}
file::file(unsigned long long id, std::string content, bool isExists, bool isDirectory) {
this->id = id;
this->content = content;
this->isExists = isExists;
this->isDirectory = isDirectory;
}
/* only used for checking if file has been deleted
so does not check this->isDeleted == rhs.isDeleted */
bool file::operator ==(const file &rhs) {
return (this->id == rhs.id && this->content == rhs.content && this->isDirectory == rhs.isDirectory);
}