1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * gsf-input-impl.h: implementation details of GsfInput
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_IMPL_H
23 #define GSF_INPUT_IMPL_H
24 
25 #include <sys/stat.h>
26 
27 #include <gsf/gsf-fwd.h>
28 
29 G_BEGIN_DECLS
30 
31 struct _GsfInput {
32 	GObject   g_object;
33 
34 	gsf_off_t    size, cur_offset;
35 	char      *name;
36 	GsfInfile *container;
37 };
38 
39 typedef struct {
40 	GObjectClass g_object_class;
41 
42 	GsfInput     *(*Dup)  (GsfInput *input, GError **err);
43 	const guint8 *(*Read) (GsfInput *input, size_t num_bytes,
44 			       guint8 *optional_buffer);
45 	gboolean      (*Seek) (GsfInput *input, gsf_off_t offset,
46 			       GSeekType whence);
47 	GsfInput     *(*OpenSibling)  (GsfInput const *input,
48 				       char const *name, GError **err);
49 
50 	/* Padding for future expansion */
51 	void (*_gsf_reserved0) (void);
52 	void (*_gsf_reserved1) (void);
53 	void (*_gsf_reserved2) (void);
54 	void (*_gsf_reserved3) (void);
55 } GsfInputClass;
56 
57 #define GSF_INPUT_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), GSF_INPUT_TYPE, GsfInputClass))
58 #define GSF_IS_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSF_INPUT_TYPE))
59 
60 /* protected */
61 gboolean gsf_input_set_name	 (GsfInput *input, char const *name);
62 gboolean gsf_input_set_name_from_filename (GsfInput *input, char const *filename);
63 gboolean gsf_input_set_container (GsfInput *input, GsfInfile *container);
64 gboolean gsf_input_set_size	 (GsfInput *input, gsf_off_t size);
65 gboolean gsf_input_set_modtime   (GsfInput *input, GDateTime *modtime);
66 gboolean gsf_input_seek_emulate  (GsfInput *input, gsf_off_t pos);
67 
68 gboolean gsf_input_set_modtime_from_stat (GsfInput *input,
69 					  const struct stat *st);
70 
71 G_END_DECLS
72 
73 #endif /* GSF_INPUT_IMPL_H */
74