载入中...
搜索中...
未找到
EditorHostProfile.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6#include "editor/EditorIds.h"
7
8#include <cstdint>
9#include <initializer_list>
10#include <unordered_set>
11
12namespace eve::editor {
13
16
18enum class HostFeature : uint64_t {
19 None = 0,
20 ProjectDocuments = 1ull << 0,
21 SourceAssets = 1ull << 1,
22 RuntimeWorld = 1ull << 2,
23 ArbitraryScript = 1ull << 3,
24 BuildCook = 1ull << 4,
25 SourceControl = 1ull << 5,
26 MultiplayerSubmit = 1ull << 6,
27 UserCreations = 1ull << 7,
28 DebugOverride = 1ull << 8
29};
30
33 return static_cast<HostFeature>(static_cast<uint64_t>(left) | static_cast<uint64_t>(right));
34}
37 return static_cast<HostFeature>(static_cast<uint64_t>(left) & static_cast<uint64_t>(right));
38}
41 left = left | right;
42 return left;
43}
44
52public:
54 HostProfile() = default;
56 explicit HostProfile(HostKind kind) : kind_(kind) {}
57
59 static HostProfile developer();
61 static HostProfile runtimeBuilder();
63 static HostProfile automation();
64
66 HostKind kind() const { return kind_; }
68 HostFeature features() const { return features_; }
70 void setFeatures(HostFeature features) { features_ = features; }
72 void addFeatures(HostFeature features) { features_ |= features; }
74 bool hasFeatures(HostFeature required) const;
75
77 void setAllowAllCommands(bool allow) { allowAllCommands_ = allow; }
79 bool allowsAllCommands() const { return allowAllCommands_; }
81 void allowCommand(CommandId id);
83 void allowCommands(std::initializer_list<CommandId> ids);
85 void denyCommand(const CommandId& id);
87 bool allowsCommand(const CommandId& id) const;
88
90 size_t maxPayloadBytes() const { return maxPayloadBytes_; }
92 void setMaxPayloadBytes(size_t bytes) { maxPayloadBytes_ = bytes; }
93
94private:
95 HostKind kind_ = HostKind::Developer;
96 HostFeature features_ = HostFeature::None;
97 bool allowAllCommands_ = false;
98 size_t maxPayloadBytes_ = 256 * 1024;
99 std::unordered_set<CommandId, StrongEditorIdHash<CommandId>> allowedCommands_;
100 std::unordered_set<CommandId, StrongEditorIdHash<CommandId>> deniedCommands_;
101};
102
103} // namespace eve::editor
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
glm::uvec4 ids
HexVec3 left
HexVec3 right
TokenKind kind
bool required
std::uint64_t bytes
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
Upper capability boundary for one editor host.
bool allowsAllCommands() const
Allows all commands.
void setMaxPayloadBytes(size_t bytes)
Sets the max payload bytes.
HostProfile()=default
Host profile.
size_t maxPayloadBytes() const
Max payload bytes.
void setAllowAllCommands(bool allow)
Sets the allow all commands.
void setFeatures(HostFeature features)
Sets the features.
HostProfile(HostKind kind)
Host profile.
HostKind kind() const
Kind.
void addFeatures(HostFeature features)
Adds features.
HostFeature features() const
Features.
HostKind
HostKind public API.
HostFeature
Coarse host features used to discover and gate editor extensions.
constexpr HostFeature & operator|=(HostFeature &left, HostFeature right)
Operator |=.