-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.h
More file actions
25 lines (22 loc) · 814 Bytes
/
Directory.h
File metadata and controls
25 lines (22 loc) · 814 Bytes
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
#pragma once
#include <memory>
#include <unordered_map>
#include "SystemObject.h"
#include "User.h"
namespace fs
{
class Directory final : public SystemObject
{
private:
std::unordered_map<std::string, std::unique_ptr<SystemObject>> m_children{};
public:
Directory(const User* user, const std::string& name, const std::string& parentPath);
explicit Directory(std::istringstream& ifs);
[[nodiscard]] size_t getSize() const override;
[[nodiscard]] const std::unordered_map<std::string, std::unique_ptr<SystemObject>>& getChildren() const;
[[nodiscard]] SystemObject* searchChildren(const std::string& key);
[[nodiscard]] bool addChildren(std::unique_ptr<SystemObject> so);
void removeChild(const std::string& key);
void cascadeDelete() override;
};
} // namespace fs