1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * gsf-input.h: abstract interface for reading data
4  *
5  * Copyright (C) 2002-2006 Jody Goldberg (jody@gnome.org)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2.1 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19  * USA
20  */
21 
22 #ifndef GSF_INPUT_H
23 #define GSF_INPUT_H
24 
25 #include <gsf/gsf-fwd.h>
26 #include <sys/types.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GSF_INPUT_TYPE        (gsf_input_get_type ())
31 #define GSF_INPUT(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), GSF_INPUT_TYPE, GsfInput))
32 #define GSF_IS_INPUT(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSF_INPUT_TYPE))
33 
34 GType gsf_input_get_type      (void);
35 /* void  gsf_input_register_type (GTypeModule *module); glib dynamic types are not thread safe */
36 
37 char const   *gsf_input_name	  (GsfInput *input);
38 GsfInfile    *gsf_input_container (GsfInput *input);
39 
40 GsfInput     *gsf_input_dup	  (GsfInput *input, GError **err);
41 GsfInput     *gsf_input_sibling	  (GsfInput const *input, char const *name, GError **err);
42 gsf_off_t     gsf_input_size	  (GsfInput *input);
43 gboolean      gsf_input_eof	  (GsfInput *input);
44 guint8 const *gsf_input_read	  (GsfInput *input, size_t num_bytes,
45 				   guint8 *optional_buffer);
46 /* For bindings _only_! */
47 guint8 *      gsf_input_read0     (GsfInput *input, size_t num_bytes,
48 				   size_t *bytes_read);
49 
50 gsf_off_t     gsf_input_remaining (GsfInput *input);
51 gsf_off_t     gsf_input_tell	  (GsfInput *input);
52 gboolean      gsf_input_seek	  (GsfInput *input,
53 				   gsf_off_t offset, GSeekType whence);
54 
55 GDateTime *   gsf_input_get_modtime (GsfInput *input);
56 
57 /* Utilities */
58 gboolean  gsf_input_copy       (GsfInput *input, GsfOutput *output);
59 GsfInput *gsf_input_uncompress (GsfInput *src);
60 
61 GQuark gsf_input_error_id (void);
62 #ifndef GSF_DISABLE_DEPRECATED
63 /* deprecated in 1.12.0, use gsf_input_error_id */
64 GQuark gsf_input_error (void);
65 #endif /* GSF_DISABLE_DEPRECATED */
66 
67 G_END_DECLS
68 
69 #endif /* GSF_INPUT_H */
70