mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Move generate json function from EventEngine to DocumentationEngine
This commit is contained in:
@@ -366,6 +366,25 @@ nlohmann::json DocumentationEngine::generateLicenseList() const {
|
||||
return json;
|
||||
}
|
||||
|
||||
nlohmann::json DocumentationEngine::generateEventJson() const {
|
||||
nlohmann::json result;
|
||||
result["name"] = "Events";
|
||||
nlohmann::json data = nlohmann::json::array();
|
||||
|
||||
std::vector<EventEngine::ActionInfo> eventActions =
|
||||
global::eventEngine->registeredActions();
|
||||
|
||||
for (const EventEngine::ActionInfo& eventAction : eventActions) {
|
||||
nlohmann::json eventJson;
|
||||
std::string eventName = std::string(events::toString(eventAction.type));
|
||||
eventJson["name"] = eventName;
|
||||
data.push_back(eventJson);
|
||||
}
|
||||
|
||||
result["data"] = data;
|
||||
return result;
|
||||
}
|
||||
|
||||
nlohmann::json DocumentationEngine::generateFactoryManagerJson() const {
|
||||
nlohmann::json json;
|
||||
|
||||
@@ -517,7 +536,7 @@ void DocumentationEngine::writeDocumentation() const {
|
||||
nlohmann::json sceneProperties = settings.get();
|
||||
nlohmann::json sceneGraph = sceneJson.get();
|
||||
nlohmann::json actions = generateActionJson();
|
||||
nlohmann::json events = global::eventEngine->generateJson();
|
||||
nlohmann::json events = generateEventJson();
|
||||
|
||||
sceneProperties["name"] = "Settings";
|
||||
sceneGraph["name"] = "Scene";
|
||||
|
||||
@@ -257,27 +257,4 @@ scripting::LuaLibrary EventEngine::luaLibrary() {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
nlohmann::json EventEngine::generateJson() const {
|
||||
nlohmann::json result;
|
||||
result["name"] = "Events";
|
||||
nlohmann::json data = nlohmann::json::array();
|
||||
|
||||
for (auto& [key, value] : _eventActions) {
|
||||
nlohmann::json eventJson;
|
||||
std::string eventName = std::string(events::toString(key));
|
||||
eventJson["name"] = eventName;
|
||||
data.push_back(eventJson);
|
||||
}
|
||||
for (auto& [key, value] : _eventTopics) {
|
||||
nlohmann::json eventJson;
|
||||
std::string eventName = std::string(events::toString(key));
|
||||
eventJson["name"] = eventName;
|
||||
data.push_back(eventJson);
|
||||
}
|
||||
|
||||
result["data"] = data;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user