blob: 2d4e11a469080752a67833f07bc6588efe7c2ea2 [file] [log] [blame]
// This file is generated
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef protocol_{{domain.domain}}_imported_h
#define protocol_{{domain.domain}}_imported_h
#include "{{config.lib_package}}/InspectorProtocol.h"
#include "{{config.imported.package}}/{{domain.domain}}.h"
namespace blink {
namespace protocol {
{% for type in domain.types %}
{% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %}
template<>
struct ValueConversions<{{domain.domain}}::API::{{type.id}}> {
static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
{
if (!value) {
errors->addError("value expected");
return nullptr;
}
std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.domain}}::API::{{type.id}}::fromJSONString(value->toJSONString());
if (!result)
errors->addError("cannot parse");
return result;
}
static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{type.id}}* value)
{
return SerializedValue::create(value->toJSONString());
}
static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{domain.domain}}::API::{{type.id}}>& value)
{
return SerializedValue::create(value->toJSONString());
}
};
{% endfor %}
} // namespace protocol
} // namespace blink
#endif // !defined(protocol_{{domain.domain}}_imported_h)