mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12096 57a11ea4-9604-0410-9ed3-97b8803252fd
97 lines
3.2 KiB
C
97 lines
3.2 KiB
C
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
/*
|
|
* gsf-output.h: interface for storing data
|
|
*
|
|
* Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of version 2.1 of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
* USA
|
|
*/
|
|
|
|
#ifndef GSF_OUTPUT_H
|
|
#define GSF_OUTPUT_H
|
|
|
|
#include <gsf/gsf.h>
|
|
#include <sys/types.h>
|
|
#include <glib-object.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef struct {
|
|
GObjectClass g_object_class;
|
|
|
|
gboolean (*Close) (GsfOutput *output);
|
|
gboolean (*Seek) (GsfOutput *output,
|
|
gsf_off_t offset, GSeekType whence);
|
|
gboolean (*Write) (GsfOutput *output,
|
|
size_t num_bytes, guint8 const *data);
|
|
gsf_off_t (*Vprintf) (GsfOutput *output,
|
|
char const *format, va_list args);
|
|
} GsfOutputClass;
|
|
#define GSF_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSF_OUTPUT_TYPE, GsfOutputClass))
|
|
#define GSF_IS_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSF_OUTPUT_TYPE))
|
|
|
|
struct _GsfOutput {
|
|
GObject g_object;
|
|
|
|
/*< protected >*/
|
|
gsf_off_t cur_size, cur_offset;
|
|
char *name;
|
|
GObject *wrapped_by;
|
|
GsfOutfile *container;
|
|
GError *err;
|
|
gboolean is_closed;
|
|
|
|
char *printf_buf;
|
|
int printf_buf_size;
|
|
};
|
|
#define GSF_OUTPUT_TYPE (gsf_output_get_type ())
|
|
#define GSF_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSF_OUTPUT_TYPE, GsfOutput))
|
|
#define GSF_IS_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSF_OUTPUT_TYPE))
|
|
|
|
GType gsf_output_get_type (void);
|
|
|
|
char const *gsf_output_name (GsfOutput const *output);
|
|
GsfOutfile *gsf_output_container (GsfOutput const *output);
|
|
|
|
GError const *gsf_output_error (GsfOutput const *output);
|
|
gboolean gsf_output_set_error (GsfOutput *output,
|
|
gint code,
|
|
char const *format,
|
|
...) G_GNUC_PRINTF (3, 4);
|
|
|
|
gsf_off_t gsf_output_size (GsfOutput *output);
|
|
gboolean gsf_output_close (GsfOutput *output);
|
|
gboolean gsf_output_is_closed (GsfOutput const *output);
|
|
gsf_off_t gsf_output_tell (GsfOutput *output);
|
|
gboolean gsf_output_seek (GsfOutput *output,
|
|
gsf_off_t offset, GSeekType whence);
|
|
gboolean gsf_output_write (GsfOutput *output,
|
|
size_t num_bytes, guint8 const *data);
|
|
|
|
gboolean gsf_output_wrap (GObject *wrapper, GsfOutput *wrapee);
|
|
gboolean gsf_output_unwrap (GObject *wrapper, GsfOutput *wrapee);
|
|
|
|
GQuark gsf_output_error_id (void);
|
|
|
|
gboolean gsf_output_printf (GsfOutput *output, char const *format,
|
|
...) G_GNUC_PRINTF (2, 3);
|
|
gsf_off_t gsf_output_vprintf (GsfOutput *output, char const *format,
|
|
va_list args) G_GNUC_PRINTF (2, 0);
|
|
gboolean gsf_output_puts (GsfOutput *output, char const *line);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* GSF_OUTPUT_H */
|