godot/core/variant/variant_utility.cpp

/**************************************************************************/
/*  variant_utility.cpp                                                   */
/**************************************************************************/
/*                         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.                 */
/**************************************************************************/

#include "variant_utility.h"

#include "core/io/marshalls.h"
#include "core/object/ref_counted.h"
#include "core/os/os.h"
#include "core/templates/oa_hash_map.h"
#include "core/templates/rid.h"
#include "core/templates/rid_owner.h"
#include "core/variant/binder_common.h"
#include "core/variant/variant_parser.h"

// Math
double VariantUtilityFunctions::sin(double arg) {}

double VariantUtilityFunctions::cos(double arg) {}

double VariantUtilityFunctions::tan(double arg) {}

double VariantUtilityFunctions::sinh(double arg) {}

double VariantUtilityFunctions::cosh(double arg) {}

double VariantUtilityFunctions::tanh(double arg) {}

double VariantUtilityFunctions::asin(double arg) {}

double VariantUtilityFunctions::acos(double arg) {}

double VariantUtilityFunctions::atan(double arg) {}

double VariantUtilityFunctions::atan2(double y, double x) {}

double VariantUtilityFunctions::asinh(double arg) {}

double VariantUtilityFunctions::acosh(double arg) {}

double VariantUtilityFunctions::atanh(double arg) {}

double VariantUtilityFunctions::sqrt(double x) {}

double VariantUtilityFunctions::fmod(double b, double r) {}

double VariantUtilityFunctions::fposmod(double b, double r) {}

int64_t VariantUtilityFunctions::posmod(int64_t b, int64_t r) {}

Variant VariantUtilityFunctions::floor(const Variant &x, Callable::CallError &r_error) {}

double VariantUtilityFunctions::floorf(double x) {}

int64_t VariantUtilityFunctions::floori(double x) {}

Variant VariantUtilityFunctions::ceil(const Variant &x, Callable::CallError &r_error) {}

double VariantUtilityFunctions::ceilf(double x) {}

int64_t VariantUtilityFunctions::ceili(double x) {}

Variant VariantUtilityFunctions::round(const Variant &x, Callable::CallError &r_error) {}

double VariantUtilityFunctions::roundf(double x) {}

int64_t VariantUtilityFunctions::roundi(double x) {}

Variant VariantUtilityFunctions::abs(const Variant &x, Callable::CallError &r_error) {}

double VariantUtilityFunctions::absf(double x) {}

int64_t VariantUtilityFunctions::absi(int64_t x) {}

Variant VariantUtilityFunctions::sign(const Variant &x, Callable::CallError &r_error) {}

double VariantUtilityFunctions::signf(double x) {}

int64_t VariantUtilityFunctions::signi(int64_t x) {}

double VariantUtilityFunctions::pow(double x, double y) {}

double VariantUtilityFunctions::log(double x) {}

double VariantUtilityFunctions::exp(double x) {}

bool VariantUtilityFunctions::is_nan(double x) {}

bool VariantUtilityFunctions::is_inf(double x) {}

bool VariantUtilityFunctions::is_equal_approx(double x, double y) {}

bool VariantUtilityFunctions::is_zero_approx(double x) {}

bool VariantUtilityFunctions::is_finite(double x) {}

double VariantUtilityFunctions::ease(float x, float curve) {}

int VariantUtilityFunctions::step_decimals(float step) {}

Variant VariantUtilityFunctions::snapped(const Variant &x, const Variant &step, Callable::CallError &r_error) {}

double VariantUtilityFunctions::snappedf(double x, double step) {}

int64_t VariantUtilityFunctions::snappedi(double x, int64_t step) {}

Variant VariantUtilityFunctions::lerp(const Variant &from, const Variant &to, double weight, Callable::CallError &r_error) {}

double VariantUtilityFunctions::lerpf(double from, double to, double weight) {}

double VariantUtilityFunctions::cubic_interpolate(double from, double to, double pre, double post, double weight) {}

double VariantUtilityFunctions::cubic_interpolate_angle(double from, double to, double pre, double post, double weight) {}

double VariantUtilityFunctions::cubic_interpolate_in_time(double from, double to, double pre, double post, double weight,
		double to_t, double pre_t, double post_t) {}

double VariantUtilityFunctions::cubic_interpolate_angle_in_time(double from, double to, double pre, double post, double weight,
		double to_t, double pre_t, double post_t) {}

double VariantUtilityFunctions::bezier_interpolate(double p_start, double p_control_1, double p_control_2, double p_end, double p_t) {}

double VariantUtilityFunctions::bezier_derivative(double p_start, double p_control_1, double p_control_2, double p_end, double p_t) {}

double VariantUtilityFunctions::angle_difference(double from, double to) {}

