mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Core: Consolidate typed container logic
This commit is contained in:
parent
1e9d0ff925
commit
7390c358f5
6 changed files with 117 additions and 451 deletions
|
|
@ -590,6 +590,18 @@ struct VariantInternalAccessor<IPAddress> {
|
|||
static _FORCE_INLINE_ void set(Variant *v, IPAddress p_value) { *VariantInternal::get_string(v) = String(p_value); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VariantInternalAccessor<TypedArray<T>> {
|
||||
static _FORCE_INLINE_ TypedArray<T> get(const Variant *v) { return TypedArray<T>(*VariantInternal::get_array(v)); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const TypedArray<T> &p_array) { *VariantInternal::get_array(v) = Array(p_array); }
|
||||
};
|
||||
|
||||
template <typename K, typename V>
|
||||
struct VariantInternalAccessor<TypedDictionary<K, V>> {
|
||||
static _FORCE_INLINE_ TypedDictionary<K, V> get(const Variant *v) { return TypedDictionary<K, V>(*VariantInternal::get_dictionary(v)); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const TypedDictionary<K, V> &p_dictionary) { *VariantInternal::get_dictionary(v) = Dictionary(p_dictionary); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VariantInternalAccessor<Object *> {
|
||||
static _FORCE_INLINE_ Object *get(const Variant *v) { return const_cast<Object *>(*VariantInternal::get_object(v)); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue