1 /** 2 Gets a constant from a given class. 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.visualscriptclassconstant; 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.visualscriptnode; 25 /** 26 Gets a constant from a given class. 27 28 This node returns a constant from a given class, such as $(D constant TYPE_INT). See the given class' documentation for available constants. 29 $(B Input Ports:) 30 none 31 $(B Output Ports:) 32 - Data (variant): `value` 33 */ 34 @GodotBaseClass struct VisualScriptClassConstant 35 { 36 package(godot) enum string _GODOT_internal_name = "VisualScriptClassConstant"; 37 public: 38 @nogc nothrow: 39 union { /** */ godot_object _godot_object; /** */ VisualScriptNode _GODOT_base; } 40 alias _GODOT_base this; 41 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 42 package(godot) __gshared bool _classBindingInitialized = false; 43 package(godot) static struct GDNativeClassBinding 44 { 45 __gshared: 46 @GodotName("get_base_type") GodotMethod!(String) getBaseType; 47 @GodotName("get_class_constant") GodotMethod!(String) getClassConstant; 48 @GodotName("set_base_type") GodotMethod!(void, String) setBaseType; 49 @GodotName("set_class_constant") GodotMethod!(void, String) setClassConstant; 50 } 51 /// 52 pragma(inline, true) bool opEquals(in VisualScriptClassConstant other) const 53 { return _godot_object.ptr is other._godot_object.ptr; } 54 /// 55 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 56 { _godot_object.ptr = n; return null; } 57 /// 58 pragma(inline, true) bool opEquals(typeof(null) n) const 59 { return _godot_object.ptr is n; } 60 /// 61 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 62 mixin baseCasts; 63 /// Construct a new instance of VisualScriptClassConstant. 64 /// Note: use `memnew!VisualScriptClassConstant` instead. 65 static VisualScriptClassConstant _new() 66 { 67 static godot_class_constructor constructor; 68 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptClassConstant"); 69 if(constructor is null) return typeof(this).init; 70 return cast(VisualScriptClassConstant)(constructor()); 71 } 72 @disable new(size_t s); 73 /** 74 75 */ 76 String getBaseType() 77 { 78 checkClassBinding!(typeof(this))(); 79 return ptrcall!(String)(GDNativeClassBinding.getBaseType, _godot_object); 80 } 81 /** 82 83 */ 84 String getClassConstant() 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(String)(GDNativeClassBinding.getClassConstant, _godot_object); 88 } 89 /** 90 91 */ 92 void setBaseType(in String name) 93 { 94 checkClassBinding!(typeof(this))(); 95 ptrcall!(void)(GDNativeClassBinding.setBaseType, _godot_object, name); 96 } 97 /** 98 99 */ 100 void setClassConstant(in String name) 101 { 102 checkClassBinding!(typeof(this))(); 103 ptrcall!(void)(GDNativeClassBinding.setClassConstant, _godot_object, name); 104 } 105 /** 106 The constant's parent class. 107 */ 108 @property String baseType() 109 { 110 return getBaseType(); 111 } 112 /// ditto 113 @property void baseType(String v) 114 { 115 setBaseType(v); 116 } 117 /** 118 The constant to return. See the given class for its available constants. 119 */ 120 @property String constant() 121 { 122 return getClassConstant(); 123 } 124 /// ditto 125 @property void constant(String v) 126 { 127 setClassConstant(v); 128 } 129 }