1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * gsf-output.h: interface for storing data
5 * Copyright (C) 2002-2006 Jody Goldberg (jody@gnome.org)
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.
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.
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
26 #include <sys/types.h>
27 #include <glib-object.h>
32 GObjectClass g_object_class;
34 gboolean (*Close) (GsfOutput *output);
35 gboolean (*Seek) (GsfOutput *output,
36 gsf_off_t offset, GSeekType whence);
37 gboolean (*Write) (GsfOutput *output,
38 size_t num_bytes, guint8 const *data);
39 gsf_off_t (*Vprintf) (GsfOutput *output,
40 char const *format, va_list args)
43 #define GSF_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSF_OUTPUT_TYPE, GsfOutputClass))
44 #define GSF_IS_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSF_OUTPUT_TYPE))
50 gsf_off_t cur_size, cur_offset;
53 GsfOutfile *container;
60 #define GSF_OUTPUT_TYPE (gsf_output_get_type ())
61 #define GSF_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSF_OUTPUT_TYPE, GsfOutput))
62 #define GSF_IS_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSF_OUTPUT_TYPE))
64 GType gsf_output_get_type (void) G_GNUC_CONST;
65 /* void gsf_output_register_type (GTypeModule *module); glib dynamic types are not thread safe */
67 char const *gsf_output_name (GsfOutput const *output);
68 GsfOutfile *gsf_output_container (GsfOutput const *output);
70 GError const *gsf_output_error (GsfOutput const *output);
71 gboolean gsf_output_set_error (GsfOutput *output,
74 ...) G_GNUC_PRINTF (3, 4);
76 gsf_off_t gsf_output_size (GsfOutput *output);
77 gboolean gsf_output_close (GsfOutput *output);
78 gboolean gsf_output_is_closed (GsfOutput const *output);
79 gsf_off_t gsf_output_tell (GsfOutput *output);
80 gboolean gsf_output_seek (GsfOutput *output,
81 gsf_off_t offset, GSeekType whence);
82 gboolean gsf_output_write (GsfOutput *output,
83 size_t num_bytes, guint8 const *data);
85 gboolean gsf_output_wrap (GObject *wrapper, GsfOutput *wrapee);
86 gboolean gsf_output_unwrap (GObject *wrapper, GsfOutput *wrapee);
88 GQuark gsf_output_error_id (void);
90 gboolean gsf_output_printf (GsfOutput *output, char const *format,
91 ...) G_GNUC_PRINTF (2, 3);
92 gsf_off_t gsf_output_vprintf (GsfOutput *output, char const *format,
93 va_list args) G_GNUC_PRINTF (2, 0);
94 gboolean gsf_output_puts (GsfOutput *output, char const *line);
98 #endif /* GSF_OUTPUT_H */