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))
40 * @parent: a #GBufferedInputStream.
42 * An implementation of #GBufferedInputStream that allows for high-level
43 * data manipulation of arbitrary data (including binary operations).
45 typedef struct _GDataInputStream GDataInputStream;
46 typedef struct _GDataInputStreamClass GDataInputStreamClass;
47 typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate;
49 struct _GDataInputStream
51 GBufferedInputStream parent;
54 GDataInputStreamPrivate *priv;
57 struct _GDataInputStreamClass
59 GBufferedInputStreamClass parent_class;
61 /* Padding for future expansion */
62 void (*_g_reserved1) (void);
63 void (*_g_reserved2) (void);
64 void (*_g_reserved3) (void);
65 void (*_g_reserved4) (void);
66 void (*_g_reserved5) (void);
70 * GDataStreamByteOrder:
71 * @G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: Selects Big Endian byte order.
72 * @G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: Selects Little Endian byte order.
73 * @G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: Selects endianness based on host machine's architecture.
75 * #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources
76 * across various machine architectures.
80 G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN,
81 G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN,
82 G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
83 } GDataStreamByteOrder;
86 * GDataStreamNewlineType:
87 * @G_DATA_STREAM_NEWLINE_TYPE_LF: Selects "LF" line endings, common on most modern UNIX platforms.
88 * @G_DATA_STREAM_NEWLINE_TYPE_CR: Selects "CR" line endings.
89 * @G_DATA_STREAM_NEWLINE_TYPE_CR_LF: Selects "CR, LF" line ending, common on Microsoft Windows.
90 * @G_DATA_STREAM_NEWLINE_TYPE_ANY: Selects any line ending type.
92 * #GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
95 G_DATA_STREAM_NEWLINE_TYPE_LF,
96 G_DATA_STREAM_NEWLINE_TYPE_CR,
97 G_DATA_STREAM_NEWLINE_TYPE_CR_LF,
98 G_DATA_STREAM_NEWLINE_TYPE_ANY
99 } GDataStreamNewlineType;
101 GType g_data_input_stream_get_type (void) G_GNUC_CONST;
102 GDataInputStream* g_data_input_stream_new (GInputStream *base_stream);
104 void g_data_input_stream_set_byte_order (GDataInputStream *stream,
105 GDataStreamByteOrder order);
106 GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
107 void g_data_input_stream_set_newline_type (GDataInputStream *stream,
108 GDataStreamNewlineType type);
109 GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
110 guchar g_data_input_stream_read_byte (GDataInputStream *stream,
111 GCancellable *cancellable,
113 gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
114 GCancellable *cancellable,
116 guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
117 GCancellable *cancellable,
119 gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
120 GCancellable *cancellable,
122 guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
123 GCancellable *cancellable,
125 gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
126 GCancellable *cancellable,
128 guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
129 GCancellable *cancellable,
131 char * g_data_input_stream_read_line (GDataInputStream *stream,
133 GCancellable *cancellable,
135 char * g_data_input_stream_read_until (GDataInputStream *stream,
136 const gchar *stop_chars,
138 GCancellable *cancellable,
143 #endif /* __G_DATA_INPUT_STREAM_H__ */