1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: Alexander Larsson <alexl@redhat.com>
21 */
22
23#ifndef __G_DATA_INPUT_STREAM_H__
24#define __G_DATA_INPUT_STREAM_H__
25
26#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27#error "Only <gio/gio.h> can be included directly."
28#endif
29
30#include <gio/gbufferedinputstream.h>
31
32G_BEGIN_DECLS
33
34#define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ())
35#define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream))
36#define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
37#define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM))
38#define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM))
39#define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
40
41typedef struct _GDataInputStreamClass GDataInputStreamClass;
42typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate;
43
44struct _GDataInputStream
45{
46 GBufferedInputStream parent_instance;
47
48 /*< private >*/
49 GDataInputStreamPrivate *priv;
50};
51
52struct _GDataInputStreamClass
53{
54 GBufferedInputStreamClass parent_class;
55
56 /*< private >*/
57 /* Padding for future expansion */
58 void (*_g_reserved1) (void);
59 void (*_g_reserved2) (void);
60 void (*_g_reserved3) (void);
61 void (*_g_reserved4) (void);
62 void (*_g_reserved5) (void);
63};
64
65GIO_AVAILABLE_IN_ALL
66GType g_data_input_stream_get_type (void) G_GNUC_CONST;
67GIO_AVAILABLE_IN_ALL
68GDataInputStream * g_data_input_stream_new (GInputStream *base_stream);
69
70GIO_AVAILABLE_IN_ALL
71void g_data_input_stream_set_byte_order (GDataInputStream *stream,
72 GDataStreamByteOrder order);
73GIO_AVAILABLE_IN_ALL
74GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
75GIO_AVAILABLE_IN_ALL
76void g_data_input_stream_set_newline_type (GDataInputStream *stream,
77 GDataStreamNewlineType type);
78GIO_AVAILABLE_IN_ALL
79GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
80GIO_AVAILABLE_IN_ALL
81guchar g_data_input_stream_read_byte (GDataInputStream *stream,
82 GCancellable *cancellable,
83 GError **error);
84GIO_AVAILABLE_IN_ALL
85gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
86 GCancellable *cancellable,
87 GError **error);
88GIO_AVAILABLE_IN_ALL
89guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
90 GCancellable *cancellable,
91 GError **error);
92GIO_AVAILABLE_IN_ALL
93gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
94 GCancellable *cancellable,
95 GError **error);
96GIO_AVAILABLE_IN_ALL
97guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
98 GCancellable *cancellable,
99 GError **error);
100GIO_AVAILABLE_IN_ALL
101gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
102 GCancellable *cancellable,
103 GError **error);
104GIO_AVAILABLE_IN_ALL
105guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
106 GCancellable *cancellable,
107 GError **error);
108GIO_AVAILABLE_IN_ALL
109char * g_data_input_stream_read_line (GDataInputStream *stream,
110 gsize *length,
111 GCancellable *cancellable,
112 GError **error);
113GIO_AVAILABLE_IN_2_30
114char * g_data_input_stream_read_line_utf8 (GDataInputStream *stream,
115 gsize *length,
116 GCancellable *cancellable,
117 GError **error);
118GIO_AVAILABLE_IN_ALL
119void g_data_input_stream_read_line_async (GDataInputStream *stream,
120 gint io_priority,
121 GCancellable *cancellable,
122 GAsyncReadyCallback callback,
123 gpointer user_data);
124GIO_AVAILABLE_IN_ALL
125char * g_data_input_stream_read_line_finish (GDataInputStream *stream,
126 GAsyncResult *result,
127 gsize *length,
128 GError **error);
129GIO_AVAILABLE_IN_2_30
130char * g_data_input_stream_read_line_finish_utf8(GDataInputStream *stream,
131 GAsyncResult *result,
132 gsize *length,
133 GError **error);
134GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto)
135char * g_data_input_stream_read_until (GDataInputStream *stream,
136 const gchar *stop_chars,
137 gsize *length,
138 GCancellable *cancellable,
139 GError **error);
140GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_async)
141void g_data_input_stream_read_until_async (GDataInputStream *stream,
142 const gchar *stop_chars,
143 gint io_priority,
144 GCancellable *cancellable,
145 GAsyncReadyCallback callback,
146 gpointer user_data);
147GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_finish)
148char * g_data_input_stream_read_until_finish (GDataInputStream *stream,
149 GAsyncResult *result,
150 gsize *length,
151 GError **error);
152
153GIO_AVAILABLE_IN_ALL
154char * g_data_input_stream_read_upto (GDataInputStream *stream,
155 const gchar *stop_chars,
156 gssize stop_chars_len,
157 gsize *length,
158 GCancellable *cancellable,
159 GError **error);
160GIO_AVAILABLE_IN_ALL
161void g_data_input_stream_read_upto_async (GDataInputStream *stream,
162 const gchar *stop_chars,
163 gssize stop_chars_len,
164 gint io_priority,
165 GCancellable *cancellable,
166 GAsyncReadyCallback callback,
167 gpointer user_data);
168GIO_AVAILABLE_IN_ALL
169char * g_data_input_stream_read_upto_finish (GDataInputStream *stream,
170 GAsyncResult *result,
171 gsize *length,
172 GError **error);
173
174G_END_DECLS
175
176#endif /* __G_DATA_INPUT_STREAM_H__ */
177