载入中...
搜索中...
未找到
ObjectRegistry.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4
5#include <simplesquirrel/simplesquirrel.hpp>
6
7#include <cstdint>
8#include <map>
9#include <string>
10#include <vector>
11
12namespace eve::ui {
13
16 uint64_t id = 0;
17 std::string className;
18 std::string label;
19 ssq::Object object;
20};
21
31public:
34
35 static ObjectRegistry& instance();
36
42 uint64_t create(const std::string& className);
50 uint64_t registerObject(const std::string& className, const ssq::Object& object,
51 const std::string& label = {});
53 bool unregister(uint64_t id);
55 void clear(const std::string& className);
57 void clearAll();
58
60 std::vector<std::string> classNames() const;
62 std::vector<ObjectEntry> entries(const std::string& className) const;
64 const ObjectEntry* entry(uint64_t id) const;
66 size_t count(const std::string& className) const;
67
68private:
69 ObjectRegistry() = default;
70 uint64_t nextId_ = 1;
71 std::map<std::string, std::vector<ObjectEntry>> byClass_;
72};
73
74} // namespace eve::ui
#define EVENGINE_API
宿主(eve / libmain)导出宏;插件从进程导入同一批符号。
Definition Export.h:16
Reflectable script-object registry backing the database panel.
ObjectRegistry(const ObjectRegistry &)=delete
ObjectRegistry & operator=(const ObjectRegistry &)=delete
One registered live script instance.