blob: fdac574a7db07e5f7f865806f8a068646797ef47 (
plain)
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
72
|
#pragma once
#include "Model/Assets.hpp"
#include "cplt_fwd.hpp"
#include <filesystem>
#include <iosfwd>
#include <memory>
#include <string>
class Template : public Asset
{
public:
enum Kind
{
KD_Table,
InvalidKind,
KindCount = InvalidKind,
};
using CategoryType = TemplateAssetList;
private:
Kind mKind;
public:
static const char* FormatKind(Kind kind);
static std::unique_ptr<Template> CreateByKind(Kind kind);
static bool IsInstance(const Template* tmpl);
Template(Kind kind);
virtual ~Template() = default;
Kind GetKind() const;
enum ReadResult
{
RR_Success,
RR_InvalidFormat,
};
virtual ReadResult ReadFrom(std::istream& stream) = 0;
virtual void WriteTo(std::ostream& stream) const = 0;
};
class TemplateAssetList final : public AssetListTyped<Template>
{
private:
// AC = Asset Creator
std::string mACNewName;
NameSelectionError mACNewNameError = NameSelectionError::Empty;
Template::Kind mACNewKind = Template::InvalidKind;
protected:
virtual void DiscoverFiles(const std::function<void(SavedAsset)>& callback) const override;
virtual std::string RetrieveNameFromFile(const std::filesystem::path& file) const override;
virtual uuids::uuid RetrieveUuidFromFile(const std::filesystem::path& file) const override;
virtual std::filesystem::path RetrievePathFromAsset(const SavedAsset& asset) const override;
virtual void SaveEmptyInstance(const SavedAsset& asset) const override;
virtual Template* CreateEmptyInstance(const SavedAsset& diskForm) const override;
virtual Template* LoadImpl(const SavedAsset& diskForm) const override;
virtual void DisplayAssetCreator(PopupState& state) override;
virtual void SetupDetailsTable(const char* tableId) const override;
virtual void DrawBigIcon(ListState& state, const SavedAsset& asset) const override;
virtual void DrawDetailsTableRow(ListState& state, const SavedAsset& asset) const override;
};
|