Roll third_party/inspector_protocol to 4ad35c45aca9834b67ec2cb152c816ea1b7ceb48
This roll includes: - [inspector_protocol] Introduce protocol::Serializable [1] [1] https://codereview.chromium.org/2526603002 BUG=chromium:350797 R=dgozman@chromium.org Review-Url: https://codereview.chromium.org/2523583005 Cr-Commit-Position: refs/heads/master@{#41197}
This commit is contained in:
parent
9d1d3878dd
commit
eb3551d0a3
@ -248,9 +248,15 @@ class V8_EXPORT V8Inspector {
|
||||
class V8_EXPORT Channel {
|
||||
public:
|
||||
virtual ~Channel() {}
|
||||
virtual void sendProtocolResponse(int callId,
|
||||
const StringView& message) = 0;
|
||||
virtual void sendProtocolNotification(const StringView& message) = 0;
|
||||
virtual void sendProtocolResponse(int callId, const StringView& message) {}
|
||||
virtual void sendProtocolNotification(const StringView& message) {}
|
||||
virtual void sendResponse(int callId,
|
||||
std::unique_ptr<StringBuffer> message) {
|
||||
sendProtocolResponse(callId, message->string());
|
||||
}
|
||||
virtual void sendNotification(std::unique_ptr<StringBuffer> message) {
|
||||
sendProtocolNotification(message->string());
|
||||
}
|
||||
virtual void flushProtocolNotifications() = 0;
|
||||
};
|
||||
virtual std::unique_ptr<V8InspectorSession> connect(
|
||||
|
@ -150,7 +150,7 @@ Response InjectedScript::getProperties(
|
||||
if (!response.isSuccess()) return response;
|
||||
protocol::ErrorSupport errors;
|
||||
std::unique_ptr<Array<PropertyDescriptor>> result =
|
||||
Array<PropertyDescriptor>::parse(protocolValue.get(), &errors);
|
||||
Array<PropertyDescriptor>::fromValue(protocolValue.get(), &errors);
|
||||
if (errors.hasErrors()) return Response::Error(errors.errors());
|
||||
*properties = std::move(result);
|
||||
return Response::OK();
|
||||
@ -184,7 +184,7 @@ Response InjectedScript::wrapObject(
|
||||
if (!response.isSuccess()) return response;
|
||||
|
||||
*result =
|
||||
protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors);
|
||||
protocol::Runtime::RemoteObject::fromValue(protocolValue.get(), &errors);
|
||||
if (!result->get()) return Response::Error(errors.errors());
|
||||
return Response::OK();
|
||||
}
|
||||
@ -260,7 +260,8 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(
|
||||
Response response = toProtocolValue(context, r, &protocolValue);
|
||||
if (!response.isSuccess()) return nullptr;
|
||||
protocol::ErrorSupport errors;
|
||||
return protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors);
|
||||
return protocol::Runtime::RemoteObject::fromValue(protocolValue.get(),
|
||||
&errors);
|
||||
}
|
||||
|
||||
Response InjectedScript::findObject(const RemoteObjectId& objectId,
|
||||
@ -317,7 +318,7 @@ Response InjectedScript::resolveCallArgument(
|
||||
if (callArgument->hasValue() || callArgument->hasUnserializableValue()) {
|
||||
String16 value =
|
||||
callArgument->hasValue()
|
||||
? callArgument->getValue(nullptr)->toJSONString()
|
||||
? callArgument->getValue(nullptr)->serialize()
|
||||
: "Number(\"" + callArgument->getUnserializableValue("") + "\")";
|
||||
if (!m_context->inspector()
|
||||
->compileAndRunInternalScript(
|
||||
|
@ -1031,7 +1031,7 @@ Response V8DebuggerAgentImpl::currentCallFrames(
|
||||
Response response = toProtocolValue(debuggerContext, objects, &protocolValue);
|
||||
if (!response.isSuccess()) return response;
|
||||
protocol::ErrorSupport errorSupport;
|
||||
*result = Array<CallFrame>::parse(protocolValue.get(), &errorSupport);
|
||||
*result = Array<CallFrame>::fromValue(protocolValue.get(), &errorSupport);
|
||||
if (!*result) return Response::Error(errorSupport.errors());
|
||||
TranslateWasmStackTraceLocations(result->get(), m_debugger->wasmTranslation(),
|
||||
m_session->contextGroupId());
|
||||
@ -1164,7 +1164,7 @@ V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(
|
||||
injectedScript->wrapObject(exception, kBacktraceObjectGroup, false, false,
|
||||
&obj);
|
||||
if (obj) {
|
||||
m_breakAuxData = obj->serialize();
|
||||
m_breakAuxData = obj->toValue();
|
||||
m_breakAuxData->setBoolean("uncaught", isUncaught);
|
||||
} else {
|
||||
m_breakAuxData = nullptr;
|
||||
|
@ -126,13 +126,42 @@ protocol::DictionaryValue* V8InspectorSessionImpl::agentState(
|
||||
return state;
|
||||
}
|
||||
|
||||
void V8InspectorSessionImpl::sendProtocolResponse(int callId,
|
||||
const String16& message) {
|
||||
m_channel->sendProtocolResponse(callId, toStringView(message));
|
||||
namespace {
|
||||
|
||||
class MessageBuffer : public StringBuffer {
|
||||
public:
|
||||
static std::unique_ptr<MessageBuffer> create(
|
||||
std::unique_ptr<protocol::Serializable> message) {
|
||||
return std::unique_ptr<MessageBuffer>(
|
||||
new MessageBuffer(std::move(message)));
|
||||
}
|
||||
|
||||
const StringView& string() override {
|
||||
if (!m_serialized) {
|
||||
m_serialized = StringBuffer::create(toStringView(m_message->serialize()));
|
||||
m_message.reset(nullptr);
|
||||
}
|
||||
return m_serialized->string();
|
||||
}
|
||||
|
||||
private:
|
||||
explicit MessageBuffer(std::unique_ptr<protocol::Serializable> message)
|
||||
: m_message(std::move(message)) {}
|
||||
|
||||
std::unique_ptr<protocol::Serializable> m_message;
|
||||
std::unique_ptr<StringBuffer> m_serialized;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void V8InspectorSessionImpl::sendProtocolResponse(
|
||||
int callId, std::unique_ptr<protocol::Serializable> message) {
|
||||
m_channel->sendResponse(callId, MessageBuffer::create(std::move(message)));
|
||||
}
|
||||
|
||||
void V8InspectorSessionImpl::sendProtocolNotification(const String16& message) {
|
||||
m_channel->sendProtocolNotification(toStringView(message));
|
||||
void V8InspectorSessionImpl::sendProtocolNotification(
|
||||
std::unique_ptr<protocol::Serializable> message) {
|
||||
m_channel->sendNotification(MessageBuffer::create(std::move(message)));
|
||||
}
|
||||
|
||||
void V8InspectorSessionImpl::flushProtocolNotifications() {
|
||||
@ -309,7 +338,7 @@ void V8InspectorSessionImpl::dispatchProtocolMessage(
|
||||
}
|
||||
|
||||
std::unique_ptr<StringBuffer> V8InspectorSessionImpl::stateJSON() {
|
||||
String16 json = m_state->toJSONString();
|
||||
String16 json = m_state->serialize();
|
||||
return StringBufferImpl::adopt(json);
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,10 @@ class V8InspectorSessionImpl : public V8InspectorSession,
|
||||
protocol::DictionaryValue* agentState(const String16& name);
|
||||
|
||||
// protocol::FrontendChannel implementation.
|
||||
void sendProtocolResponse(int callId, const String16& message) override;
|
||||
void sendProtocolNotification(const String16& message) override;
|
||||
void sendProtocolResponse(
|
||||
int callId, std::unique_ptr<protocol::Serializable> message) override;
|
||||
void sendProtocolNotification(
|
||||
std::unique_ptr<protocol::Serializable> message) override;
|
||||
void flushProtocolNotifications() override;
|
||||
|
||||
int m_contextGroupId;
|
||||
|
15
third_party/inspector_protocol/CodeGenerator.py
vendored
15
third_party/inspector_protocol/CodeGenerator.py
vendored
@ -8,6 +8,7 @@ import optparse
|
||||
import collections
|
||||
import functools
|
||||
import re
|
||||
import copy
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
@ -469,6 +470,20 @@ def main():
|
||||
protocol.imported_domains = read_protocol_file(config.imported.path, protocol.json_api) if config.imported else []
|
||||
patch_full_qualified_refs(protocol)
|
||||
calculate_imports_and_exports(config, protocol)
|
||||
|
||||
for domain in protocol.json_api["domains"]:
|
||||
if "events" in domain:
|
||||
for event in domain["events"]:
|
||||
event_type = dict()
|
||||
event_type["description"] = "Wrapper for notification params"
|
||||
event_type["type"] = "object"
|
||||
event_type["id"] = to_title_case(event["name"]) + "Notification"
|
||||
if "parameters" in event:
|
||||
event_type["properties"] = copy.deepcopy(event["parameters"])
|
||||
if "types" not in domain:
|
||||
domain["types"] = list()
|
||||
domain["types"].append(event_type)
|
||||
|
||||
create_type_definitions(protocol, "::".join(config.imported.namespace) if config.imported else "")
|
||||
|
||||
if not config.exported and len(protocol.exported_domains):
|
||||
|
2
third_party/inspector_protocol/README.v8
vendored
2
third_party/inspector_protocol/README.v8
vendored
@ -2,7 +2,7 @@ Name: inspector protocol
|
||||
Short Name: inspector_protocol
|
||||
URL: https://chromium.googlesource.com/deps/inspector_protocol/
|
||||
Version: 0
|
||||
Revision: ef8aa4e19e53a105843cd469e8122d098d902b47
|
||||
Revision: 4ad35c45aca9834b67ec2cb152c816ea1b7ceb48
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
Security Critical: no
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
return std::unique_ptr<Array<T>>(new Array<T>());
|
||||
}
|
||||
|
||||
static std::unique_ptr<Array<T>> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<Array<T>> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
protocol::ListValue* array = ListValue::cast(value);
|
||||
if (!array) {
|
||||
@ -33,7 +33,7 @@ public:
|
||||
errors->push();
|
||||
for (size_t i = 0; i < array->size(); ++i) {
|
||||
errors->setName(StringUtil::fromInteger(i));
|
||||
std::unique_ptr<T> item = ValueConversions<T>::parse(array->at(i), errors);
|
||||
std::unique_ptr<T> item = ValueConversions<T>::fromValue(array->at(i), errors);
|
||||
result->m_vector.push_back(std::move(item));
|
||||
}
|
||||
errors->pop();
|
||||
@ -57,11 +57,11 @@ public:
|
||||
return m_vector[index].get();
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::ListValue> serialize()
|
||||
std::unique_ptr<protocol::ListValue> toValue()
|
||||
{
|
||||
std::unique_ptr<protocol::ListValue> result = ListValue::create();
|
||||
for (auto& item : m_vector)
|
||||
result->pushValue(ValueConversions<T>::serialize(item));
|
||||
result->pushValue(ValueConversions<T>::toValue(item));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public:
|
||||
return std::unique_ptr<Array<T>>(new Array<T>());
|
||||
}
|
||||
|
||||
static std::unique_ptr<Array<T>> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<Array<T>> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
protocol::ListValue* array = ListValue::cast(value);
|
||||
if (!array) {
|
||||
@ -88,7 +88,7 @@ public:
|
||||
std::unique_ptr<Array<T>> result(new Array<T>());
|
||||
for (size_t i = 0; i < array->size(); ++i) {
|
||||
errors->setName(StringUtil::fromInteger(i));
|
||||
T item = ValueConversions<T>::parse(array->at(i), errors);
|
||||
T item = ValueConversions<T>::fromValue(array->at(i), errors);
|
||||
result->m_vector.push_back(item);
|
||||
}
|
||||
errors->pop();
|
||||
@ -112,11 +112,11 @@ public:
|
||||
return m_vector[index];
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::ListValue> serialize()
|
||||
std::unique_ptr<protocol::ListValue> toValue()
|
||||
{
|
||||
std::unique_ptr<protocol::ListValue> result = ListValue::create();
|
||||
for (auto& item : m_vector)
|
||||
result->pushValue(ValueConversions<T>::serialize(item));
|
||||
result->pushValue(ValueConversions<T>::toValue(item));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -137,16 +137,13 @@ bool DispatcherBase::getCommandName(const String& message, String* result)
|
||||
|
||||
void DispatcherBase::sendResponse(int callId, const DispatchResponse& response, std::unique_ptr<protocol::DictionaryValue> result)
|
||||
{
|
||||
if (!m_frontendChannel)
|
||||
return;
|
||||
if (response.status() == DispatchResponse::kError) {
|
||||
reportProtocolError(callId, response.errorCode(), response.errorMessage(), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> responseMessage = DictionaryValue::create();
|
||||
responseMessage->setInteger("id", callId);
|
||||
responseMessage->setObject("result", std::move(result));
|
||||
if (m_frontendChannel)
|
||||
m_frontendChannel->sendProtocolResponse(callId, responseMessage->toJSONString());
|
||||
m_frontendChannel->sendProtocolResponse(callId, InternalResponse::createResponse(callId, std::move(result)));
|
||||
}
|
||||
|
||||
void DispatcherBase::sendResponse(int callId, const DispatchResponse& response)
|
||||
@ -154,31 +151,67 @@ void DispatcherBase::sendResponse(int callId, const DispatchResponse& response)
|
||||
sendResponse(callId, response, DictionaryValue::create());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class ProtocolError : public Serializable {
|
||||
public:
|
||||
static std::unique_ptr<ProtocolError> createErrorResponse(int callId, DispatchResponse::ErrorCode code, const String& errorMessage, ErrorSupport* errors)
|
||||
{
|
||||
std::unique_ptr<ProtocolError> protocolError(new ProtocolError(code, errorMessage));
|
||||
protocolError->m_callId = callId;
|
||||
protocolError->m_hasCallId = true;
|
||||
if (errors && errors->hasErrors())
|
||||
protocolError->m_data = errors->errors();
|
||||
return protocolError;
|
||||
}
|
||||
|
||||
static std::unique_ptr<ProtocolError> createErrorNotification(DispatchResponse::ErrorCode code, const String& errorMessage)
|
||||
{
|
||||
return std::unique_ptr<ProtocolError>(new ProtocolError(code, errorMessage));
|
||||
}
|
||||
|
||||
String serialize() override
|
||||
{
|
||||
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create();
|
||||
error->setInteger("code", m_code);
|
||||
error->setString("message", m_errorMessage);
|
||||
if (m_data.length())
|
||||
error->setString("data", m_data);
|
||||
std::unique_ptr<protocol::DictionaryValue> message = DictionaryValue::create();
|
||||
message->setObject("error", std::move(error));
|
||||
if (m_hasCallId)
|
||||
message->setInteger("id", m_callId);
|
||||
return message->serialize();
|
||||
}
|
||||
|
||||
~ProtocolError() override {}
|
||||
|
||||
private:
|
||||
ProtocolError(DispatchResponse::ErrorCode code, const String& errorMessage)
|
||||
: m_code(code)
|
||||
, m_errorMessage(errorMessage)
|
||||
{
|
||||
}
|
||||
|
||||
DispatchResponse::ErrorCode m_code;
|
||||
String m_errorMessage;
|
||||
String m_data;
|
||||
int m_callId = 0;
|
||||
bool m_hasCallId = false;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static void reportProtocolErrorTo(FrontendChannel* frontendChannel, int callId, DispatchResponse::ErrorCode code, const String& errorMessage, ErrorSupport* errors)
|
||||
{
|
||||
if (!frontendChannel)
|
||||
return;
|
||||
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create();
|
||||
error->setInteger("code", code);
|
||||
error->setString("message", errorMessage);
|
||||
if (errors && errors->hasErrors())
|
||||
error->setString("data", errors->errors());
|
||||
std::unique_ptr<protocol::DictionaryValue> message = DictionaryValue::create();
|
||||
message->setObject("error", std::move(error));
|
||||
message->setInteger("id", callId);
|
||||
frontendChannel->sendProtocolResponse(callId, message->toJSONString());
|
||||
if (frontendChannel)
|
||||
frontendChannel->sendProtocolResponse(callId, ProtocolError::createErrorResponse(callId, code, errorMessage, errors));
|
||||
}
|
||||
|
||||
static void reportProtocolErrorTo(FrontendChannel* frontendChannel, DispatchResponse::ErrorCode code, const String& errorMessage)
|
||||
{
|
||||
if (!frontendChannel)
|
||||
return;
|
||||
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create();
|
||||
error->setInteger("code", code);
|
||||
error->setString("message", errorMessage);
|
||||
std::unique_ptr<protocol::DictionaryValue> message = DictionaryValue::create();
|
||||
message->setObject("error", std::move(error));
|
||||
frontendChannel->sendProtocolNotification(message->toJSONString());
|
||||
if (frontendChannel)
|
||||
frontendChannel->sendProtocolNotification(ProtocolError::createErrorNotification(code, errorMessage));
|
||||
}
|
||||
|
||||
void DispatcherBase::reportProtocolError(int callId, DispatchResponse::ErrorCode code, const String& errorMessage, ErrorSupport* errors)
|
||||
@ -263,6 +296,39 @@ DispatchResponse::Status UberDispatcher::dispatch(std::unique_ptr<Value> parsedM
|
||||
|
||||
UberDispatcher::~UberDispatcher() = default;
|
||||
|
||||
// static
|
||||
std::unique_ptr<InternalResponse> InternalResponse::createResponse(int callId, std::unique_ptr<Serializable> params)
|
||||
{
|
||||
return std::unique_ptr<InternalResponse>(new InternalResponse(callId, String(), std::move(params)));
|
||||
}
|
||||
|
||||
// static
|
||||
std::unique_ptr<InternalResponse> InternalResponse::createNotification(const String& notification, std::unique_ptr<Serializable> params)
|
||||
{
|
||||
return std::unique_ptr<InternalResponse>(new InternalResponse(0, notification, std::move(params)));
|
||||
}
|
||||
|
||||
String InternalResponse::serialize()
|
||||
{
|
||||
std::unique_ptr<DictionaryValue> result = DictionaryValue::create();
|
||||
std::unique_ptr<Serializable> params(m_params ? std::move(m_params) : DictionaryValue::create());
|
||||
if (m_notification.length()) {
|
||||
result->setString("method", m_notification);
|
||||
result->setValue("params", SerializedValue::create(params->serialize()));
|
||||
} else {
|
||||
result->setInteger("id", m_callId);
|
||||
result->setValue("result", SerializedValue::create(params->serialize()));
|
||||
}
|
||||
return result->serialize();
|
||||
}
|
||||
|
||||
InternalResponse::InternalResponse(int callId, const String& notification, std::unique_ptr<Serializable> params)
|
||||
: m_callId(callId)
|
||||
, m_notification(notification)
|
||||
, m_params(params ? std::move(params) : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
{% for namespace in config.protocol.namespace %}
|
||||
} // namespace {{namespace}}
|
||||
{% endfor %}
|
||||
|
@ -125,6 +125,46 @@ private:
|
||||
protocol::HashMap<String, std::unique_ptr<protocol::DispatcherBase>> m_dispatchers;
|
||||
};
|
||||
|
||||
class InternalResponse : public Serializable {
|
||||
PROTOCOL_DISALLOW_COPY(InternalResponse);
|
||||
public:
|
||||
static std::unique_ptr<InternalResponse> createResponse(int callId, std::unique_ptr<Serializable> params);
|
||||
static std::unique_ptr<InternalResponse> createNotification(const String& notification, std::unique_ptr<Serializable> params = nullptr);
|
||||
|
||||
String serialize() override;
|
||||
|
||||
~InternalResponse() override {}
|
||||
|
||||
private:
|
||||
InternalResponse(int callId, const String& notification, std::unique_ptr<Serializable> params);
|
||||
|
||||
int m_callId;
|
||||
String m_notification;
|
||||
std::unique_ptr<Serializable> m_params;
|
||||
};
|
||||
|
||||
class InternalRawNotification : public Serializable {
|
||||
public:
|
||||
static std::unique_ptr<InternalRawNotification> create(const String& notification)
|
||||
{
|
||||
return std::unique_ptr<InternalRawNotification>(new InternalRawNotification(notification));
|
||||
}
|
||||
~InternalRawNotification() override {}
|
||||
|
||||
String serialize() override
|
||||
{
|
||||
return m_notification;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit InternalRawNotification(const String& notification)
|
||||
: m_notification(notification)
|
||||
{
|
||||
}
|
||||
|
||||
String m_notification;
|
||||
};
|
||||
|
||||
{% for namespace in config.protocol.namespace %}
|
||||
} // namespace {{namespace}}
|
||||
{% endfor %}
|
||||
|
@ -9,11 +9,17 @@
|
||||
namespace {{namespace}} {
|
||||
{% endfor %}
|
||||
|
||||
class {{config.lib.export_macro}} Serializable {
|
||||
public:
|
||||
virtual String serialize() = 0;
|
||||
virtual ~Serializable() = default;
|
||||
};
|
||||
|
||||
class {{config.lib.export_macro}} FrontendChannel {
|
||||
public:
|
||||
virtual ~FrontendChannel() { }
|
||||
virtual void sendProtocolResponse(int callId, const String& message) = 0;
|
||||
virtual void sendProtocolNotification(const String& message) = 0;
|
||||
virtual void sendProtocolResponse(int callId, std::unique_ptr<Serializable> message) = 0;
|
||||
virtual void sendProtocolNotification(std::unique_ptr<Serializable> message) = 0;
|
||||
virtual void flushProtocolNotifications() = 0;
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
T* fromJust() const { DCHECK(m_value); return m_value.get(); }
|
||||
T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; }
|
||||
bool isJust() const { return !!m_value; }
|
||||
std::unique_ptr<T> takeJust() { DCHECK(m_value); return m_value.release(); }
|
||||
std::unique_ptr<T> takeJust() { DCHECK(m_value); return std::move(m_value); }
|
||||
private:
|
||||
std::unique_ptr<T> m_value;
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
namespace {{namespace}} {
|
||||
{% endfor %}
|
||||
|
||||
std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* errors)
|
||||
std::unique_ptr<Object> Object::fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
protocol::DictionaryValue* dictionary = DictionaryValue::cast(value);
|
||||
if (!dictionary) {
|
||||
@ -19,7 +19,7 @@ std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* erro
|
||||
return std::unique_ptr<Object>(new Object(std::unique_ptr<DictionaryValue>(dictionary)));
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> Object::serialize() const
|
||||
std::unique_ptr<protocol::DictionaryValue> Object::toValue() const
|
||||
{
|
||||
return DictionaryValue::cast(m_object->clone());
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ namespace {{namespace}} {
|
||||
|
||||
class {{config.lib.export_macro}} Object {
|
||||
public:
|
||||
static std::unique_ptr<Object> parse(protocol::Value*, ErrorSupport*);
|
||||
static std::unique_ptr<Object> fromValue(protocol::Value*, ErrorSupport*);
|
||||
~Object();
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> serialize() const;
|
||||
std::unique_ptr<protocol::DictionaryValue> toValue() const;
|
||||
std::unique_ptr<Object> clone() const;
|
||||
private:
|
||||
explicit Object(std::unique_ptr<protocol::DictionaryValue>);
|
||||
|
@ -15,25 +15,25 @@ namespace {{namespace}} {
|
||||
|
||||
template<typename T>
|
||||
struct ValueConversions {
|
||||
static std::unique_ptr<T> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<T> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
return T::parse(value, errors);
|
||||
return T::fromValue(value, errors);
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(T* value)
|
||||
static std::unique_ptr<protocol::Value> toValue(T* value)
|
||||
{
|
||||
return value->serialize();
|
||||
return value->toValue();
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<T>& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<T>& value)
|
||||
{
|
||||
return value->serialize();
|
||||
return value->toValue();
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ValueConversions<bool> {
|
||||
static bool parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static bool fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
bool result = false;
|
||||
bool success = value ? value->asBoolean(&result) : false;
|
||||
@ -42,7 +42,7 @@ struct ValueConversions<bool> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(bool value)
|
||||
static std::unique_ptr<protocol::Value> toValue(bool value)
|
||||
{
|
||||
return FundamentalValue::create(value);
|
||||
}
|
||||
@ -50,7 +50,7 @@ struct ValueConversions<bool> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<int> {
|
||||
static int parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static int fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
int result = 0;
|
||||
bool success = value ? value->asInteger(&result) : false;
|
||||
@ -59,7 +59,7 @@ struct ValueConversions<int> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(int value)
|
||||
static std::unique_ptr<protocol::Value> toValue(int value)
|
||||
{
|
||||
return FundamentalValue::create(value);
|
||||
}
|
||||
@ -67,7 +67,7 @@ struct ValueConversions<int> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<double> {
|
||||
static double parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static double fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
double result = 0;
|
||||
bool success = value ? value->asDouble(&result) : false;
|
||||
@ -76,7 +76,7 @@ struct ValueConversions<double> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(double value)
|
||||
static std::unique_ptr<protocol::Value> toValue(double value)
|
||||
{
|
||||
return FundamentalValue::create(value);
|
||||
}
|
||||
@ -84,7 +84,7 @@ struct ValueConversions<double> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<String> {
|
||||
static String parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static String fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
String result;
|
||||
bool success = value ? value->asString(&result) : false;
|
||||
@ -93,7 +93,7 @@ struct ValueConversions<String> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const String& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const String& value)
|
||||
{
|
||||
return StringValue::create(value);
|
||||
}
|
||||
@ -101,7 +101,7 @@ struct ValueConversions<String> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<Value> {
|
||||
static std::unique_ptr<Value> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<Value> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
bool success = !!value;
|
||||
if (!success) {
|
||||
@ -111,12 +111,12 @@ struct ValueConversions<Value> {
|
||||
return value->clone();
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(Value* value)
|
||||
static std::unique_ptr<protocol::Value> toValue(Value* value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<Value>& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<Value>& value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
@ -124,7 +124,7 @@ struct ValueConversions<Value> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<DictionaryValue> {
|
||||
static std::unique_ptr<DictionaryValue> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<DictionaryValue> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
bool success = value && value->type() == protocol::Value::TypeObject;
|
||||
if (!success)
|
||||
@ -132,12 +132,12 @@ struct ValueConversions<DictionaryValue> {
|
||||
return DictionaryValue::cast(value->clone());
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(DictionaryValue* value)
|
||||
static std::unique_ptr<protocol::Value> toValue(DictionaryValue* value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<DictionaryValue>& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<DictionaryValue>& value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
@ -145,7 +145,7 @@ struct ValueConversions<DictionaryValue> {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<ListValue> {
|
||||
static std::unique_ptr<ListValue> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<ListValue> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
bool success = value && value->type() == protocol::Value::TypeArray;
|
||||
if (!success)
|
||||
@ -153,12 +153,12 @@ struct ValueConversions<ListValue> {
|
||||
return ListValue::cast(value->clone());
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(ListValue* value)
|
||||
static std::unique_ptr<protocol::Value> toValue(ListValue* value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<ListValue>& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<ListValue>& value)
|
||||
{
|
||||
return value->clone();
|
||||
}
|
||||
|
@ -93,14 +93,6 @@ bool Value::asSerialized(String*) const
|
||||
return false;
|
||||
}
|
||||
|
||||
String Value::toJSONString() const
|
||||
{
|
||||
StringBuilder result;
|
||||
StringUtil::builderReserve(result, 512);
|
||||
writeJSON(&result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
void Value::writeJSON(StringBuilder* output) const
|
||||
{
|
||||
DCHECK(m_type == TypeNull);
|
||||
@ -112,6 +104,14 @@ std::unique_ptr<Value> Value::clone() const
|
||||
return Value::null();
|
||||
}
|
||||
|
||||
String Value::serialize()
|
||||
{
|
||||
StringBuilder result;
|
||||
StringUtil::builderReserve(result, 512);
|
||||
writeJSON(&result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
bool FundamentalValue::asBoolean(bool* output) const
|
||||
{
|
||||
if (type() != TypeBoolean)
|
||||
|
@ -17,10 +17,10 @@ class ListValue;
|
||||
class DictionaryValue;
|
||||
class Value;
|
||||
|
||||
class {{config.lib.export_macro}} Value {
|
||||
class {{config.lib.export_macro}} Value : public Serializable {
|
||||
PROTOCOL_DISALLOW_COPY(Value);
|
||||
public:
|
||||
virtual ~Value() { }
|
||||
virtual ~Value() override { }
|
||||
|
||||
static std::unique_ptr<Value> null()
|
||||
{
|
||||
@ -48,9 +48,9 @@ public:
|
||||
virtual bool asString(String* output) const;
|
||||
virtual bool asSerialized(String* output) const;
|
||||
|
||||
String toJSONString() const;
|
||||
virtual void writeJSON(StringBuilder* output) const;
|
||||
virtual std::unique_ptr<Value> clone() const;
|
||||
String serialize() override;
|
||||
|
||||
protected:
|
||||
Value() : m_type(TypeNull) { }
|
||||
|
@ -22,28 +22,28 @@ namespace {{namespace}} {
|
||||
|
||||
template<>
|
||||
struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> {
|
||||
static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
|
||||
static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}> fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
if (!value) {
|
||||
errors->addError("value expected");
|
||||
return nullptr;
|
||||
}
|
||||
String json = value->toJSONString();
|
||||
String json = value->serialize();
|
||||
auto result = {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}::fromJSONString({{config.imported.to_imported_string % "json"}});
|
||||
if (!result)
|
||||
errors->addError("cannot parse");
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const {{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value)
|
||||
{
|
||||
auto json = value->toJSONString();
|
||||
return SerializedValue::create({{config.imported.from_imported_string % "std::move(json)"}});
|
||||
}
|
||||
|
||||
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& value)
|
||||
static std::unique_ptr<protocol::Value> toValue(const std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& value)
|
||||
{
|
||||
return serialize(value.get());
|
||||
return toValue(value.get());
|
||||
}
|
||||
};
|
||||
{% endfor %}
|
||||
|
@ -47,7 +47,7 @@ const char* {{type.id}}::{{property.name | to_title_case}}Enum::{{literal | dash
|
||||
{% endfor %}
|
||||
{% if not (type.type == "object") or not ("properties" in type) %}{% continue %}{% endif %}
|
||||
|
||||
std::unique_ptr<{{type.id}}> {{type.id}}::parse(protocol::Value* value, ErrorSupport* errors)
|
||||
std::unique_ptr<{{type.id}}> {{type.id}}::fromValue(protocol::Value* value, ErrorSupport* errors)
|
||||
{
|
||||
if (!value || value->type() != protocol::Value::TypeObject) {
|
||||
errors->addError("object expected");
|
||||
@ -62,11 +62,11 @@ std::unique_ptr<{{type.id}}> {{type.id}}::parse(protocol::Value* value, ErrorSup
|
||||
{% if property.optional %}
|
||||
if ({{property.name}}Value) {
|
||||
errors->setName("{{property.name}}");
|
||||
result->m_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors);
|
||||
result->m_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::fromValue({{property.name}}Value, errors);
|
||||
}
|
||||
{% else %}
|
||||
errors->setName("{{property.name}}");
|
||||
result->m_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors);
|
||||
result->m_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::fromValue({{property.name}}Value, errors);
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
errors->pop();
|
||||
@ -75,15 +75,15 @@ std::unique_ptr<{{type.id}}> {{type.id}}::parse(protocol::Value* value, ErrorSup
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> {{type.id}}::serialize() const
|
||||
std::unique_ptr<protocol::DictionaryValue> {{type.id}}::toValue() const
|
||||
{
|
||||
std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
|
||||
{% for property in type.properties %}
|
||||
{% if property.optional %}
|
||||
if (m_{{property.name}}.isJust())
|
||||
result->setValue("{{property.name}}", ValueConversions<{{resolve_type(property).raw_type}}>::serialize(m_{{property.name}}.fromJust()));
|
||||
result->setValue("{{property.name}}", ValueConversions<{{resolve_type(property).raw_type}}>::toValue(m_{{property.name}}.fromJust()));
|
||||
{% else %}
|
||||
result->setValue("{{property.name}}", ValueConversions<{{resolve_type(property).raw_type}}>::serialize({{resolve_type(property).to_raw_type % ("m_" + property.name)}}));
|
||||
result->setValue("{{property.name}}", ValueConversions<{{resolve_type(property).raw_type}}>::toValue({{resolve_type(property).to_raw_type % ("m_" + property.name)}}));
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
return result;
|
||||
@ -92,13 +92,13 @@ std::unique_ptr<protocol::DictionaryValue> {{type.id}}::serialize() const
|
||||
std::unique_ptr<{{type.id}}> {{type.id}}::clone() const
|
||||
{
|
||||
ErrorSupport errors;
|
||||
return parse(serialize().get(), &errors);
|
||||
return fromValue(toValue().get(), &errors);
|
||||
}
|
||||
{% if type.exported %}
|
||||
|
||||
{{config.exported.string_out}} {{type.id}}::toJSONString() const
|
||||
{
|
||||
String json = serialize()->toJSONString();
|
||||
String json = toValue()->serialize();
|
||||
return {{config.exported.to_string_out % "json"}};
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const {{confi
|
||||
std::unique_ptr<Value> value = StringUtil::parseJSON(json);
|
||||
if (!value)
|
||||
return nullptr;
|
||||
return protocol::{{domain.domain}}::{{type.id}}::parse(value.get(), &errors);
|
||||
return protocol::{{domain.domain}}::{{type.id}}::fromValue(value.get(), &errors);
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@ -156,20 +156,26 @@ void Frontend::{{event.name | to_method_case}}(
|
||||
{%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%}
|
||||
{% endfor -%})
|
||||
{
|
||||
std::unique_ptr<protocol::DictionaryValue> jsonMessage = DictionaryValue::create();
|
||||
jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}");
|
||||
std::unique_ptr<protocol::DictionaryValue> paramsObject = DictionaryValue::create();
|
||||
{% for parameter in event.parameters %}
|
||||
{% if "optional" in parameter %}
|
||||
if (!m_frontendChannel)
|
||||
return;
|
||||
{% if event.parameters %}
|
||||
std::unique_ptr<{{event.name | to_title_case}}Notification> messageData = {{event.name | to_title_case}}Notification::{{"create" | to_method_case}}()
|
||||
{% for parameter in event.parameters %}
|
||||
{% if not "optional" in parameter %}
|
||||
.{{"set" | to_method_case}}{{parameter.name | to_title_case}}({{resolve_type(parameter).to_pass_type % parameter.name}})
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
.{{ "build" | to_method_case }}();
|
||||
{% for parameter in event.parameters %}
|
||||
{% if "optional" in parameter %}
|
||||
if ({{parameter.name}}.isJust())
|
||||
paramsObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize({{parameter.name}}.fromJust()));
|
||||
messageData->{{"set" | to_method_case}}{{parameter.name | to_title_case}}(std::move({{parameter.name}}).takeJust());
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("{{domain.domain}}.{{event.name}}", std::move(messageData)));
|
||||
{% else %}
|
||||
paramsObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize({{resolve_type(parameter).to_raw_type % parameter.name}}));
|
||||
m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("{{domain.domain}}.{{event.name}}"));
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
jsonMessage->setObject("params", std::move(paramsObject));
|
||||
if (m_frontendChannel)
|
||||
m_frontendChannel->sendProtocolNotification(jsonMessage->toJSONString());
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
@ -180,7 +186,7 @@ void Frontend::flush()
|
||||
|
||||
void Frontend::sendRawNotification(const String& notification)
|
||||
{
|
||||
m_frontendChannel->sendProtocolNotification(notification);
|
||||
m_frontendChannel->sendProtocolNotification(InternalRawNotification::create(notification));
|
||||
}
|
||||
|
||||
// --------------------- Dispatcher.
|
||||
@ -253,9 +259,9 @@ public:
|
||||
{% for parameter in command.returns %}
|
||||
{% if "optional" in parameter %}
|
||||
if ({{parameter.name}}.isJust())
|
||||
resultObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize({{parameter.name}}.fromJust()));
|
||||
resultObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::toValue({{parameter.name}}.fromJust()));
|
||||
{% else %}
|
||||
resultObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize({{resolve_type(parameter).to_raw_type % parameter.name}}));
|
||||
resultObject->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::toValue({{resolve_type(parameter).to_raw_type % parameter.name}}));
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
sendIfActive(std::move(resultObject), DispatchResponse::OK());
|
||||
@ -286,11 +292,11 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
|
||||
Maybe<{{resolve_type(property).raw_type}}> in_{{property.name}};
|
||||
if ({{property.name}}Value) {
|
||||
errors->setName("{{property.name}}");
|
||||
in_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors);
|
||||
in_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::fromValue({{property.name}}Value, errors);
|
||||
}
|
||||
{% else %}
|
||||
errors->setName("{{property.name}}");
|
||||
{{resolve_type(property).type}} in_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors);
|
||||
{{resolve_type(property).type}} in_{{property.name}} = ValueConversions<{{resolve_type(property).raw_type}}>::fromValue({{property.name}}Value, errors);
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
errors->pop();
|
||||
@ -335,9 +341,9 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
|
||||
{% for parameter in command.returns %}
|
||||
{% if "optional" in parameter %}
|
||||
if (out_{{parameter.name}}.isJust())
|
||||
result->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize(out_{{parameter.name}}.fromJust()));
|
||||
result->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::toValue(out_{{parameter.name}}.fromJust()));
|
||||
{% else %}
|
||||
result->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::serialize({{resolve_type(parameter).to_raw_type % ("out_" + parameter.name)}}));
|
||||
result->setValue("{{parameter.name}}", ValueConversions<{{resolve_type(parameter).raw_type}}>::toValue({{resolve_type(parameter).to_raw_type % ("out_" + parameter.name)}}));
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
@ -71,12 +71,12 @@ namespace {{param.name | to_title_case}}Enum {
|
||||
{% set type_def = type_definition(domain.domain + "." + type.id)%}
|
||||
|
||||
// {{type.description}}
|
||||
class {{config.protocol.export_macro}} {{type.id}} {% if type.exported %}: public API::{{type.id}} {% endif %}{
|
||||
class {{config.protocol.export_macro}} {{type.id}} : public Serializable{% if type.exported %}, public API::{{type.id}}{% endif %}{
|
||||
PROTOCOL_DISALLOW_COPY({{type.id}});
|
||||
public:
|
||||
static std::unique_ptr<{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors);
|
||||
static std::unique_ptr<{{type.id}}> fromValue(protocol::Value* value, ErrorSupport* errors);
|
||||
|
||||
~{{type.id}}() { }
|
||||
~{{type.id}}() override { }
|
||||
{% for property in type.properties %}
|
||||
{% if "enum" in property %}
|
||||
|
||||
@ -96,7 +96,8 @@ public:
|
||||
void {{"set" | to_method_case}}{{property.name | to_title_case}}({{resolve_type(property).pass_type}} value) { m_{{property.name}} = {{resolve_type(property).to_rvalue % "value"}}; }
|
||||
{% endfor %}
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> serialize() const;
|
||||
std::unique_ptr<protocol::DictionaryValue> toValue() const;
|
||||
String serialize() override { return toValue()->serialize(); }
|
||||
std::unique_ptr<{{type.id}}> clone() const;
|
||||
{% if type.exported %}
|
||||
{{config.exported.string_out}} toJSONString() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user