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