Only allow including <gio/gio.h> from apps
[platform/upstream/glib.git] / gio / gfileenumerator.h
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 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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
26
27 #ifndef __G_FILE_ENUMERATOR_H__
28 #define __G_FILE_ENUMERATOR_H__
29
30 #include <glib-object.h>
31 #include <gio/gioerror.h>
32 #include <gio/gcancellable.h>
33 #include <gio/gfileinfo.h>
34 #include <gio/gasyncresult.h>
35
36 G_BEGIN_DECLS
37
38
39 #define G_TYPE_FILE_ENUMERATOR         (g_file_enumerator_get_type ())
40 #define G_FILE_ENUMERATOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumerator))
41 #define G_FILE_ENUMERATOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
42 #define G_IS_FILE_ENUMERATOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ENUMERATOR))
43 #define G_IS_FILE_ENUMERATOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ENUMERATOR))
44 #define G_FILE_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
45
46 /**
47  * GFileEnumerator:
48  * @parent_instance: The parent class.
49  * 
50  * A per matched file iterator.
51  **/
52 typedef struct _GFileEnumerator         GFileEnumerator;
53 typedef struct _GFileEnumeratorClass    GFileEnumeratorClass;
54 typedef struct _GFileEnumeratorPrivate  GFileEnumeratorPrivate;
55
56
57 struct _GFileEnumerator
58 {
59   GObject parent_instance;
60   
61   /*< private >*/
62   GFileEnumeratorPrivate *priv;
63 };
64
65 struct _GFileEnumeratorClass
66 {
67   GObjectClass parent_class;
68
69   /* Virtual Table */
70
71   GFileInfo *(*next_file)         (GFileEnumerator              *enumerator,
72                                    GCancellable                 *cancellable,
73                                    GError                      **error);
74   gboolean   (*close_fn)          (GFileEnumerator              *enumerator,
75                                    GCancellable                 *cancellable,
76                                    GError                      **error);
77
78   void       (*next_files_async)  (GFileEnumerator                *enumerator,
79                                    int                             num_files,
80                                    int                             io_priority,
81                                    GCancellable                   *cancellable,
82                                    GAsyncReadyCallback             callback,
83                                    gpointer                        user_data);
84   GList *    (*next_files_finish) (GFileEnumerator                *enumerator,
85                                    GAsyncResult                   *res,
86                                    GError                        **error);
87   void       (*close_async)       (GFileEnumerator                *enumerator,
88                                    int                             io_priority,
89                                    GCancellable                   *cancellable,
90                                    GAsyncReadyCallback             callback,
91                                    gpointer                        user_data);
92   gboolean   (*close_finish)      (GFileEnumerator                *enumerator,
93                                    GAsyncResult                   *res,
94                                    GError                        **error);
95
96   /*< private >*/
97   /* Padding for future expansion */
98   void (*_g_reserved1) (void);
99   void (*_g_reserved2) (void);
100   void (*_g_reserved3) (void);
101   void (*_g_reserved4) (void);
102   void (*_g_reserved5) (void);
103   void (*_g_reserved6) (void);
104   void (*_g_reserved7) (void);
105 };
106
107 GType g_file_enumerator_get_type (void) G_GNUC_CONST;
108
109 GFileInfo *g_file_enumerator_next_file         (GFileEnumerator      *enumerator,
110                                                 GCancellable         *cancellable,
111                                                 GError              **error);
112 gboolean   g_file_enumerator_close             (GFileEnumerator      *enumerator,
113                                                 GCancellable         *cancellable,
114                                                 GError              **error);
115 void       g_file_enumerator_next_files_async  (GFileEnumerator      *enumerator,
116                                                 int                   num_files,
117                                                 int                   io_priority,
118                                                 GCancellable         *cancellable,
119                                                 GAsyncReadyCallback   callback,
120                                                 gpointer              user_data);
121 GList *    g_file_enumerator_next_files_finish (GFileEnumerator      *enumerator,
122                                                 GAsyncResult         *result,
123                                                 GError              **error);
124 void       g_file_enumerator_close_async       (GFileEnumerator      *enumerator,
125                                                 int                   io_priority,
126                                                 GCancellable         *cancellable,
127                                                 GAsyncReadyCallback   callback,
128                                                 gpointer              user_data);
129 gboolean   g_file_enumerator_close_finish      (GFileEnumerator      *enumerator,
130                                                 GAsyncResult         *result,
131                                                 GError              **error);
132 gboolean   g_file_enumerator_is_closed         (GFileEnumerator      *enumerator);
133 gboolean   g_file_enumerator_has_pending       (GFileEnumerator      *enumerator);
134 void       g_file_enumerator_set_pending       (GFileEnumerator      *enumerator,
135                                                 gboolean              pending);
136
137 G_END_DECLS
138
139 #endif /* __G_FILE_ENUMERATOR_H__ */