chromium/v8/third_party/inspector_protocol/crdtp/protocol_core.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_CRDTP_PROTOCOL_CORE_H_
#define V8_CRDTP_PROTOCOL_CORE_H_

#include <sys/types.h>

#include <memory>
#include <string>
#include <tuple>
#include <vector>

#include "cbor.h"
#include "maybe.h"
#include "serializable.h"
#include "span.h"
#include "status.h"

namespace v8_crdtp {

class DeserializerState {};

template <typename T, typename = void>
struct ProtocolTypeTraits {};

template <>
struct ProtocolTypeTraits<bool> {};

template <>
struct ProtocolTypeTraits<int32_t> {};

template <>
struct ProtocolTypeTraits<double> {};

class ContainerSerializer {};

class ObjectSerializer {};

class DeserializerDescriptor {};

ProtocolTypeTraits<std::vector<T>>;

ProtocolTypeTraits<std::unique_ptr<std::vector<T>>>;

class DeferredMessage : public Serializable {};

template <>
struct ProtocolTypeTraits<std::unique_ptr<DeferredMessage>> {};

ProtocolTypeTraits<detail::ValueMaybe<T>>;

ProtocolTypeTraits<detail::PtrMaybe<T>>;

template <typename T>
class DeserializableProtocolObject {};

template <typename T>
class ProtocolObject : public Serializable,
                       public DeserializableProtocolObject<T> {};

ProtocolTypeTraits<T, typename std::enable_if<std::is_base_of<ProtocolObject<T>, T>::value>::type>;

ProtocolTypeTraits<std::unique_ptr<T>, typename std::enable_if<std::is_base_of<ProtocolObject<T>, T>::value>::type>;

template <typename T, typename F>
bool ConvertProtocolValue(const F& from, T* to) {}

#define DECLARE_DESERIALIZATION_SUPPORT()

#define DECLARE_SERIALIZATION_SUPPORT()

#define V8_CRDTP_DESERIALIZE_FILED_IMPL(name, field, is_optional)

// clang-format off
#define V8_CRDTP_BEGIN_DESERIALIZER(type)

#define V8_CRDTP_END_DESERIALIZER()

#define V8_CRDTP_DESERIALIZE_FIELD(name, field)
#define V8_CRDTP_DESERIALIZE_FIELD_OPT(name, field)

#define V8_CRDTP_BEGIN_SERIALIZER(type)

#define V8_CRDTP_SERIALIZE_FIELD(name, field)

#define V8_CRDTP_END_SERIALIZER()
// clang-format on

}  // namespace v8_crdtp

#endif  // V8_CRDTP_PROTOCOL_CORE_H_