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.DBusArgInfo;
26 
27 private import gio.DBusAnnotationInfo;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import glib.MemorySlice;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 public  import gtkc.giotypes;
34 private import gtkd.Loader;
35 
36 
37 /**
38  * Information about an argument for a method or a signal.
39  *
40  * Since: 2.26
41  */
42 public final class DBusArgInfo
43 {
44 	/** the main Gtk struct */
45 	protected GDBusArgInfo* gDBusArgInfo;
46 	protected bool ownedRef;
47 
48 	/** Get the main Gtk struct */
49 	public GDBusArgInfo* getDBusArgInfoStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gDBusArgInfo;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected void* getStruct()
58 	{
59 		return cast(void*)gDBusArgInfo;
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GDBusArgInfo* gDBusArgInfo, bool ownedRef = false)
66 	{
67 		this.gDBusArgInfo = gDBusArgInfo;
68 		this.ownedRef = ownedRef;
69 	}
70 
71 	~this ()
72 	{
73 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
74 			g_dbus_arg_info_unref(gDBusArgInfo);
75 	}
76 
77 
78 	/**
79 	 * The reference count or -1 if statically allocated.
80 	 */
81 	public @property int refCount()
82 	{
83 		return gDBusArgInfo.refCount;
84 	}
85 
86 	/** Ditto */
87 	public @property void refCount(int value)
88 	{
89 		gDBusArgInfo.refCount = value;
90 	}
91 
92 	/**
93 	 * Name of the argument, e.g. @unix_user_id.
94 	 */
95 	public @property string name()
96 	{
97 		return Str.toString(gDBusArgInfo.name);
98 	}
99 
100 	/** Ditto */
101 	public @property void name(string value)
102 	{
103 		gDBusArgInfo.name = Str.toStringz(value);
104 	}
105 
106 	/**
107 	 * D-Bus signature of the argument (a single complete type).
108 	 */
109 	public @property string signature()
110 	{
111 		return Str.toString(gDBusArgInfo.signature);
112 	}
113 
114 	/** Ditto */
115 	public @property void signature(string value)
116 	{
117 		gDBusArgInfo.signature = Str.toStringz(value);
118 	}
119 
120 	/**
121 	 * A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
122 	 */
123 	public @property DBusAnnotationInfo[] annotations()
124 	{
125 		DBusAnnotationInfo[] arr = new DBusAnnotationInfo[getArrayLength(gDBusArgInfo.annotations)];
126 		for ( int i = 0; i < arr.length; i++ )
127 		{
128 			arr[i] = ObjectG.getDObject!(DBusAnnotationInfo)(gDBusArgInfo.annotations[i], false);
129 		}
130 
131 		return arr;
132 	}
133 
134 	/** Ditto */
135 	public @property void annotations(DBusAnnotationInfo[] value)
136 	{
137 		GDBusAnnotationInfo*[] arr = new GDBusAnnotationInfo*[value.length+1];
138 		for ( int i = 0; i < value.length; i++ )
139 		{
140 			arr[i] = value[i].getDBusAnnotationInfoStruct();
141 		}
142 		arr[value.length] = null;
143 
144 		gDBusArgInfo.annotations = arr.ptr;
145 	}
146 
147 	/** */
148 	public static GType getType()
149 	{
150 		return g_dbus_arg_info_get_type();
151 	}
152 
153 	alias doref = ref_;
154 	/**
155 	 * If @info is statically allocated does nothing. Otherwise increases
156 	 * the reference count.
157 	 *
158 	 * Returns: The same @info.
159 	 *
160 	 * Since: 2.26
161 	 */
162 	public DBusArgInfo ref_()
163 	{
164 		auto __p = g_dbus_arg_info_ref(gDBusArgInfo);
165 
166 		if(__p is null)
167 		{
168 			return null;
169 		}
170 
171 		return ObjectG.getDObject!(DBusArgInfo)(cast(GDBusArgInfo*) __p, true);
172 	}
173 
174 	/**
175 	 * If @info is statically allocated, does nothing. Otherwise decreases
176 	 * the reference count of @info. When its reference count drops to 0,
177 	 * the memory used is freed.
178 	 *
179 	 * Since: 2.26
180 	 */
181 	public void unref()
182 	{
183 		g_dbus_arg_info_unref(gDBusArgInfo);
184 	}
185 }