/usr/include/giomm-2.4/giomm/datainputstream.h is in libglibmm-2.4-dev 2.50.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | // Generated by gmmproc 2.50.0 -- DO NOT MODIFY!
#ifndef _GIOMM_DATAINPUTSTREAM_H
#define _GIOMM_DATAINPUTSTREAM_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/bufferedinputstream.h>
#include <giomm/enums.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
using GDataInputStream = struct _GDataInputStream;
using GDataInputStreamClass = struct _GDataInputStreamClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gio
{ class DataInputStream_Class; } // namespace Gio
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gio
{
/**
* An implementation of BufferedInputStream that allows for high-level data
* manipulation of arbitrary data (including binary operations).
*
* @ingroup Streams
*
* @newin{2,16}
*/
class DataInputStream : public Gio::BufferedInputStream
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
using CppObjectType = DataInputStream;
using CppClassType = DataInputStream_Class;
using BaseObjectType = GDataInputStream;
using BaseClassType = GDataInputStreamClass;
// noncopyable
DataInputStream(const DataInputStream&) = delete;
DataInputStream& operator=(const DataInputStream&) = delete;
private: friend class DataInputStream_Class;
static CppClassType datainputstream_class_;
protected:
explicit DataInputStream(const Glib::ConstructParams& construct_params);
explicit DataInputStream(GDataInputStream* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
DataInputStream(DataInputStream&& src) noexcept;
DataInputStream& operator=(DataInputStream&& src) noexcept;
~DataInputStream() noexcept override;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GDataInputStream* gobj() { return reinterpret_cast<GDataInputStream*>(gobject_); }
///Provides access to the underlying C GObject.
const GDataInputStream* gobj() const { return reinterpret_cast<GDataInputStream*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GDataInputStream* gobj_copy();
private:
protected:
explicit DataInputStream(const Glib::RefPtr<InputStream>& base_stream);
public:
static Glib::RefPtr<DataInputStream> create(const Glib::RefPtr<InputStream>& base_stream);
/** This function sets the byte order for the given @a stream. All subsequent
* reads from the @a stream will be read in the given @a order.
*
* @param order A DataStreamByteOrder to set.
*/
void set_byte_order(DataStreamByteOrder order);
/** Gets the byte order for the data input stream.
*
* @return The @a stream's current DataStreamByteOrder.
*/
DataStreamByteOrder get_byte_order() const;
/** Sets the newline type for the @a stream.
*
* Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
* chunk ends in "CR" we must read an additional byte to know if this is "CR" or
* "CR LF", and this might block if there is no more data available.
*
* @param type The type of new line return as DataStreamNewlineType.
*/
void set_newline_type(DataStreamNewlineType type);
/** Gets the current newline type for the @a stream.
*
* @return DataStreamNewlineType for the given @a stream.
*/
DataStreamNewlineType get_newline_type() const;
/** Reads an unsigned 8-bit/1-byte value from @a stream.
*
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return An unsigned 8-bit/1-byte value read from the @a stream or %0
* if an error occurred.
*/
guchar read_byte(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_byte() convenience overload.
guchar read_byte();
/** Reads a 16-bit/2-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return A signed 16-bit/2-byte value read from @a stream or %0 if
* an error occurred.
*/
gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_int16() convenience overload.
gint16 read_int16();
/** Reads an unsigned 16-bit/2-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return An unsigned 16-bit/2-byte value read from the @a stream or %0 if
* an error occurred.
*/
guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_uint16() convenience overload.
guint16 read_uint16();
/** Reads a signed 32-bit/4-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see Glib::data_stream_get_byte_order() and Glib::data_stream_set_byte_order().
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error will be thrown with CANCELLED.
*
* @param cancellable Cancellable object.
* @return A signed 32-bit/4-byte value read from the @a stream or %0 if
* an error occurred.
*/
gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_int32() convenience overload.
gint32 read_int32();
/** Reads an unsigned 32-bit/4-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see Glib::data_stream_get_byte_order() and Glib::data_stream_set_byte_order().
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error will be thrown with CANCELLED.
*
* @param cancellable Cancellable object.
* @return An unsigned 32-bit/4-byte value read from the @a stream or %0 if
* an error occurred.
*/
guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_uint32() convenience overload.
guint32 read_uint32();
/** Reads a 64-bit/8-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see Glib::data_stream_get_byte_order() and Glib::data_stream_set_byte_order().
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error will be thrown with CANCELLED.
*
* @param cancellable Cancellable object.
* @return A signed 64-bit/8-byte value read from @a stream or %0 if
* an error occurred.
*/
gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_int64() convenience overload.
gint64 read_int64();
/** Reads an unsigned 64-bit/8-byte value from @a stream.
*
* In order to get the correct byte order for this read operation,
* see Glib::data_stream_get_byte_order().
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error will be thrown with CANCELLED.
*
* @param cancellable Cancellable object.
* @return An unsigned 64-bit/8-byte read from @a stream or %0 if
* an error occurred.
*/
guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable);
/// A read_uint64() convenience overload.
guint64 read_uint64();
//Note that we return a bool because we can't use std::string to distinguish between an empty string and a nullptr.
/** Reads a line from the data input stream.
*
* The operation can be cancelled by triggering the cancellable object from
* another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED will be thrown.
*
* @param line A string to fill with the read data (without the newlines).
* @param cancellable A cancellable object.
* @result true if the read succeeded without error.
*/
bool read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable);
/** A non-cancellable version of read_line().
*
* @param line A string to fill with the read data (without the newlines).
* @result true if the read succeeded without error.
*/
bool read_line(std::string& line);
// The below initialization is unusual because it stores the return in a 'tmp'
// variable, sets the output parameter and then frees the return. If this is
// too weird, the methods can probably be just handwritten.
#
/** Reads a UTF-8 encoded line from the data input stream.
*
* If @a cancellable is not <tt>nullptr</tt>, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error IO_ERROR_CANCELLED will be returned.
*
* @newin{2,30}
*
* @param length A #gsize to get the length of the data read in.
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return A NUL terminated UTF-8 string
* with the line that was read in (without the newlines). Set
* @a length to a #gsize to get the length of the read line. On an
* error, it will return <tt>nullptr</tt> and @a error will be set. For UTF-8
* conversion errors, the set error domain is CONVERT_ERROR. If
* there's no content to read, it will still return <tt>nullptr</tt>, but @a error
* won't be set.
*/
void read_line_utf8(std::string& line, const Glib::RefPtr<Cancellable>& cancellable, gsize& length);
/// A read_line_utf8() convenience overload.
void read_line_utf8(std::string& line, const Glib::RefPtr<Cancellable>& cancellable);
/// A read_line_utf8() convenience overload.
void read_line_utf8(std::string& line, gsize& length);
/// A read_line_utf8() convenience overload.
void read_line_utf8(std::string& line);
/** The asynchronous version of read_until(). It is
* an error to have two outstanding calls to this function.
*
* @param slot The slot to call when the request is satisfied.
* @param cancellable A cancellable object.
* @param io_priority The I/O priority of the request.
* @result true if the read succeeded without error.
*/
void read_line_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Finish an asynchronous call started by read_line_async().
*
* @param result The AsyncResult that was provided to the callback slot.
* @param data A string to fill with the read data.
* @result true if the read succeeded without error.
*/
bool read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
/** Finish an asynchronous call started by
* g_data_input_stream_read_line_async().
*
* @newin{2,30}
*
* @param result The AsyncResult that was provided to the callback.
* @param length A #gsize to get the length of the data read in.
* @return A string with the line that
* was read in (without the newlines). Set @a length to a #gsize to
* get the length of the read line. On an error, it will return
* <tt>nullptr</tt> and @a error will be set. For UTF-8 conversion errors, the set
* error domain is CONVERT_ERROR. If there's no content to read,
* it will still return <tt>nullptr</tt>, but @a error won't be set.
*/
void read_line_finish_utf8(const Glib::RefPtr<AsyncResult>& result, std::string& data, gsize& length);
/// A read_line_finish_utf8() convenience overload.
void read_line_finish_utf8(const Glib::RefPtr<AsyncResult>& result, std::string& data);
/** Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
* Note that, in contrast to read_until_async(),
* this function consumes the stop character that it finds.
*
* Don't use this function in new code. Its functionality is
* inconsistent with read_until_async(). Both
* functions will be marked as deprecated in a future release. Use
* read_upto() instead, but note that that method
* does not consume the stop character.
*
* @param data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
* @param cancellable A cancellable object.
* @result true if the read succeeded without error.
*/
bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
//TODO: This will be really deprecated sometime, maybe sometime after glib 2.30.0.
/** A non-cancellable version of read_until().
*
* Note that, in contrast to read_until_async(),
* this function consumes the stop character that it finds.
*
* Don't use this function in new code. Its functionality is
* inconsistent with read_until_async(). Both
* functions will be marked as deprecated in a future release. Use
* read_upto() instead, but note that that method
* does not consume the stop character.
*
* @param data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
* @result true if the read succeeded without error.
*/
bool read_until(std::string& data, const std::string& stop_chars);
//TODO: This will be really deprecated sometime after glib 2.30.0.
/** The asynchronous version of read_until(). It is
* an error to have two outstanding calls to this function.
*
* Note that, in contrast to ead_until(),
* this function does not consume the stop character that it finds. You
* must read it for yourself.
*
*
* Don't use this function in new code. Its functionality is
* inconsistent with read_until(). Both functions
* will be marked as deprecated in a future release. Use
* read_upto_async() instead.
*
* @param stop_chars Characters to terminate the read.
* @param slot The slot to call when the request is satisfied.
* @param cancellable A cancellable object.
* @param io_priority The I/O priority of the request.
* @result true if the read succeeded without error.
*/
void read_until_async(const std::string& stop_chars, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
//TODO: This will be really deprecated sometime after glib 2.30.0.
/** Finish an asynchronous call started by read_until_async().
*
* @param result The AsyncResult that was provided to the callback slot.
* @param data A string to fill with the read data.
* @result true if the read succeeded without error.
*/
bool read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
/** Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
* In contrast to read_until(), this method
* does <em>not</em> consume the stop character. You have
* to use read_byte() to get it before calling
* read_upto() again.
*
* @param data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
* @param cancellable A cancellable object.
* @result true if the read succeeded without error.
*/
bool read_upto(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
/** A non-cancellable version of read_upto().
* @param data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
* @result true if the read succeeded without error.
*/
bool read_upto(std::string& data, const std::string& stop_chars);
//TODO: Add a version that takes the stop_chars length, to allow a 0 in the middle?
/** The asynchronous version of read_upto(). It is
* an error to have two outstanding calls to this function.
*
* In contrast to read_until(), this method
* does <em>not</em> consume the stop character. You have
* to use read_byte() to get it before calling
* read_upto() again.
*
* @param stop_chars Characters to terminate the read.
* @param slot The slot to call when the request is satisfied.
* @param cancellable A cancellable object.
* @param io_priority The I/O priority of the request.
* @result true if the read succeeded without error.
*/
void read_upto_async(const std::string& stop_chars, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Finish an asynchronous call started by read_upto_async().
*
* Note that this function does <em>not</em> consume the
* stop character. You have to use read_byte() to
* get it before calling read_upto_async() again.
*
* @param result The AsyncResult that was provided to the callback slot.
* @param data A string to fill with the read data.
* @result true if the read succeeded without error.
*/
bool read_upto_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
/** The byte order.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< DataStreamByteOrder > property_byte_order() ;
/** The byte order.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< DataStreamByteOrder > property_byte_order() const;
/** The accepted types of line ending.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< DataStreamNewlineType > property_newline_type() ;
/** The accepted types of line ending.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< DataStreamNewlineType > property_newline_type() const;
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
};
} // namespace Gio
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gio::DataInputStream
*/
Glib::RefPtr<Gio::DataInputStream> wrap(GDataInputStream* object, bool take_copy = false);
}
#endif /* _GIOMM_DATAINPUTSTREAM_H */
|