chromium/ppapi/proxy/ppapi_message_utils.h

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

#ifndef PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_
#define PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_

#include "base/pickle.h"
#include "base/tuple.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_utils.h"

namespace ppapi {

namespace internal {

// TupleTypeMatch* check whether a tuple type contains elements of the specified
// types. They are used to make sure the output parameters of UnpackMessage()
// match the corresponding message type.
template <class TupleType, class A>
struct TupleTypeMatch1 {};
TupleTypeMatch1<std::tuple<A>, A>;

template <class TupleType, class A, class B>
struct TupleTypeMatch2 {};
TupleTypeMatch2<std::tuple<A, B>, A, B>;

template <class TupleType, class A, class B, class C>
struct TupleTypeMatch3 {};
TupleTypeMatch3<std::tuple<A, B, C>, A, B, C>;

template <class TupleType, class A, class B, class C, class D>
struct TupleTypeMatch4 {};
TupleTypeMatch4<std::tuple<A, B, C, D>, A, B, C, D>;

template <class TupleType, class A, class B, class C, class D, class E>
struct TupleTypeMatch5 {};
TupleTypeMatch5<std::tuple<A, B, C, D, E>, A, B, C, D, E>;

}  // namespace internal

template <class MsgClass, class A>
bool UnpackMessage(const IPC::Message& msg, A* a) {}

template <class MsgClass, class A, class B>
bool UnpackMessage(const IPC::Message& msg, A* a, B* b) {}

template <class MsgClass, class A, class B, class C>
bool UnpackMessage(const IPC::Message& msg, A* a, B* b, C* c) {}

template <class MsgClass, class A, class B, class C, class D>
bool UnpackMessage(const IPC::Message& msg, A* a, B* b, C* c, D* d) {}

template <class MsgClass, class A, class B, class C, class D, class E>
bool UnpackMessage(const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e) {}

}  // namespace ppapi

#endif  // PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_