double VariantUtilityFunctions::lerp_angle(double from, double to, double weight) {}

double VariantUtilityFunctions::inverse_lerp(double from, double to, double weight) {}

double VariantUtilityFunctions::remap(double value, double istart, double istop, double ostart, double ostop) {}

double VariantUtilityFunctions::smoothstep(double from, double to, double val) {}

double VariantUtilityFunctions::move_toward(double from, double to, double delta) {}

double VariantUtilityFunctions::rotate_toward(double from, double to, double delta) {}

double VariantUtilityFunctions::deg_to_rad(double angle_deg) {}

double VariantUtilityFunctions::rad_to_deg(double angle_rad) {}

double VariantUtilityFunctions::linear_to_db(double linear) {}

double VariantUtilityFunctions::db_to_linear(double db) {}

Variant VariantUtilityFunctions::wrap(const Variant &p_x, const Variant &p_min, const Variant &p_max, Callable::CallError &r_error) {}

int64_t VariantUtilityFunctions::wrapi(int64_t value, int64_t min, int64_t max) {}

double VariantUtilityFunctions::wrapf(double value, double min, double max) {}

double VariantUtilityFunctions::pingpong(double value, double length) {}

Variant VariantUtilityFunctions::max(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

double VariantUtilityFunctions::maxf(double x, double y) {}

int64_t VariantUtilityFunctions::maxi(int64_t x, int64_t y) {}

Variant VariantUtilityFunctions::min(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

double VariantUtilityFunctions::minf(double x, double y) {}

int64_t VariantUtilityFunctions::mini(int64_t x, int64_t y) {}

Variant VariantUtilityFunctions::clamp(const Variant &x, const Variant &min, const Variant &max, Callable::CallError &r_error) {}

double VariantUtilityFunctions::clampf(double x, double min, double max) {}

int64_t VariantUtilityFunctions::clampi(int64_t x, int64_t min, int64_t max) {}

int64_t VariantUtilityFunctions::nearest_po2(int64_t x) {}

// Random

void VariantUtilityFunctions::randomize() {}

int64_t VariantUtilityFunctions::randi() {}

double VariantUtilityFunctions::randf() {}

double VariantUtilityFunctions::randfn(double mean, double deviation) {}

int64_t VariantUtilityFunctions::randi_range(int64_t from, int64_t to) {}

double VariantUtilityFunctions::randf_range(double from, double to) {}

void VariantUtilityFunctions::seed(int64_t s) {}

PackedInt64Array VariantUtilityFunctions::rand_from_seed(int64_t seed) {}

// Utility

Variant VariantUtilityFunctions::weakref(const Variant &obj, Callable::CallError &r_error) {}

int64_t VariantUtilityFunctions::_typeof(const Variant &obj) {}

Variant VariantUtilityFunctions::type_convert(const Variant &p_variant, const Variant::Type p_type) {}

String VariantUtilityFunctions::str(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

String VariantUtilityFunctions::error_string(Error error) {}

String VariantUtilityFunctions::type_string(Variant::Type p_type) {}

void VariantUtilityFunctions::print(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::print_rich(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

#undef print_verbose

void VariantUtilityFunctions::print_verbose(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::printerr(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::printt(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::prints(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::printraw(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::push_error(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

void VariantUtilityFunctions::push_warning(const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {}

String VariantUtilityFunctions::var_to_str(const Variant &p_var) {}

Variant VariantUtilityFunctions::str_to_var(const String &p_var) {}

PackedByteArray VariantUtilityFunctions::var_to_bytes(const Variant &p_var) {}

PackedByteArray VariantUtilityFunctions::var_to_bytes_with_objects(const Variant &p_var) {}

Variant VariantUtilityFunctions::bytes_to_var(const PackedByteArray &p_arr) {}

Variant VariantUtilityFunctions::bytes_to_var_with_objects(const PackedByteArray &p_arr) {}

int64_t VariantUtilityFunctions::hash(const Variant &p_arr) {}

Object *VariantUtilityFunctions::instance_from_id(int64_t p_id) {}

bool VariantUtilityFunctions::is_instance_id_valid(int64_t p_id) {}

bool VariantUtilityFunctions::is_instance_valid(const Variant &p_instance) {}

uint64_t VariantUtilityFunctions::rid_allocate_id() {}

RID VariantUtilityFunctions::rid_from_int64(uint64_t p_base) {}

bool VariantUtilityFunctions::is_same(const Variant &p_a, const Variant &p_b) {}

#ifdef DEBUG_METHODS_ENABLED
#define VCALLR
#define VCALL
#else
#define VCALLR
#define VCALL
#endif

template <typename R, typename... P, size_t... Is>
static _FORCE_INLINE_ void call_helperpr(R (*p_func)(P...), Variant *ret, const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {}

template <typename R, typename... P, size_t... Is>
static _FORCE_INLINE_ void validated_call_helperpr(R (*p_func)(P...), Variant *ret, const Variant **p_args, IndexSequence<Is...>) {}

template <typename R, typename... P, size_t... Is>
static _FORCE_INLINE_ void ptr_call_helperpr(R (*p_func)(P...), void *ret, const void **p_args, IndexSequence<Is...>) {}

template <typename R, typename... P>
static _FORCE_INLINE_ void call_helperr(R (*p_func)(P...), Variant *ret, const Variant **p_args, Callable::CallError &r_error) {}

template <typename R, typename... P>
static _FORCE_INLINE_ void validated_call_helperr(R (*p_func)(P...), Variant *ret, const Variant **p_args) {}

template <typename R, typename... P>
static _FORCE_INLINE_ void ptr_call_helperr(R (*p_func)(P...), void *ret, const void **p_args) {}

template <typename R, typename... P>
static _FORCE_INLINE_ int get_arg_count_helperr(R (*p_func)(P...)) {}

template <typename R, typename... P>
static _FORCE_INLINE_ Variant::Type get_arg_type_helperr(R (*p_func)(P...), int p_arg) {}

template <typename R, typename... P>
static _FORCE_INLINE_ Variant::Type get_ret_type_helperr(R (*p_func)(P...)) {}

// WITHOUT RET

template <typename... P, size_t... Is>
static _FORCE_INLINE_ void call_helperp(void (*p_func)(P...), const Variant **p_args, Callable::CallError &r_error, IndexSequence<Is...>) {}

template <typename... P, size_t... Is>
static _FORCE_INLINE_ void validated_call_helperp(void (*p_func)(P...), const Variant **p_args, IndexSequence<Is...>) {}

template <typename... P, size_t... Is>
static _FORCE_INLINE_ void ptr_call_helperp(void (*p_func)(P...), const void **p_args, IndexSequence<Is...>) {}

template <typename... P>
static _FORCE_INLINE_ void call_helper(void (*p_func)(P...), const Variant **p_args, Callable::CallError &r_error) {}

template <typename... P>
static _FORCE_INLINE_ void validated_call_helper(void (*p_func)(P...), const Variant **p_args) {}

template <typename... P>
static _FORCE_INLINE_ void ptr_call_helper(void (*p_func)(P...), const void **p_args) {}

template <typename... P>
static _FORCE_INLINE_ int get_arg_count_helper(void (*p_func)(P...)) {}

template <typename... P>
static _FORCE_INLINE_ Variant::Type get_arg_type_helper(void (*p_func)(P...), int p_arg) {}

template <typename... P>
static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {}

#define FUNCBINDR(m_func, m_args, m_category)

#define FUNCBINDVR(m_func, m_args, m_category)

#define FUNCBINDVR2(m_func, m_args, m_category)

#define FUNCBINDVR3(m_func, m_args, m_category)

#define FUNCBINDVARARG(m_func, m_args, m_category)

#define FUNCBINDVARARGS(m_func, m_args, m_category)

#define FUNCBINDVARARGV(m_func, m_args, m_category)

#define FUNCBIND(m_func, m_args, m_category)

struct VariantUtilityFunctionInfo {};

static OAHashMap<StringName, VariantUtilityFunctionInfo> utility_function_table;
static List<StringName> utility_function_name_table;

template <typename T>
static void register_utility_function(const String &p_name, const Vector<String> &argnames) {}

void Variant::_register_variant_utility_functions() {}

void Variant::_unregister_variant_utility_functions() {}

void Variant::call_utility_function(const StringName &p_name, Variant *r_ret, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

bool Variant::has_utility_function(const StringName &p_name) {}

Variant::ValidatedUtilityFunction Variant::get_validated_utility_function(const StringName &p_name) {}

Variant::PTRUtilityFunction Variant::get_ptr_utility_function(const StringName &p_name) {}

Variant::UtilityFunctionType Variant::get_utility_function_type(const StringName &p_name) {}

MethodInfo Variant::get_utility_function_info(const StringName &p_name) {}

int Variant::get_utility_function_argument_count(const StringName &p_name) {}

Variant::Type Variant::get_utility_function_argument_type(const StringName &p_name, int p_arg) {}

String Variant::get_utility_function_argument_name(const StringName &p_name, int p_arg) {}

bool Variant::has_utility_function_return_value(const StringName &p_name) {}

Variant::Type Variant::get_utility_function_return_type(const StringName &p_name) {}

bool Variant::is_utility_function_vararg(const StringName &p_name) {}

uint32_t Variant::get_utility_function_hash(const StringName &p_name) {}

void Variant::get_utility_function_list(List<StringName> *r_functions) {}

int Variant::get_utility_function_count() {}