1 /**
2 Exits a function and returns an optional value.
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.visualscriptreturn;
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 import godot.resource;
26 import godot.reference;
27 /**
28 Exits a function and returns an optional value.
29 
30 Ends the execution of a function and returns control to the calling function. Optionally, it can return a $(D Variant) value.
31 $(B Input Ports:)
32 - Sequence
33 - Data (variant): `result` (optional)
34 $(B Output Ports:)
35 none
36 */
37 @GodotBaseClass struct VisualScriptReturn
38 {
39 	package(godot) enum string _GODOT_internal_name = "VisualScriptReturn";
40 public:
41 @nogc nothrow:
42 	union { /** */ godot_object _godot_object; /** */ VisualScriptNode _GODOT_base; }
43 	alias _GODOT_base this;
44 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
45 	package(godot) __gshared bool _classBindingInitialized = false;
46 	package(godot) static struct GDNativeClassBinding
47 	{
48 		__gshared:
49 		@GodotName("get_return_type") GodotMethod!(Variant.Type) getReturnType;
50 		@GodotName("is_return_value_enabled") GodotMethod!(bool) isReturnValueEnabled;
51 		@GodotName("set_enable_return_value") GodotMethod!(void, bool) setEnableReturnValue;
52 		@GodotName("set_return_type") GodotMethod!(void, long) setReturnType;
53 	}
54 	/// 
55 	pragma(inline, true) bool opEquals(in VisualScriptReturn other) const
56 	{ return _godot_object.ptr is other._godot_object.ptr; }
57 	/// 
58 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
59 	{ _godot_object.ptr = n; return null; }
60 	/// 
61 	pragma(inline, true) bool opEquals(typeof(null) n) const
62 	{ return _godot_object.ptr is n; }
63 	/// 
64 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
65 	mixin baseCasts;
66 	/// Construct a new instance of VisualScriptReturn.
67 	/// Note: use `memnew!VisualScriptReturn` instead.
68 	static VisualScriptReturn _new()
69 	{
70 		static godot_class_constructor constructor;
71 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptReturn");
72 		if(constructor is null) return typeof(this).init;
73 		return cast(VisualScriptReturn)(constructor());
74 	}
75 	@disable new(size_t s);
76 	/**
77 	
78 	*/
79 	Variant.Type getReturnType() const
80 	{
81 		checkClassBinding!(typeof(this))();
82 		return ptrcall!(Variant.Type)(GDNativeClassBinding.getReturnType, _godot_object);
83 	}
84 	/**
85 	
86 	*/
87 	bool isReturnValueEnabled() const
88 	{
89 		checkClassBinding!(typeof(this))();
90 		return ptrcall!(bool)(GDNativeClassBinding.isReturnValueEnabled, _godot_object);
91 	}
92 	/**
93 	
94 	*/
95 	void setEnableReturnValue(in bool enable)
96 	{
97 		checkClassBinding!(typeof(this))();
98 		ptrcall!(void)(GDNativeClassBinding.setEnableReturnValue, _godot_object, enable);
99 	}
100 	/**
101 	
102 	*/
103 	void setReturnType(in long type)
104 	{
105 		checkClassBinding!(typeof(this))();
106 		ptrcall!(void)(GDNativeClassBinding.setReturnType, _godot_object, type);
107 	}
108 	/**
109 	If `true`, the `return` input port is available.
110 	*/
111 	@property bool returnEnabled()
112 	{
113 		return isReturnValueEnabled();
114 	}
115 	/// ditto
116 	@property void returnEnabled(bool v)
117 	{
118 		setEnableReturnValue(v);
119 	}
120 	/**
121 	The return value's data type.
122 	*/
123 	@property Variant.Type returnType()
124 	{
125 		return getReturnType();
126 	}
127 	/// ditto
128 	@property void returnType(long v)
129 	{
130 		setReturnType(v);
131 	}
132 }