godot/core/variant/variant_op.h

/**************************************************************************/
/*  variant_op.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_OP_H
#define VARIANT_OP_H

#include "variant.h"

#include "core/debugger/engine_debugger.h"
#include "core/object/class_db.h"

template <typename R, typename A, typename B>
class OperatorEvaluatorAdd {};

template <typename R, typename A, typename B>
class OperatorEvaluatorSub {};

template <typename R, typename A, typename B>
class OperatorEvaluatorMul {};

template <typename R, typename A, typename B>
class OperatorEvaluatorPow {};

template <typename R, typename A, typename B>
class OperatorEvaluatorXForm {};

template <typename R, typename A, typename B>
class OperatorEvaluatorXFormInv {};

template <typename R, typename A, typename B>
class OperatorEvaluatorDiv {};

template <typename R, typename A, typename B>
class OperatorEvaluatorDivNZ {};

template <>
class OperatorEvaluatorDivNZ<Vector2i, Vector2i, Vector2i> {};

template <>
class OperatorEvaluatorDivNZ<Vector3i, Vector3i, Vector3i> {};

template <>
class OperatorEvaluatorDivNZ<Vector4i, Vector4i, Vector4i> {};

template <typename R, typename A, typename B>
class OperatorEvaluatorMod {};

template <typename R, typename A, typename B>
class OperatorEvaluatorModNZ {};

template <>
class OperatorEvaluatorModNZ<Vector2i, Vector2i, Vector2i> {};

template <>
class OperatorEvaluatorModNZ<Vector3i, Vector3i, Vector3i> {};

template <>
class OperatorEvaluatorModNZ<Vector4i, Vector4i, Vector4i> {};

template <typename R, typename A>
class OperatorEvaluatorNeg {};

template <typename R, typename A>
class OperatorEvaluatorPos {};

template <typename R, typename A, typename B>
class OperatorEvaluatorShiftLeft {};

template <typename R, typename A, typename B>
class OperatorEvaluatorShiftRight {};

template <typename R, typename A, typename B>
class OperatorEvaluatorBitOr {};

template <typename R, typename A, typename B>
class OperatorEvaluatorBitAnd {};

template <typename R, typename A, typename B>
class OperatorEvaluatorBitXor {};

template <typename R, typename A>
class OperatorEvaluatorBitNeg {};

template <typename A, typename B>
class OperatorEvaluatorEqual {};

class OperatorEvaluatorEqualObject {};

class OperatorEvaluatorEqualObjectNil {};

class OperatorEvaluatorEqualNilObject {};

template <typename A, typename B>
class OperatorEvaluatorNotEqual {};

class OperatorEvaluatorNotEqualObject {};

class OperatorEvaluatorNotEqualObjectNil {};

class OperatorEvaluatorNotEqualNilObject {};

template <typename A, typename B>
class OperatorEvaluatorLess {};

template <typename A, typename B>
class OperatorEvaluatorLessEqual {};

template <typename A, typename B>
class OperatorEvaluatorGreater {};

template <typename A, typename B>
class OperatorEvaluatorGreaterEqual {};

template <typename A, typename B>
class OperatorEvaluatorAnd {};

template <typename A, typename B>
class OperatorEvaluatorOr {};

#define XOR_OP(m_a, m_b)
template <typename A, typename B>
class OperatorEvaluatorXor {};

template <typename A>
class OperatorEvaluatorNot {};

//// CUSTOM ////

class OperatorEvaluatorAddArray {};

template <typename T>
class OperatorEvaluatorAppendArray {};

template <typename Left, typename Right>
class OperatorEvaluatorStringConcat {};

template <typename S, typename T>
class OperatorEvaluatorStringFormat;

OperatorEvaluatorStringFormat<S, void>;

OperatorEvaluatorStringFormat<S, Array>;

OperatorEvaluatorStringFormat<S, Object>;

template <typename S, typename T>
class OperatorEvaluatorStringFormat {};

template <Variant::Operator op, Variant::Type type_left, Variant::Type type_right>
class OperatorEvaluatorAlwaysTrue {};

template <Variant::Operator op, Variant::Type type_left, Variant::Type type_right>
class OperatorEvaluatorAlwaysFalse {};

///// OR ///////

_FORCE_INLINE_ static bool _operate_or(bool p_left, bool p_right) {}

_FORCE_INLINE_ static bool _operate_and(bool p_left, bool p_right) {}

_FORCE_INLINE_ static bool _operate_xor(bool p_left, bool p_right) {}

_FORCE_INLINE_ static bool _operate_get_nil(const Variant *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_bool(const Variant *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_int(const Variant *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_float(const Variant *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_object(const Variant *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_ptr_nil(const void *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_ptr_bool(const void *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_ptr_int(const void *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_ptr_float(const void *p_ptr) {}

_FORCE_INLINE_ static bool _operate_get_ptr_object(const void *p_ptr) {}

#define OP_EVALUATOR(m_class_name, m_left, m_right, m_op)

// OR

// nil
OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// bool
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// int
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// float
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// object
OP_EVALUATOR()

// AND

// nil
OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// bool
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// int
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// float
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// object
OP_EVALUATOR()

// XOR

// nil
OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// bool
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// int
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// float
OP_EVALUATOR()

OP_EVALUATOR()
OP_EVALUATOR()

// object
OP_EVALUATOR()

class OperatorEvaluatorNotBool {};

class OperatorEvaluatorNotInt {};

class OperatorEvaluatorNotFloat {};

class OperatorEvaluatorNotObject {};

////

template <typename Left, typename Right>
class OperatorEvaluatorInStringFind;

OperatorEvaluatorInStringFind<Left, String>;

OperatorEvaluatorInStringFind<Left, StringName>;

template <typename A, typename B>
class OperatorEvaluatorInArrayFind {};

class OperatorEvaluatorInArrayFindNil {};

class OperatorEvaluatorInArrayFindObject {};

template <typename A>
class OperatorEvaluatorInDictionaryHas {};

class OperatorEvaluatorInDictionaryHasNil {};

class OperatorEvaluatorInDictionaryHasObject {};

class OperatorEvaluatorObjectHasPropertyString {};

class OperatorEvaluatorObjectHasPropertyStringName {};

#endif // VARIANT_OP_H