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.FileAttributeInfoList;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtkc.gio;
31 public  import gtkc.giotypes;
32 
33 
34 /**
35  * Acts as a lightweight registry for possible valid file attributes.
36  * The registry stores Key-Value pair formats as #GFileAttributeInfos.
37  */
38 public class FileAttributeInfoList
39 {
40 	/** the main Gtk struct */
41 	protected GFileAttributeInfoList* gFileAttributeInfoList;
42 	protected bool ownedRef;
43 
44 	/** Get the main Gtk struct */
45 	public GFileAttributeInfoList* getFileAttributeInfoListStruct()
46 	{
47 		return gFileAttributeInfoList;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected void* getStruct()
52 	{
53 		return cast(void*)gFileAttributeInfoList;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (GFileAttributeInfoList* gFileAttributeInfoList, bool ownedRef = false)
60 	{
61 		this.gFileAttributeInfoList = gFileAttributeInfoList;
62 		this.ownedRef = ownedRef;
63 	}
64 
65 
66 	/** */
67 	public static GType getType()
68 	{
69 		return g_file_attribute_info_list_get_type();
70 	}
71 
72 	/**
73 	 * Creates a new file attribute info list.
74 	 *
75 	 * Return: a #GFileAttributeInfoList.
76 	 *
77 	 * Throws: ConstructionException GTK+ fails to create the object.
78 	 */
79 	public this()
80 	{
81 		auto p = g_file_attribute_info_list_new();
82 		
83 		if(p is null)
84 		{
85 			throw new ConstructionException("null returned by new");
86 		}
87 		
88 		this(cast(GFileAttributeInfoList*) p);
89 	}
90 
91 	/**
92 	 * Adds a new attribute with @name to the @list, setting
93 	 * its @type and @flags.
94 	 *
95 	 * Params:
96 	 *     name = the name of the attribute to add.
97 	 *     type = the #GFileAttributeType for the attribute.
98 	 *     flags = #GFileAttributeInfoFlags for the attribute.
99 	 */
100 	public void add(string name, GFileAttributeType type, GFileAttributeInfoFlags flags)
101 	{
102 		g_file_attribute_info_list_add(gFileAttributeInfoList, Str.toStringz(name), type, flags);
103 	}
104 
105 	/**
106 	 * Makes a duplicate of a file attribute info list.
107 	 *
108 	 * Return: a copy of the given @list.
109 	 */
110 	public FileAttributeInfoList dup()
111 	{
112 		auto p = g_file_attribute_info_list_dup(gFileAttributeInfoList);
113 		
114 		if(p is null)
115 		{
116 			return null;
117 		}
118 		
119 		return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p, true);
120 	}
121 
122 	/**
123 	 * Gets the file attribute with the name @name from @list.
124 	 *
125 	 * Params:
126 	 *     name = the name of the attribute to lookup.
127 	 *
128 	 * Return: a #GFileAttributeInfo for the @name, or %NULL if an
129 	 *     attribute isn't found.
130 	 */
131 	public GFileAttributeInfo* lookup(string name)
132 	{
133 		return g_file_attribute_info_list_lookup(gFileAttributeInfoList, Str.toStringz(name));
134 	}
135 
136 	/**
137 	 * References a file attribute info list.
138 	 *
139 	 * Return: #GFileAttributeInfoList or %NULL on error.
140 	 */
141 	public FileAttributeInfoList doref()
142 	{
143 		auto p = g_file_attribute_info_list_ref(gFileAttributeInfoList);
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p, true);
151 	}
152 
153 	/**
154 	 * Removes a reference from the given @list. If the reference count
155 	 * falls to zero, the @list is deleted.
156 	 */
157 	public void unref()
158 	{
159 		g_file_attribute_info_list_unref(gFileAttributeInfoList);
160 	}
161 }