载入中...
搜索中...
未找到
GameplayTag.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
7#include "common/Result.h"
9#include "common/Value.h"
10
11#include <map>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace eve::tags {
17
18struct GameplayTagIdTag;
21
24
28 std::string name;
29 std::string description;
30
32 bool operator==(const GameplayTagDefinition&) const = default;
33};
34
36[[nodiscard]] EVENGINE_API_FOUNDATION bool isValidGameplayTagName(std::string_view name) noexcept;
38[[nodiscard]] GameplayTagId gameplayTagId(std::string_view name) noexcept;
40[[nodiscard]] EVENGINE_API_FOUNDATION bool gameplayTagMatches(std::string_view candidate, std::string_view query,
41 GameplayTagMatch match) noexcept;
42
50public:
52 [[nodiscard]] Result<GameplayTagId> registerTag(std::string name, std::string description = {});
54 [[nodiscard]] Result<GameplayTagDefinition> find(std::string_view name) const;
56 [[nodiscard]] bool contains(std::string_view name) const;
58 [[nodiscard]] std::vector<GameplayTagDefinition> definitions() const;
60 [[nodiscard]] std::vector<GameplayTagDefinition> search(std::string_view text, std::string_view root = {}) const;
62 [[nodiscard]] Result<Value> toValue() const;
64 [[nodiscard]] static Result<GameplayTagRegistry> fromValue(const Value& value);
65
66private:
67 std::map<std::string, GameplayTagDefinition, std::less<>> definitionsByName_;
68 std::map<GameplayTagId, std::string> nameById_;
69};
70
71} // namespace eve::tags
double value
int root
Definition AnimSmr.cpp:119
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
HexSearchContext search
Frontier reused by the land-growth and erosion searches.
std::string text
std::string description
std::string name
Move-only, checked operation results for the common layer.
Internal storage primitive for domain-owned unsigned values.
Owning, renderer-independent dynamic values.
const std::map< std::string, Value > & definitions
Move-only operation result carrying either a value or Status.
Definition Result.h:155
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Canonical owner of versioned gameplay-tag definitions.
Definition GameplayTag.h:49
bool gameplayTagMatches(std::string_view candidate, std::string_view query, GameplayTagMatch match) noexcept
Tests exact or dot-boundary descendant membership.
bool isValidGameplayTagName(std::string_view name) noexcept
Returns whether a name is a canonical dot-separated gameplay tag.
GameplayTagMatch
Selects exact or hierarchical descendant matching.
Definition GameplayTag.h:23
GameplayTagId gameplayTagId(std::string_view name) noexcept
Computes the stable 64-bit FNV-1a identifier of a canonical name.
An owning gameplay-tag definition shared by runtime and editor tools.
Definition GameplayTag.h:26
bool operator==(const GameplayTagDefinition &) const =default
Operator ==.