mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-21 20:09:00 -05:00
Make CustomEvents more useful by adding the payload as a string
This commit is contained in:
@@ -401,10 +401,10 @@ struct EventPointJwstRequested : public Event {
|
||||
struct CustomEvent : public Event {
|
||||
static const Type Type = Event::Type::Custom;
|
||||
|
||||
CustomEvent(std::string_view subtype_, const void* payload_);
|
||||
CustomEvent(std::string_view subtype_, std::string_view payload_);
|
||||
|
||||
const tstring subtype;
|
||||
const void* payload = nullptr;
|
||||
const tstring payload;
|
||||
};
|
||||
|
||||
} // namespace openspace::events
|
||||
|
||||
@@ -428,6 +428,9 @@ ghoul::Dictionary toParameter(const Event& e) {
|
||||
d.setValue(
|
||||
"Subtype", std::string(static_cast<const CustomEvent&>(e).subtype)
|
||||
);
|
||||
d.setValue(
|
||||
"Payload", std::string(static_cast<const CustomEvent&>(e).payload)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -608,7 +611,7 @@ EventPointJwstRequested::EventPointJwstRequested(double ra_, double dec_)
|
||||
, dec(dec_)
|
||||
{}
|
||||
|
||||
CustomEvent::CustomEvent(std::string_view subtype_, const void* payload_)
|
||||
CustomEvent::CustomEvent(std::string_view subtype_, std::string_view payload_)
|
||||
: Event(Type)
|
||||
, subtype(subtype_)
|
||||
, payload(payload_)
|
||||
|
||||
Reference in New Issue
Block a user