godot/core/variant/method_ptrcall.h

/**************************************************************************/
/*  method_ptrcall.h                                                      */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#ifndef METHOD_PTRCALL_H
#define METHOD_PTRCALL_H

#include "core/object/object_id.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"

template <typename T>
struct PtrToArg {};

#define MAKE_PTRARG(m_type)

#define MAKE_PTRARGCONV(m_type, m_conv)

#define MAKE_PTRARG_BY_REFERENCE(m_type)

MAKE_PTRARGCONV(bool, uint8_t);
// Integer types.
MAKE_PTRARGCONV();
MAKE_PTRARGCONV();
MAKE_PTRARGCONV();
MAKE_PTRARGCONV();
MAKE_PTRARGCONV();
MAKE_PTRARGCONV();
MAKE_PTRARG();
MAKE_PTRARG();
// Float types
MAKE_PTRARGCONV();
MAKE_PTRARG();

MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG_BY_REFERENCE();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
// Object doesn't need this.
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG();
MAKE_PTRARG_BY_REFERENCE();

// This is for Object.

PtrToArg<T *>;

PtrToArg<const T *>;

// This is for ObjectID.

template <>
struct PtrToArg<ObjectID> {};

// This is for the special cases used by Variant.

// No EncodeT because direct pointer conversion not possible.
#define MAKE_VECARG(m_type)

// No EncodeT because direct pointer conversion not possible.
#define MAKE_VECARG_ALT(m_type, m_type_alt)

MAKE_VECARG_ALT();

// For stuff that gets converted to Array vectors.

// No EncodeT because direct pointer conversion not possible.
#define MAKE_VECARR(m_type)

MAKE_VECARR();
MAKE_VECARR();
MAKE_VECARR();

// No EncodeT because direct pointer conversion not possible.
#define MAKE_DVECARR(m_type)

// Special case for IPAddress.

// No EncodeT because direct pointer conversion not possible.
#define MAKE_STRINGCONV_BY_REFERENCE(m_type)

MAKE_STRINGCONV_BY_REFERENCE(IPAddress);

// No EncodeT because direct pointer conversion not possible.
template <>
struct PtrToArg<Vector<Face3>> {};

// No EncodeT because direct pointer conversion not possible.
template <>
struct PtrToArg<const Vector<Face3> &> {};

#endif // METHOD_PTRCALL_H