1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __G_FILE_ENUMERATOR_H__
22#define __G_FILE_ENUMERATOR_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/giotypes.h>
29
30G_BEGIN_DECLS
31
32#define G_TYPE_FILE_ENUMERATOR (g_file_enumerator_get_type ())
33#define G_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumerator))
34#define G_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
35#define G_IS_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ENUMERATOR))
36#define G_IS_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ENUMERATOR))
37#define G_FILE_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
38
39/**
40 * GFileEnumerator:
41 *
42 * A per matched file iterator.
43 **/
44typedef struct _GFileEnumeratorClass GFileEnumeratorClass;
45typedef struct _GFileEnumeratorPrivate GFileEnumeratorPrivate;
46
47struct _GFileEnumerator
48{
49 GObject parent_instance;
50
51 /*< private >*/
52 GFileEnumeratorPrivate *priv;
53};
54
55struct _GFileEnumeratorClass
56{
57 GObjectClass parent_class;
58
59 /* Virtual Table */
60
61 GFileInfo * (* next_file) (GFileEnumerator *enumerator,
62 GCancellable *cancellable,
63 GError **error);
64 gboolean (* close_fn) (GFileEnumerator *enumerator,
65 GCancellable *cancellable,
66 GError **error);
67
68 void (* next_files_async) (GFileEnumerator *enumerator,
69 int num_files,
70 int io_priority,
71 GCancellable *cancellable,
72 GAsyncReadyCallback callback,
73 gpointer user_data);
74 GList * (* next_files_finish) (GFileEnumerator *enumerator,
75 GAsyncResult *result,
76 GError **error);
77 void (* close_async) (GFileEnumerator *enumerator,
78 int io_priority,
79 GCancellable *cancellable,
80 GAsyncReadyCallback callback,
81 gpointer user_data);
82 gboolean (* close_finish) (GFileEnumerator *enumerator,
83 GAsyncResult *result,
84 GError **error);
85
86 /*< private >*/
87 /* Padding for future expansion */
88 void (*_g_reserved1) (void);
89 void (*_g_reserved2) (void);
90 void (*_g_reserved3) (void);
91 void (*_g_reserved4) (void);
92 void (*_g_reserved5) (void);
93 void (*_g_reserved6) (void);
94 void (*_g_reserved7) (void);
95};
96
97GLIB_AVAILABLE_IN_ALL
98GType g_file_enumerator_get_type (void) G_GNUC_CONST;
99
100GLIB_AVAILABLE_IN_ALL
101GFileInfo *g_file_enumerator_next_file (GFileEnumerator *enumerator,
102 GCancellable *cancellable,
103 GError **error);
104GLIB_AVAILABLE_IN_ALL
105gboolean g_file_enumerator_close (GFileEnumerator *enumerator,
106 GCancellable *cancellable,
107 GError **error);
108GLIB_AVAILABLE_IN_ALL
109void g_file_enumerator_next_files_async (GFileEnumerator *enumerator,
110 int num_files,
111 int io_priority,
112 GCancellable *cancellable,
113 GAsyncReadyCallback callback,
114 gpointer user_data);
115GLIB_AVAILABLE_IN_ALL
116GList * g_file_enumerator_next_files_finish (GFileEnumerator *enumerator,
117 GAsyncResult *result,
118 GError **error);
119GLIB_AVAILABLE_IN_ALL
120void g_file_enumerator_close_async (GFileEnumerator *enumerator,
121 int io_priority,
122 GCancellable *cancellable,
123 GAsyncReadyCallback callback,
124 gpointer user_data);
125GLIB_AVAILABLE_IN_ALL
126gboolean g_file_enumerator_close_finish (GFileEnumerator *enumerator,
127 GAsyncResult *result,
128 GError **error);
129GLIB_AVAILABLE_IN_ALL
130gboolean g_file_enumerator_is_closed (GFileEnumerator *enumerator);
131GLIB_AVAILABLE_IN_ALL
132gboolean g_file_enumerator_has_pending (GFileEnumerator *enumerator);
133GLIB_AVAILABLE_IN_ALL
134void g_file_enumerator_set_pending (GFileEnumerator *enumerator,
135 gboolean pending);
136GLIB_AVAILABLE_IN_ALL
137GFile * g_file_enumerator_get_container (GFileEnumerator *enumerator);
138GLIB_AVAILABLE_IN_2_36
139GFile * g_file_enumerator_get_child (GFileEnumerator *enumerator,
140 GFileInfo *info);
141
142GLIB_AVAILABLE_IN_2_44
143gboolean g_file_enumerator_iterate (GFileEnumerator *direnum,
144 GFileInfo **out_info,
145 GFile **out_child,
146 GCancellable *cancellable,
147 GError **error);
148
149
150G_END_DECLS
151
152#endif /* __G_FILE_ENUMERATOR_H__ */
153

source code of include/glib-2.0/gio/gfileenumerator.h