-
Notifications
You must be signed in to change notification settings - Fork 0
/
item.h
43 lines (32 loc) · 932 Bytes
/
item.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
#ifndef ITEM_H
#define ITEM_H
#include <filesystem>
#include <memory>
#include <vector>
namespace fs = std::filesystem;
namespace kudroma {
namespace code_parser {
enum class ItemType {
Item,
Class,
Package
};
class Item : std::enable_shared_from_this<Item>
{
public:
Item(const std::shared_ptr<Item> parent);
Item(const std::string& name, const std::shared_ptr<Item> parent);
virtual void add(std::shared_ptr<Item> item);
void setDir(const fs::path& path) { dir_ = path; }
ItemType type() const { return type_; }
std::weak_ptr<Item> parent() const { return parent_; }
virtual bool build() = 0;
protected:
std::vector<std::shared_ptr<Item> > children_;
fs::path dir_;
std::string name_;
ItemType type_{ ItemType::Item };
std::weak_ptr<Item> parent_;
};
}}
#endif // ITEM_H