/**************************************************************************/ /* marshalls.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 "marshalls.h" #include "core/io/resource_loader.h" #include "core/object/ref_counted.h" #include "core/object/script_language.h" #include "core/os/keyboard.h" #include "core/string/print_string.h" #include <limits.h> #include <stdio.h> void EncodedObjectAsID::_bind_methods() { … } void EncodedObjectAsID::set_object_id(ObjectID p_id) { … } ObjectID EncodedObjectAsID::get_object_id() const { … } #define ERR_FAIL_ADD_OF(a, b, err) … #define ERR_FAIL_MUL_OF(a, b, err) … // Byte 0: `Variant::Type`, byte 1: unused, bytes 2 and 3: additional data. #define HEADER_TYPE_MASK … // For `Variant::INT`, `Variant::FLOAT` and other math types. #define HEADER_DATA_FLAG_64 … // For `Variant::OBJECT`. #define HEADER_DATA_FLAG_OBJECT_AS_ID … // For `Variant::ARRAY`. // Occupies bits 16 and 17. #define HEADER_DATA_FIELD_TYPED_ARRAY_MASK … #define HEADER_DATA_FIELD_TYPED_ARRAY_NONE … #define HEADER_DATA_FIELD_TYPED_ARRAY_BUILTIN … #define HEADER_DATA_FIELD_TYPED_ARRAY_CLASS_NAME … #define HEADER_DATA_FIELD_TYPED_ARRAY_SCRIPT … static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r_string) { … } Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects, int p_depth) { … } static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) { … } Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects, int p_depth) { … } Vector<float> vector3_to_float32_array(const Vector3 *vecs, size_t count) { … }