11cb0ef41Sopenharmony_ci// This file is generated by Object_cpp.template. 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Copyright 2016 The Chromium Authors. All rights reserved. 41cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 51cb0ef41Sopenharmony_ci// found in the LICENSE file. 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci//#include "Object.h" 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{% for namespace in config.protocol.namespace %} 101cb0ef41Sopenharmony_cinamespace {{namespace}} { 111cb0ef41Sopenharmony_ci{% endfor %} 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cistd::unique_ptr<Object> Object::fromValue(protocol::Value* value, ErrorSupport* errors) 141cb0ef41Sopenharmony_ci{ 151cb0ef41Sopenharmony_ci protocol::DictionaryValue* dictionary = DictionaryValue::cast(value); 161cb0ef41Sopenharmony_ci if (!dictionary) { 171cb0ef41Sopenharmony_ci errors->addError("object expected"); 181cb0ef41Sopenharmony_ci return nullptr; 191cb0ef41Sopenharmony_ci } 201cb0ef41Sopenharmony_ci dictionary = static_cast<protocol::DictionaryValue*>(dictionary->clone().release()); 211cb0ef41Sopenharmony_ci return std::unique_ptr<Object>(new Object(std::unique_ptr<DictionaryValue>(dictionary))); 221cb0ef41Sopenharmony_ci} 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_cistd::unique_ptr<protocol::DictionaryValue> Object::toValue() const 251cb0ef41Sopenharmony_ci{ 261cb0ef41Sopenharmony_ci return DictionaryValue::cast(m_object->clone()); 271cb0ef41Sopenharmony_ci} 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_cistd::unique_ptr<Object> Object::clone() const 301cb0ef41Sopenharmony_ci{ 311cb0ef41Sopenharmony_ci return std::unique_ptr<Object>(new Object(DictionaryValue::cast(m_object->clone()))); 321cb0ef41Sopenharmony_ci} 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ciObject::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std::move(object)) { } 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ciObject::~Object() { } 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci{% for namespace in config.protocol.namespace %} 391cb0ef41Sopenharmony_ci} // namespace {{namespace}} 401cb0ef41Sopenharmony_ci{% endfor %} 41