-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFilesystem.hpp
71 lines (53 loc) · 1.41 KB
/
Filesystem.hpp
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
#ifndef Filesystem_hpp
#define Filesystem_hpp
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <vector>
#include "Debug.cpp"
#include "Helper.hpp"
#include "Global.hpp"
typedef struct {
Filedescriptor_t Filedescriptor;
unsigned int FileSize;
string FileName;
string FileExtension;
string MimeType;
string ETag;
string LastModifiedString;
string LastModifiedSeconds;
} FileProperties_t;
typedef unordered_map<string, const string> MimetypeRelations_t;
typedef unsigned int Filedescriptor_t;
typedef vector<string> FilelistPlain_t;
typedef pair<string, FileProperties_t> FileListExtendedPair_t;
typedef unordered_map<string, const FileProperties_t> FileListExtended_t;
static const MimetypeRelations_t MimeRelations{
{ "html", "text/html" },
{ "js", "text/javascript" },
{ "json", "application/json" },
{ "css", "text/css" },
{ "png", "image/png" },
{ "jpg", "image/jpg" },
{ "svg", "image/svg+xml" },
{ "woff", "font/woff" },
{ "woff2", "font/woff2" }
};
class Filesystem
{
public:
Filesystem();
~Filesystem();
void initFiles();
void processFileProperties();
FileProperties_t getFilePropertiesByFile(string File);
string Hostname;
string BasePath;
string Path;
vector<string> Mimetypes;
private:
FilelistPlain_t _Files;
FileListExtended_t _FilesExtended;
string _CompletePath;
};
#endif