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 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
27 #ifndef __G_DATA_INPUT_STREAM_H__
28 #define __G_DATA_INPUT_STREAM_H__
30 #include <glib-object.h>
31 #include <gio/gbufferedinputstream.h>
35 #define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ())
36 #define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream))
37 #define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
38 #define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM))
39 #define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM))
40 #define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
44 * @parent: a #GBufferedInputStream.
46 * An implementation of #GBufferedInputStream that allows for high-level
47 * data manipulation of arbitrary data (including binary operations).
49 typedef struct _GDataInputStream GDataInputStream
;
50 typedef struct _GDataInputStreamClass GDataInputStreamClass
;
51 typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate
;
53 struct _GDataInputStream
55 GBufferedInputStream parent_instance
;
58 GDataInputStreamPrivate
*priv
;
61 struct _GDataInputStreamClass
63 GBufferedInputStreamClass parent_class
;
65 /* Padding for future expansion */
66 void (*_g_reserved1
) (void);
67 void (*_g_reserved2
) (void);
68 void (*_g_reserved3
) (void);
69 void (*_g_reserved4
) (void);
70 void (*_g_reserved5
) (void);
74 * GDataStreamByteOrder:
75 * @G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: Selects Big Endian byte order.
76 * @G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: Selects Little Endian byte order.
77 * @G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: Selects endianness based on host machine's architecture.
79 * #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources
80 * across various machine architectures.
84 G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN
,
85 G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN
,
86 G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
87 } GDataStreamByteOrder
;
90 * GDataStreamNewlineType:
91 * @G_DATA_STREAM_NEWLINE_TYPE_LF: Selects "LF" line endings, common on most modern UNIX platforms.
92 * @G_DATA_STREAM_NEWLINE_TYPE_CR: Selects "CR" line endings.
93 * @G_DATA_STREAM_NEWLINE_TYPE_CR_LF: Selects "CR, LF" line ending, common on Microsoft Windows.
94 * @G_DATA_STREAM_NEWLINE_TYPE_ANY: Automatically try to handle any line ending type.
96 * #GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
99 G_DATA_STREAM_NEWLINE_TYPE_LF
,
100 G_DATA_STREAM_NEWLINE_TYPE_CR
,
101 G_DATA_STREAM_NEWLINE_TYPE_CR_LF
,
102 G_DATA_STREAM_NEWLINE_TYPE_ANY
103 } GDataStreamNewlineType
;
105 GType
g_data_input_stream_get_type (void) G_GNUC_CONST
;
106 GDataInputStream
* g_data_input_stream_new (GInputStream
*base_stream
);
108 void g_data_input_stream_set_byte_order (GDataInputStream
*stream
,
109 GDataStreamByteOrder order
);
110 GDataStreamByteOrder
g_data_input_stream_get_byte_order (GDataInputStream
*stream
);
111 void g_data_input_stream_set_newline_type (GDataInputStream
*stream
,
112 GDataStreamNewlineType type
);
113 GDataStreamNewlineType
g_data_input_stream_get_newline_type (GDataInputStream
*stream
);
114 guchar
g_data_input_stream_read_byte (GDataInputStream
*stream
,
115 GCancellable
*cancellable
,
117 gint16
g_data_input_stream_read_int16 (GDataInputStream
*stream
,
118 GCancellable
*cancellable
,
120 guint16
g_data_input_stream_read_uint16 (GDataInputStream
*stream
,
121 GCancellable
*cancellable
,
123 gint32
g_data_input_stream_read_int32 (GDataInputStream
*stream
,
124 GCancellable
*cancellable
,
126 guint32
g_data_input_stream_read_uint32 (GDataInputStream
*stream
,
127 GCancellable
*cancellable
,
129 gint64
g_data_input_stream_read_int64 (GDataInputStream
*stream
,
130 GCancellable
*cancellable
,
132 guint64
g_data_input_stream_read_uint64 (GDataInputStream
*stream
,
133 GCancellable
*cancellable
,
135 char * g_data_input_stream_read_line (GDataInputStream
*stream
,
137 GCancellable
*cancellable
,
139 char * g_data_input_stream_read_until (GDataInputStream
*stream
,
140 const gchar
*stop_chars
,
142 GCancellable
*cancellable
,
147 #endif /* __G_DATA_INPUT_STREAM_H__ */