1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DBusMethodInfo;
26 
27 private import gio.DBusAnnotationInfo;
28 private import gio.DBusArgInfo;
29 private import gio.c.functions;
30 public  import gio.c.types;
31 private import glib.MemorySlice;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 public  import gtkc.giotypes;
35 private import gtkd.Loader;
36 
37 
38 /**
39  * Information about a method on an D-Bus interface.
40  *
41  * Since: 2.26
42  */
43 public final class DBusMethodInfo
44 {
45 	/** the main Gtk struct */
46 	protected GDBusMethodInfo* gDBusMethodInfo;
47 	protected bool ownedRef;
48 
49 	/** Get the main Gtk struct */
50 	public GDBusMethodInfo* getDBusMethodInfoStruct(bool transferOwnership = false)
51 	{
52 		if (transferOwnership)
53 			ownedRef = false;
54 		return gDBusMethodInfo;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected void* getStruct()
59 	{
60 		return cast(void*)gDBusMethodInfo;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GDBusMethodInfo* gDBusMethodInfo, bool ownedRef = false)
67 	{
68 		this.gDBusMethodInfo = gDBusMethodInfo;
69 		this.ownedRef = ownedRef;
70 	}
71 
72 	~this ()
73 	{
74 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
75 			g_dbus_method_info_unref(gDBusMethodInfo);
76 	}
77 
78 
79 	/**
80 	 * The reference count or -1 if statically allocated.
81 	 */
82 	public @property int refCount()
83 	{
84 		return gDBusMethodInfo.refCount;
85 	}
86 
87 	/** Ditto */
88 	public @property void refCount(int value)
89 	{
90 		gDBusMethodInfo.refCount = value;
91 	}
92 
93 	/**
94 	 * The name of the D-Bus method, e.g. @RequestName.
95 	 */
96 	public @property string name()
97 	{
98 		return Str.toString(gDBusMethodInfo.name);
99 	}
100 
101 	/** Ditto */
102 	public @property void name(string value)
103 	{
104 		gDBusMethodInfo.name = Str.toStringz(value);
105 	}
106 
107 	/**
108 	 * A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no in arguments.
109 	 */
110 	public @property DBusArgInfo[] inArgs()
111 	{
112 		DBusArgInfo[] arr = new DBusArgInfo[getArrayLength(gDBusMethodInfo.inArgs)];
113 		for ( int i = 0; i < arr.length; i++ )
114 		{
115 			arr[i] = ObjectG.getDObject!(DBusArgInfo)(gDBusMethodInfo.inArgs[i], false);
116 		}
117 
118 		return arr;
119 	}
120 
121 	/** Ditto */
122 	public @property void inArgs(DBusArgInfo[] value)
123 	{
124 		GDBusArgInfo*[] arr = new GDBusArgInfo*[value.length+1];
125 		for ( int i = 0; i < value.length; i++ )
126 		{
127 			arr[i] = value[i].getDBusArgInfoStruct();
128 		}
129 		arr[value.length] = null;
130 
131 		gDBusMethodInfo.inArgs = arr.ptr;
132 	}
133 
134 	/**
135 	 * A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no out arguments.
136 	 */
137 	public @property DBusArgInfo[] outArgs()
138 	{
139 		DBusArgInfo[] arr = new DBusArgInfo[getArrayLength(gDBusMethodInfo.outArgs)];
140 		for ( int i = 0; i < arr.length; i++ )
141 		{
142 			arr[i] = ObjectG.getDObject!(DBusArgInfo)(gDBusMethodInfo.outArgs[i], false);
143 		}
144 
145 		return arr;
146 	}
147 
148 	/** Ditto */
149 	public @property void outArgs(DBusArgInfo[] value)
150 	{
151 		GDBusArgInfo*[] arr = new GDBusArgInfo*[value.length+1];
152 		for ( int i = 0; i < value.length; i++ )
153 		{
154 			arr[i] = value[i].getDBusArgInfoStruct();
155 		}
156 		arr[value.length] = null;
157 
158 		gDBusMethodInfo.outArgs = arr.ptr;
159 	}
160 
161 	/**
162 	 * A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
163 	 */
164 	public @property DBusAnnotationInfo[] annotations()
165 	{
166 		DBusAnnotationInfo[] arr = new DBusAnnotationInfo[getArrayLength(gDBusMethodInfo.annotations)];
167 		for ( int i = 0; i < arr.length; i++ )
168 		{
169 			arr[i] = ObjectG.getDObject!(DBusAnnotationInfo)(gDBusMethodInfo.annotations[i], false);
170 		}
171 
172 		return arr;
173 	}
174 
175 	/** Ditto */
176 	public @property void annotations(DBusAnnotationInfo[] value)
177 	{
178 		GDBusAnnotationInfo*[] arr = new GDBusAnnotationInfo*[value.length+1];
179 		for ( int i = 0; i < value.length; i++ )
180 		{
181 			arr[i] = value[i].getDBusAnnotationInfoStruct();
182 		}
183 		arr[value.length] = null;
184 
185 		gDBusMethodInfo.annotations = arr.ptr;
186 	}
187 
188 	/** */
189 	public static GType getType()
190 	{
191 		return g_dbus_method_info_get_type();
192 	}
193 
194 	alias doref = ref_;
195 	/**
196 	 * If @info is statically allocated does nothing. Otherwise increases
197 	 * the reference count.
198 	 *
199 	 * Returns: The same @info.
200 	 *
201 	 * Since: 2.26
202 	 */
203 	public DBusMethodInfo ref_()
204 	{
205 		auto __p = g_dbus_method_info_ref(gDBusMethodInfo);
206 
207 		if(__p is null)
208 		{
209 			return null;
210 		}
211 
212 		return ObjectG.getDObject!(DBusMethodInfo)(cast(GDBusMethodInfo*) __p, true);
213 	}
214 
215 	/**
216 	 * If @info is statically allocated, does nothing. Otherwise decreases
217 	 * the reference count of @info. When its reference count drops to 0,
218 	 * the memory used is freed.
219 	 *
220 	 * Since: 2.26
221 	 */
222 	public void unref()
223 	{
224 		g_dbus_method_info_unref(gDBusMethodInfo);
225 	}
226 }