1 /** 2 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.packeddatacontainer; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.resource; 25 /** 26 27 */ 28 @GodotBaseClass struct PackedDataContainer 29 { 30 package(godot) enum string _GODOT_internal_name = "PackedDataContainer"; 31 public: 32 @nogc nothrow: 33 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct GDNativeClassBinding 38 { 39 __gshared: 40 @GodotName("_get_data") GodotMethod!(PoolByteArray) _getData; 41 @GodotName("_iter_get") GodotMethod!(Variant, Variant) _iterGet; 42 @GodotName("_iter_init") GodotMethod!(Variant, Array) _iterInit; 43 @GodotName("_iter_next") GodotMethod!(Variant, Array) _iterNext; 44 @GodotName("_set_data") GodotMethod!(void, PoolByteArray) _setData; 45 @GodotName("pack") GodotMethod!(GodotError, Variant) pack; 46 @GodotName("size") GodotMethod!(long) size; 47 } 48 /// 49 pragma(inline, true) bool opEquals(in PackedDataContainer other) const 50 { return _godot_object.ptr is other._godot_object.ptr; } 51 /// 52 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 53 { _godot_object.ptr = n; return null; } 54 /// 55 pragma(inline, true) bool opEquals(typeof(null) n) const 56 { return _godot_object.ptr is n; } 57 /// 58 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 59 mixin baseCasts; 60 /// Construct a new instance of PackedDataContainer. 61 /// Note: use `memnew!PackedDataContainer` instead. 62 static PackedDataContainer _new() 63 { 64 static godot_class_constructor constructor; 65 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PackedDataContainer"); 66 if(constructor is null) return typeof(this).init; 67 return cast(PackedDataContainer)(constructor()); 68 } 69 @disable new(size_t s); 70 /** 71 72 */ 73 PoolByteArray _getData() const 74 { 75 Array _GODOT_args = Array.make(); 76 String _GODOT_method_name = String("_get_data"); 77 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!PoolByteArray); 78 } 79 /** 80 81 */ 82 Variant _iterGet(VariantArg0)(in VariantArg0 arg0) 83 { 84 Array _GODOT_args = Array.make(); 85 _GODOT_args.append(arg0); 86 String _GODOT_method_name = String("_iter_get"); 87 return this.callv(_GODOT_method_name, _GODOT_args); 88 } 89 /** 90 91 */ 92 Variant _iterInit(in Array arg0) 93 { 94 Array _GODOT_args = Array.make(); 95 _GODOT_args.append(arg0); 96 String _GODOT_method_name = String("_iter_init"); 97 return this.callv(_GODOT_method_name, _GODOT_args); 98 } 99 /** 100 101 */ 102 Variant _iterNext(in Array arg0) 103 { 104 Array _GODOT_args = Array.make(); 105 _GODOT_args.append(arg0); 106 String _GODOT_method_name = String("_iter_next"); 107 return this.callv(_GODOT_method_name, _GODOT_args); 108 } 109 /** 110 111 */ 112 void _setData(in PoolByteArray arg0) 113 { 114 Array _GODOT_args = Array.make(); 115 _GODOT_args.append(arg0); 116 String _GODOT_method_name = String("_set_data"); 117 this.callv(_GODOT_method_name, _GODOT_args); 118 } 119 /** 120 121 */ 122 GodotError pack(VariantArg0)(in VariantArg0 value) 123 { 124 checkClassBinding!(typeof(this))(); 125 return ptrcall!(GodotError)(GDNativeClassBinding.pack, _godot_object, value); 126 } 127 /** 128 129 */ 130 long size() const 131 { 132 checkClassBinding!(typeof(this))(); 133 return ptrcall!(long)(GDNativeClassBinding.size, _godot_object); 134 } 135 /** 136 137 */ 138 @property PoolByteArray _Data() 139 { 140 return _getData(); 141 } 142 /// ditto 143 @property void _Data(PoolByteArray v) 144 { 145 _setData(v); 146 } 147 }