blob: 674e7a8737b846b84d88bc147d9560cc5b23595a [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.
#include "platform/inspector_protocol/{{class_name}}.h"
namespace blink {
namespace protocol {
PassRefPtr<JSONValue> toValue(int value) { return JSONBasicValue::create(value); }
PassRefPtr<JSONValue> toValue(double value) { return JSONBasicValue::create(value); }
PassRefPtr<JSONValue> toValue(bool value) { return JSONBasicValue::create(value); }
PassRefPtr<JSONValue> toValue(const String& param) { return JSONString::create(param); }
// ------------- Enum values from types.
{% for domain in api.domains %}
{% for type in domain.types %}
{% if "enum" in type %}
namespace {{domain.domain}} {
namespace {{type.id}}Enum {
{% for literal in type.enum %}
const char* {{ literal | dash_to_camelcase}} = "{{literal}}";
{% endfor %}
} // {{type.id}}Enum
} // {{domain.domain}}
{% endif %}
{% for property in type.properties %}
{% if "enum" in property %}
namespace {{domain.domain}} {
{% for literal in property.enum %}
const char* {{type.id}}::{{property.name | to_title_case}}Enum::{{ literal | dash_to_camelcase}} = "{{literal}}";
{% endfor %}
} // {{domain.domain}}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
// ------------- Enum values from params.
{% for domain in api.domains %}
{% for command in join_arrays(domain, ["commands", "events"]) %}
{% for param in join_arrays(command, ["parameters", "returns"]) %}
{% if "enum" in param %}
namespace {{domain.domain}} {
namespace {{command.name | to_title_case}} {
namespace {{param.name | to_title_case}}Enum {
{% for literal in param.enum %}
const char* {{ literal | to_title_case}} = "{{literal}}";
{% endfor %}
} // {{param.name | to_title_case}}Enum
} // {{command.name | to_title_case }}
} // {{domain.domain}}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
} // namespace protocol
} // namespace blink