root/trunk/src/gio/FileAttributeMatcher.d

Revision 938, 7.4 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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  * Conversion parameters:
26  * inFile  =
27  * outPack = gio
28  * outFile = FileAttributeMatcher
29  * strct   = GFileAttributeMatcher
30  * realStrct=
31  * ctorStrct=
32  * clss    = FileAttributeMatcher
33  * interf  =
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_file_attribute_matcher_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  *  - glib.Str
47  * structWrap:
48  *  - GFileAttributeMatcher* -> FileAttributeMatcher
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53
54 module gio.FileAttributeMatcher;
55
56 public  import gtkc.giotypes;
57
58 private import gtkc.gio;
59 private import glib.ConstructionException;
60
61
62 private import glib.Str;
63
64
65
66 private import gobject.Boxed;
67
68 /**
69  * Description
70  * Functionality for manipulating basic metadata for files. GFileInfo
71  * implements methods for getting information that all files should
72  * contain, and allows for manipulation of extended attributes.
73  * See GFileAttribute for more
74  * information on how GIO handles file attributes.
75  * To obtain a GFileInfo for a GFile, use g_file_query_info() (or its
76  * async variant). To obtain a GFileInfo for a file input or output
77  * stream, use g_file_input_stream_query_info() or
78  * g_file_output_stream_query_info() (or their async variants).
79  * To change the actual attributes of a file, you should then set the
80  * attribute in the GFileInfo and call g_file_set_attributes_from_info()
81  * or g_file_set_attributes_async() on a GFile.
82  * However, not all attributes can be changed in the file. For instance,
83  * the actual size of a file cannot be changed via g_file_info_set_size().
84  * You may call g_file_query_settable_attributes() and
85  * g_file_query_writable_namespaces() to discover the settable attributes
86  * of a particular file at runtime.
87  * GFileAttributeMatcher allows for searching through a GFileInfo for
88  * attributes.
89  */
90 public class FileAttributeMatcher : Boxed
91 {
92    
93     /** the main Gtk struct */
94     protected GFileAttributeMatcher* gFileAttributeMatcher;
95    
96    
97     public GFileAttributeMatcher* getFileAttributeMatcherStruct()
98     {
99         return gFileAttributeMatcher;
100     }
101    
102    
103     /** the main Gtk struct as a void* */
104     protected void* getStruct()
105     {
106         return cast(void*)gFileAttributeMatcher;
107     }
108    
109     /**
110      * Sets our main struct and passes it to the parent class
111      */
112     public this (GFileAttributeMatcher* gFileAttributeMatcher)
113     {
114         if(gFileAttributeMatcher is null)
115         {
116             this = null;
117             return;
118         }
119         this.gFileAttributeMatcher = gFileAttributeMatcher;
120     }
121    
122     /**
123      */
124    
125     /**
126      * Creates a new file attribute matcher, which matches attributes
127      * against a given string. GFileAttributeMatchers are reference
128      * counted structures, and are created with a reference count of 1. If
129      * the number of references falls to 0, the GFileAttributeMatcher is
130      * automatically destroyed.
131      * The attribute string should be formatted with specific keys separated
132      * from namespaces with a double colon. Several "namespace::key" strings may be
133      * concatenated with a single comma (e.g. "standard::type,standard::is-hidden").
134      * The wildcard "*" may be used to match all keys and namespaces, or
135      * "namespace::*" will match all keys in a given namespace.
136      * Params:
137      * attributes = an attribute string to match.
138      * Throws: ConstructionException GTK+ fails to create the object.
139      */
140     public this (string attributes)
141     {
142         // GFileAttributeMatcher * g_file_attribute_matcher_new (const char *attributes);
143         auto p = g_file_attribute_matcher_new(Str.toStringz(attributes));
144         if(p is null)
145         {
146             throw new ConstructionException("null returned by g_file_attribute_matcher_new(Str.toStringz(attributes))");
147         }
148         this(cast(GFileAttributeMatcher*) p);
149     }
150    
151     /**
152      * References a file attribute matcher.
153      * Returns: a GFileAttributeMatcher.
154      */
155     public FileAttributeMatcher doref()
156     {
157         // GFileAttributeMatcher * g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher);
158         auto p = g_file_attribute_matcher_ref(gFileAttributeMatcher);
159         if(p is null)
160         {
161             return null;
162         }
163         return new FileAttributeMatcher(cast(GFileAttributeMatcher*) p);
164     }
165    
166     /**
167      * Unreferences matcher. If the reference count falls below 1,
168      * the matcher is automatically freed.
169      */
170     public void unref()
171     {
172         // void g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher);
173         g_file_attribute_matcher_unref(gFileAttributeMatcher);
174     }
175    
176     /**
177      * Checks if an attribute will be matched by an attribute matcher. If
178      * the matcher was created with the "*" matching string, this function
179      * will always return TRUE.
180      * Params:
181      * attribute = a file attribute key.
182      * Returns: TRUE if attribute matches matcher. FALSE otherwise.
183      */
184     public int matches(string attribute)
185     {
186         // gboolean g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher,  const char *attribute);
187         return g_file_attribute_matcher_matches(gFileAttributeMatcher, Str.toStringz(attribute));
188     }
189    
190     /**
191      * Checks if a attribute matcher only matches a given attribute. Always
192      * returns FALSE if "*" was used when creating the matcher.
193      * Params:
194      * attribute = a file attribute key.
195      * Returns: TRUE if the matcher only matches attribute. FALSE otherwise.
196      */
197     public int matchesOnly(string attribute)
198     {
199         // gboolean g_file_attribute_matcher_matches_only  (GFileAttributeMatcher *matcher,  const char *attribute);
200         return g_file_attribute_matcher_matches_only(gFileAttributeMatcher, Str.toStringz(attribute));
201     }
202    
203     /**
204      * Checks if the matcher will match all of the keys in a given namespace.
205      * This will always return TRUE if a wildcard character is in use (e.g. if
206      * matcher was created with "standard::*" and ns is "standard", or if matcher was created
207      * using "*" and namespace is anything.)
208      * TODO: this is awkwardly worded.
209      * Params:
210      * ns = a string containing a file attribute namespace.
211      * Returns: TRUE if the matcher matches all of the entries in the given ns, FALSE otherwise.
212      */
213     public int enumerateNamespace(string ns)
214     {
215         // gboolean g_file_attribute_matcher_enumerate_namespace  (GFileAttributeMatcher *matcher,  const char *ns);
216         return g_file_attribute_matcher_enumerate_namespace(gFileAttributeMatcher, Str.toStringz(ns));
217     }
218    
219     /**
220      * Gets the next matched attribute from a GFileAttributeMatcher.
221      * Returns: a string containing the next attribute or NULL if no more attribute exist.
222      */
223     public string enumerateNext()
224     {
225         // const char * g_file_attribute_matcher_enumerate_next  (GFileAttributeMatcher *matcher);
226         return Str.toString(g_file_attribute_matcher_enumerate_next(gFileAttributeMatcher));
227     }
228 }
Note: See TracBrowser for help on using the browser.