-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmounts.h
46 lines (35 loc) · 1.4 KB
/
mounts.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
42
43
44
45
46
#ifndef MOUNTS_H
#define MOUNTS_H
#include <string>
#include <vector>
#include <map>
class Mounts
{
public:
/// absoluteBasePath wird im root mountPath "/" gemounted
Mounts(std::string const & absoluteBasePath);
/// liefert den absoluten Pfad für jeden beliebigen mountPath
std::string absolutePath(std::string const & mountPath) const;
/// liefert alle gemounteten Pfade zu einem absoluten Pfad
std::vector<std::string> allMountPathes(std::string const & absolutePath) const;
/// sucht alle Mountpunkte als pair<mountPath, absolutePath> unterhalb einem mountPath
std::vector<std::pair<std::string, std::string>> getMountPointsBelow(std::string const & mountPath) const;
/// fügt einen neuen Mauntpunkt hinzu
void mount(std::string const & mountPath, std::string const & absolutePath);
/// löscht einen Mountpunkt an dem absoluten Pfad
void unmountAbsolute(std::string const & absolutePath);
/// löscht alle Mountpunkte im mountPath
void unmountBelow(std::string const & mountPath);
private:
struct MountPoint;
using MountPathToMointPoint = std::map<std::string, MountPoint>;
using AbsolutePath = std::string;
using MountPath = std::string;
struct MountPoint
{
AbsolutePath absolutePath;
MountPathToMointPoint::iterator up;
};
MountPathToMointPoint m_MountPathToMountpoint;
};
#endif // MOUNTS_H