载入中...
搜索中...
未找到
ConversationPersistence.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
4
5#include "common/StateValue.h"
7
8#include <functional>
9#include <string>
10#include <unordered_map>
11#include <vector>
12
13namespace eve::dialogue {
14
17
20
23public:
24 using Resolver = std::function<const eve::dnut::SequenceAsset*(const std::string&)>;
25
33 [[nodiscard]] eve::Result<void> registerMigration(const std::string& assetId, int fromVersion,
34 const std::string& currentAssetId,
35 const std::string& nodeMap);
36
38 void clear() { rules_.clear(); }
39
41 [[nodiscard]] eve::Result<StateValue> migrate(const StateValue& state, const Resolver& resolve) const;
42
43private:
44 struct Rule {
45 std::string assetId;
46 int fromVersion = 0;
47 std::string currentAssetId;
48 std::unordered_map<std::string, std::string> nodes;
49 };
50 std::vector<Rule> rules_;
51};
52
53} // namespace eve::dialogue
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
std::map< std::string, Node > nodes
Domain-neutral compiled sequence graph for `.dnut` sources.
Share string attribute map operations through the Windows Foundation DLL.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
JSON-compatible state value tree used by state hot reload.
Definition StateValue.h:30
Explicit save migrations from an old asset version to its current version.
std::function< const eve::dnut::SequenceAsset *(const std::string &)> Resolver
void clear()
Remove all registered migrations.
eve::Result< std::string > conversationStateToJson(const StateValue &state)
Serialize a dialogue state tree as JSON.
eve::Result< StateValue > conversationStateFromJson(const std::string &json)
Parse a JSON dialogue state tree.
Immutable, parameterized and versioned compiled sequence.