2023-05-21 17:24:23 -04:00
|
|
|
#include "progress_report.h"
|
|
|
|
|
|
|
|
void LSPSpec::to_json(json& j, const WorkDoneProgressCreateParams& obj) {
|
|
|
|
json_serialize(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LSPSpec::from_json(const json& j, WorkDoneProgressCreateParams& obj) {
|
|
|
|
json_deserialize_if_exists(token);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::to_json(json& j, const WorkDoneProgressBegin& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_serialize(kind);
|
|
|
|
json_serialize(title);
|
|
|
|
json_serialize(cancellable);
|
|
|
|
json_serialize_optional(message);
|
|
|
|
json_serialize_optional(percentage);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::from_json(const json& j, WorkDoneProgressBegin& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_deserialize_if_exists(kind);
|
|
|
|
json_deserialize_if_exists(title);
|
|
|
|
json_deserialize_if_exists(cancellable);
|
|
|
|
json_deserialize_optional_if_exists(message);
|
|
|
|
json_deserialize_optional_if_exists(percentage);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::to_json(json& j, const WorkDoneProgressReport& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_serialize(kind);
|
|
|
|
json_serialize(cancellable);
|
|
|
|
json_serialize_optional(message);
|
|
|
|
json_serialize_optional(percentage);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::from_json(const json& j, WorkDoneProgressReport& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_deserialize_if_exists(kind);
|
|
|
|
json_deserialize_if_exists(cancellable);
|
|
|
|
json_deserialize_optional_if_exists(message);
|
|
|
|
json_deserialize_optional_if_exists(percentage);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::to_json(json& j, const WorkDoneProgressEnd& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_serialize(kind);
|
|
|
|
json_serialize_optional(message);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::from_json(const json& j, WorkDoneProgressEnd& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_deserialize_if_exists(kind);
|
|
|
|
json_deserialize_optional_if_exists(message);
|
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::to_json(json& j, const ProgressNotificationPayload& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_serialize(token);
|
2024-03-30 19:49:07 -04:00
|
|
|
if (obj.beginValue) {
|
|
|
|
j["value"] = obj.beginValue.value();
|
|
|
|
} else if (obj.reportValue) {
|
|
|
|
j["value"] = obj.reportValue.value();
|
|
|
|
} else {
|
|
|
|
j["value"] = obj.endValue.value();
|
|
|
|
}
|
2023-05-21 17:24:23 -04:00
|
|
|
}
|
|
|
|
|
2024-03-30 19:49:07 -04:00
|
|
|
void LSPSpec::from_json(const json& j, ProgressNotificationPayload& obj) {
|
2023-05-21 17:24:23 -04:00
|
|
|
json_deserialize_if_exists(token);
|
2024-03-30 19:49:07 -04:00
|
|
|
// TODO - not needed, but if so -- deserialize 'value', it's possible to figure out which is the
|
|
|
|
// right one
|
2023-05-21 17:24:23 -04:00
|
|
|
}
|