Forward_h.template 2.26 KB
Newer Older
1 2
// This file is generated by Forward_h.template.

3 4 5 6 7 8 9 10 11 12 13 14
// Copyright 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 {{"_".join(config.protocol.namespace)}}_Forward_h
#define {{"_".join(config.protocol.namespace)}}_Forward_h

{% if config.lib.export_header %}
#include {{format_include(config.lib.export_header)}}
{% endif %}
#include {{format_include(config.lib.string_header)}}

15
#include <cstddef>
16
#include <memory>
17
#include <vector>
18 19
#include <unordered_map>
#include <unordered_set>
20

21
#include "{{config.crdtp.dir}}/error_support.h"
22 23
#include "{{config.crdtp.dir}}/dispatch.h"
#include "{{config.crdtp.dir}}/frontend_channel.h"
24
#include "{{config.crdtp.dir}}/protocol_core.h"
25

26 27 28 29 30
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
{% endfor %}

class DictionaryValue;
31
using DispatchResponse = {{config.crdtp.namespace}}::DispatchResponse;
32
using ErrorSupport = {{config.crdtp.namespace}}::ErrorSupport;
33 34 35 36
using Serializable = {{config.crdtp.namespace}}::Serializable;
using FrontendChannel = {{config.crdtp.namespace}}::FrontendChannel;
using DomainDispatcher = {{config.crdtp.namespace}}::DomainDispatcher;
using UberDispatcher = {{config.crdtp.namespace}}::UberDispatcher;
37 38 39
class FundamentalValue;
class ListValue;
class Object;
40
using Response = DispatchResponse;
41 42 43 44
class SerializedValue;
class StringValue;
class Value;

45 46 47 48 49 50
using {{config.crdtp.namespace}}::detail::PtrMaybe;
using {{config.crdtp.namespace}}::detail::ValueMaybe;

template<typename T>
using Maybe = {{config.crdtp.namespace}}::Maybe<T>;

51
namespace detail {
52

53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
template <typename T>
struct ArrayTypedef { typedef std::vector<std::unique_ptr<T>> type; };

template <>
struct ArrayTypedef<String> { typedef std::vector<String> type; };

template <>
struct ArrayTypedef<int> { typedef std::vector<int> type; };

template <>
struct ArrayTypedef<double> { typedef std::vector<double> type; };

template <>
struct ArrayTypedef<bool> { typedef std::vector<bool> type; };
}  // namespace detail

template <typename T>
using Array = typename detail::ArrayTypedef<T>::type;

72 73 74 75 76
{% for namespace in config.protocol.namespace %}
} // namespace {{namespace}}
{% endfor %}

#endif // !defined({{"_".join(config.protocol.namespace)}}_Forward_h)