1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
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.
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.
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.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #ifndef __G_DATA_INPUT_STREAM_H__
24 #define __G_DATA_INPUT_STREAM_H__
26 #include <glib-object.h>
27 #include <gio/gbufferedinputstream.h>
31 #define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ())
32 #define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream))
33 #define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
34 #define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM))
35 #define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM))
36 #define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
38 typedef struct _GDataInputStream GDataInputStream;
39 typedef struct _GDataInputStreamClass GDataInputStreamClass;
40 typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate;
42 struct _GDataInputStream
44 GBufferedInputStream parent;
47 GDataInputStreamPrivate *priv;
50 struct _GDataInputStreamClass
52 GBufferedInputStreamClass parent_class;
54 /* Padding for future expansion */
55 void (*_g_reserved1) (void);
56 void (*_g_reserved2) (void);
57 void (*_g_reserved3) (void);
58 void (*_g_reserved4) (void);
59 void (*_g_reserved5) (void);
63 G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN,
64 G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN,
65 G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
66 } GDataStreamByteOrder;
69 G_DATA_STREAM_NEWLINE_TYPE_LF,
70 G_DATA_STREAM_NEWLINE_TYPE_CR,
71 G_DATA_STREAM_NEWLINE_TYPE_CR_LF,
72 G_DATA_STREAM_NEWLINE_TYPE_ANY
73 } GDataStreamNewlineType;
75 GType g_data_input_stream_get_type (void) G_GNUC_CONST;
76 GDataInputStream* g_data_input_stream_new (GInputStream *base_stream);
78 void g_data_input_stream_set_byte_order (GDataInputStream *stream,
79 GDataStreamByteOrder order);
80 GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
81 void g_data_input_stream_set_newline_type (GDataInputStream *data_stream,
82 GDataStreamNewlineType type);
83 GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
84 guchar g_data_input_stream_read_byte (GDataInputStream *stream,
85 GCancellable *cancellable,
87 gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
88 GCancellable *cancellable,
90 guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
91 GCancellable *cancellable,
93 gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
94 GCancellable *cancellable,
96 guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
97 GCancellable *cancellable,
99 gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
100 GCancellable *cancellable,
102 guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
103 GCancellable *cancellable,
105 char * g_data_input_stream_read_line (GDataInputStream *stream,
107 GCancellable *cancellable,
109 char * g_data_input_stream_read_until (GDataInputStream *stream,
112 GCancellable *cancellable,
117 #endif /* __G_DATA_INPUT_STREAM_H__ */