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.DBusAnnotationInfo;
26 
27 private import gio.c.functions;
28 public  import gio.c.types;
29 private import glib.Str;
30 private import glib.c.functions;
31 private import gobject.ObjectG;
32 public  import gtkc.giotypes;
33 private import gtkd.Loader;
34 
35 
36 /**
37  * Information about an annotation.
38  *
39  * Since: 2.26
40  */
41 public final class DBusAnnotationInfo
42 {
43 	/** the main Gtk struct */
44 	protected GDBusAnnotationInfo* gDBusAnnotationInfo;
45 	protected bool ownedRef;
46 
47 	/** Get the main Gtk struct */
48 	public GDBusAnnotationInfo* getDBusAnnotationInfoStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return gDBusAnnotationInfo;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected void* getStruct()
57 	{
58 		return cast(void*)gDBusAnnotationInfo;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GDBusAnnotationInfo* gDBusAnnotationInfo, bool ownedRef = false)
65 	{
66 		this.gDBusAnnotationInfo = gDBusAnnotationInfo;
67 		this.ownedRef = ownedRef;
68 	}
69 
70 	~this ()
71 	{
72 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
73 			g_dbus_annotation_info_unref(gDBusAnnotationInfo);
74 	}
75 
76 	/**
77 	 * Looks up the value of an annotation.
78 	 *
79 	 * The cost of this function is O(n) in number of annotations.
80 	 *
81 	 * Params:
82 	 *     annotations = A %NULL-terminated array of annotations or %NULL.
83 	 *     name = The name of the annotation to look up.
84 	 *
85 	 * Return: The value or %NULL if not found. Do not free, it is owned by @annotations.
86 	 *
87 	 * Since: 2.26
88 	 */
89 	public static string lookup(DBusAnnotationInfo[] annotations, string name)
90 	{
91 		GDBusAnnotationInfo*[] annotationsArray = new GDBusAnnotationInfo*[annotations.length+1];
92 		for ( int i = 0; i < annotations.length ; i++ )
93 		{
94 			annotationsArray[i] = annotations[i].getDBusAnnotationInfoStruct();
95 		}
96 		annotationsArray[$-1] = null;
97 
98 		return Str.toString(g_dbus_annotation_info_lookup(annotationsArray.ptr, Str.toStringz(name)));
99 	}
100 
101 	/**
102 	 */
103 
104 	/**
105 	 * The reference count or -1 if statically allocated.
106 	 */
107 	public @property int refCount()
108 	{
109 		return gDBusAnnotationInfo.refCount;
110 	}
111 
112 	/** Ditto */
113 	public @property void refCount(int value)
114 	{
115 		gDBusAnnotationInfo.refCount = value;
116 	}
117 
118 	/**
119 	 * The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".
120 	 */
121 	public @property string key()
122 	{
123 		return Str.toString(gDBusAnnotationInfo.key);
124 	}
125 
126 	/** Ditto */
127 	public @property void key(string value)
128 	{
129 		gDBusAnnotationInfo.key = Str.toStringz(value);
130 	}
131 
132 	/**
133 	 * The value of the annotation.
134 	 */
135 	public @property string value()
136 	{
137 		return Str.toString(gDBusAnnotationInfo.value);
138 	}
139 
140 	/** Ditto */
141 	public @property void value(string value)
142 	{
143 		gDBusAnnotationInfo.value = Str.toStringz(value);
144 	}
145 
146 	/**
147 	 * A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
148 	 */
149 	public @property DBusAnnotationInfo[] annotations()
150 	{
151 		DBusAnnotationInfo[] arr = new DBusAnnotationInfo[getArrayLength(gDBusAnnotationInfo.annotations)];
152 		for ( int i = 0; i < arr.length; i++ )
153 		{
154 			arr[i] = ObjectG.getDObject!(DBusAnnotationInfo)(gDBusAnnotationInfo.annotations[i], false);
155 		}
156 
157 		return arr;
158 	}
159 
160 	/** Ditto */
161 	public @property void annotations(DBusAnnotationInfo[] value)
162 	{
163 		GDBusAnnotationInfo*[] arr = new GDBusAnnotationInfo*[value.length+1];
164 		for ( int i = 0; i < value.length; i++ )
165 		{
166 			arr[i] = value[i].getDBusAnnotationInfoStruct();
167 		}
168 		arr[value.length] = null;
169 
170 		gDBusAnnotationInfo.annotations = arr.ptr;
171 	}
172 
173 	/** */
174 	public static GType getType()
175 	{
176 		return g_dbus_annotation_info_get_type();
177 	}
178 
179 	/**
180 	 * If @info is statically allocated does nothing. Otherwise increases
181 	 * the reference count.
182 	 *
183 	 * Returns: The same @info.
184 	 *
185 	 * Since: 2.26
186 	 */
187 	public DBusAnnotationInfo doref()
188 	{
189 		auto p = g_dbus_annotation_info_ref(gDBusAnnotationInfo);
190 
191 		if(p is null)
192 		{
193 			return null;
194 		}
195 
196 		return ObjectG.getDObject!(DBusAnnotationInfo)(cast(GDBusAnnotationInfo*) p, true);
197 	}
198 
199 	/**
200 	 * If @info is statically allocated, does nothing. Otherwise decreases
201 	 * the reference count of @info. When its reference count drops to 0,
202 	 * the memory used is freed.
203 	 *
204 	 * Since: 2.26
205 	 */
206 	public void unref()
207 	{
208 		g_dbus_annotation_info_unref(gDBusAnnotationInfo);
209 	}
210 }