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.encodedobjectasid; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.reference; 24 /** 25 26 */ 27 @GodotBaseClass struct EncodedObjectAsID 28 { 29 enum string _GODOT_internal_name = "EncodedObjectAsID"; 30 public: 31 @nogc nothrow: 32 union { godot_object _godot_object; Reference _GODOT_base; } 33 alias _GODOT_base this; 34 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 35 package(godot) __gshared bool _classBindingInitialized = false; 36 package(godot) static struct _classBinding 37 { 38 __gshared: 39 @GodotName("set_object_id") GodotMethod!(void, long) setObjectId; 40 @GodotName("get_object_id") GodotMethod!(long) getObjectId; 41 } 42 bool opEquals(in EncodedObjectAsID other) const { return _godot_object.ptr is other._godot_object.ptr; } 43 EncodedObjectAsID opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 44 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 45 mixin baseCasts; 46 static EncodedObjectAsID _new() 47 { 48 static godot_class_constructor constructor; 49 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EncodedObjectAsID"); 50 if(constructor is null) return typeof(this).init; 51 return cast(EncodedObjectAsID)(constructor()); 52 } 53 @disable new(size_t s); 54 /** 55 56 */ 57 void setObjectId(in long id) 58 { 59 checkClassBinding!(typeof(this))(); 60 ptrcall!(void)(_classBinding.setObjectId, _godot_object, id); 61 } 62 /** 63 64 */ 65 long getObjectId() const 66 { 67 checkClassBinding!(typeof(this))(); 68 return ptrcall!(long)(_classBinding.getObjectId, _godot_object); 69 } 70 }