godot/core/variant/variant_internal.h

/**************************************************************************/
/*  variant_internal.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 VARIANT_INTERNAL_H
#define VARIANT_INTERNAL_H

#include "variant.h"

// For use when you want to access the internal pointer of a Variant directly.
// Use with caution. You need to be sure that the type is correct.

class RefCounted;

class VariantInternal {};

template <typename T>
struct VariantGetInternalPtr {};

template <>
struct VariantGetInternalPtr<bool> {};

template <>
struct VariantGetInternalPtr<int8_t> {};

template <>
struct VariantGetInternalPtr<uint8_t> {};

template <>
struct VariantGetInternalPtr<int16_t> {};

template <>
struct VariantGetInternalPtr<uint16_t> {};

template <>
struct VariantGetInternalPtr<int32_t> {};

template <>
struct VariantGetInternalPtr<uint32_t> {};

template <>
struct VariantGetInternalPtr<int64_t> {};

template <>
struct VariantGetInternalPtr<uint64_t> {};

template <>
struct VariantGetInternalPtr<char32_t> {};

template <>
struct VariantGetInternalPtr<ObjectID> {};

template <>
struct VariantGetInternalPtr<Error> {};

template <>
struct VariantGetInternalPtr<float> {};

template <>
struct VariantGetInternalPtr<double> {};

template <>
struct VariantGetInternalPtr<String> {};

template <>
struct VariantGetInternalPtr<Vector2> {};

template <>
struct VariantGetInternalPtr<Vector2i> {};

template <>
struct VariantGetInternalPtr<Rect2> {};

template <>
struct VariantGetInternalPtr<Rect2i> {};

template <>
struct VariantGetInternalPtr<Vector3> {};

template <>
struct VariantGetInternalPtr<Vector3i> {};

template <>
struct VariantGetInternalPtr<Vector4> {};

template <>
struct VariantGetInternalPtr<Vector4i> {};
template <>
struct VariantGetInternalPtr<Transform2D> {};

template <>
struct VariantGetInternalPtr<Transform3D> {};

template <>
struct VariantGetInternalPtr<Projection> {};

template <>
struct VariantGetInternalPtr<Plane> {};

template <>
struct VariantGetInternalPtr<Quaternion> {};

template <>
struct VariantGetInternalPtr<::AABB> {};

template <>
struct VariantGetInternalPtr<Basis> {};

//

template <>
struct VariantGetInternalPtr<Color> {};

template <>
struct VariantGetInternalPtr<StringName> {};

template <>
struct VariantGetInternalPtr<NodePath> {};

template <>
struct VariantGetInternalPtr<::RID> {};

template <>
struct VariantGetInternalPtr<Callable> {};

template <>
struct VariantGetInternalPtr<Signal> {};

template <>
struct VariantGetInternalPtr<Dictionary> {};

template <>
struct VariantGetInternalPtr<Array> {};

template <>
struct VariantGetInternalPtr<PackedByteArray> {};

template <>
struct VariantGetInternalPtr<PackedInt32Array> {};

template <>
struct VariantGetInternalPtr<PackedInt64Array> {};

template <>
struct VariantGetInternalPtr<PackedFloat32Array> {};

template <>
struct VariantGetInternalPtr<PackedFloat64Array> {};

template <>
struct VariantGetInternalPtr<PackedStringArray> {};

template <>
struct VariantGetInternalPtr<PackedVector2Array> {};

template <>
struct VariantGetInternalPtr<PackedVector3Array> {};

template <>
struct VariantGetInternalPtr<PackedColorArray> {};

template <>
struct VariantGetInternalPtr<PackedVector4Array> {};

template <typename T>
struct VariantInternalAccessor {};

template <>
struct VariantInternalAccessor<bool> {};

#define VARIANT_ACCESSOR_NUMBER(m_type)

VARIANT_ACCESSOR_NUMBER(int8_t)
VARIANT_ACCESSOR_NUMBER(uint8_t)
VARIANT_ACCESSOR_NUMBER(int16_t)
VARIANT_ACCESSOR_NUMBER(uint16_t)
VARIANT_ACCESSOR_NUMBER(int32_t)
VARIANT_ACCESSOR_NUMBER(uint32_t)
VARIANT_ACCESSOR_NUMBER(int64_t)
VARIANT_ACCESSOR_NUMBER(uint64_t)
VARIANT_ACCESSOR_NUMBER(char32_t)

template <>
struct VariantInternalAccessor<ObjectID> {};

VariantInternalAccessor<T *>;

VariantInternalAccessor<const T *>;

template <>
struct VariantInternalAccessor<IPAddress> {};

template <>
struct VariantInternalAccessor<float> {};

template <>
struct VariantInternalAccessor<double> {};

template <>
struct VariantInternalAccessor<String> {};

template <>
struct VariantInternalAccessor<Vector2> {};

template <>
struct VariantInternalAccessor<Vector2i> {};

template <>
struct VariantInternalAccessor<Rect2> {};

template <>
struct VariantInternalAccessor<Rect2i> {};

template <>
struct VariantInternalAccessor<Vector3> {};

template <>
struct VariantInternalAccessor<Vector3i> {};

template <>
struct VariantInternalAccessor<Vector4> {};

template <>
struct VariantInternalAccessor<Vector4i> {};
template <>
struct VariantInternalAccessor<Transform2D> {};

template <>
struct VariantInternalAccessor<Transform3D> {};

template <>
struct VariantInternalAccessor<Projection> {};

template <>
struct VariantInternalAccessor<Plane> {};

template <>
struct VariantInternalAccessor<Quaternion> {};

template <>
struct VariantInternalAccessor<AABB> {};

template <>
struct VariantInternalAccessor<Basis> {};

template <>
struct VariantInternalAccessor<Color> {};

template <>
struct VariantInternalAccessor<StringName> {};

template <>
struct VariantInternalAccessor<NodePath> {};

template <>
struct VariantInternalAccessor<::RID> {};

template <>
struct VariantInternalAccessor<Callable> {};

template <>
struct VariantInternalAccessor<Signal> {};

template <>
struct VariantInternalAccessor<Dictionary> {};

template <>
struct VariantInternalAccessor<Array> {};

template <>
struct VariantInternalAccessor<PackedByteArray> {};

template <>
struct VariantInternalAccessor<PackedInt32Array> {};

template <>
struct VariantInternalAccessor<PackedInt64Array> {};

template <>
struct VariantInternalAccessor<PackedFloat32Array> {};

template <>
struct VariantInternalAccessor<PackedFloat64Array> {};

template <>
struct VariantInternalAccessor<PackedStringArray> {};

template <>
struct VariantInternalAccessor<PackedVector2Array> {};

template <>
struct VariantInternalAccessor<PackedVector3Array> {};

template <>
struct VariantInternalAccessor<PackedColorArray> {};

template <>
struct VariantInternalAccessor<PackedVector4Array> {};

template <>
struct VariantInternalAccessor<Object *> {};

template <>
struct VariantInternalAccessor<Variant> {};

template <>
struct VariantInternalAccessor<Vector<Variant>> {};

template <typename T>
struct VariantInitializer {};

template <>
struct VariantInitializer<bool> {};

#define INITIALIZER_INT(m_type)

INITIALIZER_INT(uint8_t)
INITIALIZER_INT(int8_t)
INITIALIZER_INT(uint16_t)
INITIALIZER_INT(int16_t)
INITIALIZER_INT(uint32_t)
INITIALIZER_INT(int32_t)
INITIALIZER_INT(uint64_t)
INITIALIZER_INT(int64_t)
INITIALIZER_INT(char32_t)
INITIALIZER_INT(Error)
INITIALIZER_INT(ObjectID)
INITIALIZER_INT(Vector2::Axis)
INITIALIZER_INT(Vector2i::Axis)
INITIALIZER_INT(Vector3::Axis)
INITIALIZER_INT(Vector3i::Axis)
INITIALIZER_INT(Vector4::Axis)
INITIALIZER_INT(Vector4i::Axis)

template <>
struct VariantInitializer<double> {};

template <>
struct VariantInitializer<float> {};

template <>
struct VariantInitializer<String> {};

template <>
struct VariantInitializer<Vector2> {};

template <>
struct VariantInitializer<Vector2i> {};

template <>
struct VariantInitializer<Rect2> {};

template <>
struct VariantInitializer<Rect2i> {};

template <>
struct VariantInitializer<Vector3> {};

template <>
struct VariantInitializer<Vector3i> {};
template <>
struct VariantInitializer<Vector4> {};

template <>
struct VariantInitializer<Vector4i> {};
template <>
struct VariantInitializer<Transform2D> {};

template <>
struct VariantInitializer<Plane> {};

template <>
struct VariantInitializer<Quaternion> {};

template <>
struct VariantInitializer<AABB> {};

template <>
struct VariantInitializer<Basis> {};

template <>
struct VariantInitializer<Transform3D> {};
template <>
struct VariantInitializer<Projection> {};

template <>
struct VariantInitializer<Color> {};

template <>
struct VariantInitializer<StringName> {};

template <>
struct VariantInitializer<NodePath> {};

template <>
struct VariantInitializer<::RID> {};

template <>
struct VariantInitializer<Callable> {};

template <>
struct VariantInitializer<Signal> {};

template <>
struct VariantInitializer<Dictionary> {};

template <>
struct VariantInitializer<Array> {};

template <>
struct VariantInitializer<PackedByteArray> {};

template <>
struct VariantInitializer<PackedInt32Array> {};

template <>
struct VariantInitializer<PackedInt64Array> {};

template <>
struct VariantInitializer<PackedFloat32Array> {};

template <>
struct VariantInitializer<PackedFloat64Array> {};

template <>
struct VariantInitializer<PackedStringArray> {};

template <>
struct VariantInitializer<PackedVector2Array> {};

template <>
struct VariantInitializer<PackedVector3Array> {};

template <>
struct VariantInitializer<PackedColorArray> {};

template <>
struct VariantInitializer<PackedVector4Array> {};

template <>
struct VariantInitializer<Object *> {};

template <typename T>
struct VariantDefaultInitializer {};

template <>
struct VariantDefaultInitializer<bool> {};

template <>
struct VariantDefaultInitializer<int64_t> {};

template <>
struct VariantDefaultInitializer<double> {};

template <>
struct VariantDefaultInitializer<float> {};

template <>
struct VariantDefaultInitializer<String> {};

template <>
struct VariantDefaultInitializer<Vector2> {};

template <>
struct VariantDefaultInitializer<Vector2i> {};

template <>
struct VariantDefaultInitializer<Rect2> {};

template <>
struct VariantDefaultInitializer<Rect2i> {};

template <>
struct VariantDefaultInitializer<Vector3> {};

template <>
struct VariantDefaultInitializer<Vector3i> {};

template <>
struct VariantDefaultInitializer<Vector4> {};

template <>
struct VariantDefaultInitializer<Vector4i> {};

template <>
struct VariantDefaultInitializer<Transform2D> {};

template <>
struct VariantDefaultInitializer<Plane> {};

template <>
struct VariantDefaultInitializer<Quaternion> {};

template <>
struct VariantDefaultInitializer<AABB> {};

template <>
struct VariantDefaultInitializer<Basis> {};

template <>
struct VariantDefaultInitializer<Transform3D> {};

template <>
struct VariantDefaultInitializer<Projection> {};

template <>
struct VariantDefaultInitializer<Color> {};

template <>
struct VariantDefaultInitializer<StringName> {};

template <>
struct VariantDefaultInitializer<NodePath> {};

template <>
struct VariantDefaultInitializer<::RID> {};

template <>
struct VariantDefaultInitializer<Callable> {};

template <>
struct VariantDefaultInitializer<Signal> {};

template <>
struct VariantDefaultInitializer<Dictionary> {};

template <>
struct VariantDefaultInitializer<Array> {};

template <>
struct VariantDefaultInitializer<PackedByteArray> {};

template <>
struct VariantDefaultInitializer<PackedInt32Array> {};

template <>
struct VariantDefaultInitializer<PackedInt64Array> {};

template <>
struct VariantDefaultInitializer<PackedFloat32Array> {};

template <>
struct VariantDefaultInitializer<PackedFloat64Array> {};

template <>
struct VariantDefaultInitializer<PackedStringArray> {};

template <>
struct VariantDefaultInitializer<PackedVector2Array> {};

template <>
struct VariantDefaultInitializer<PackedVector3Array> {};

template <>
struct VariantDefaultInitializer<PackedColorArray> {};

template <>
struct VariantDefaultInitializer<PackedVector4Array> {};

template <typename T>
struct VariantTypeChanger {};

template <typename T>
struct VariantTypeAdjust {};

template <>
struct VariantTypeAdjust<Variant> {};

template <>
struct VariantTypeAdjust<Object *> {};

// GDExtension helpers.

template <typename T>
struct VariantTypeConstructor {};

#endif // VARIANT_INTERNAL_H