451 #ifndef CGU_GSTREAM_H
452 #define CGU_GSTREAM_H
456 #if defined(DOXYGEN_PARSING) || GLIB_CHECK_VERSION(2,16,0)
469 #include <glib-object.h>
511 template <
class charT ,
class Traits = std::
char_traits<
charT> >
531 static const int output_buf_size = 1024;
532 static const int putback_size = 4;
533 static const int input_buf_size = 1024;
535 #if defined(CGU_USE_GLIB_MEMORY_SLICES_COMPAT) || defined(CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT)
545 static void swap_element(char_type&);
548 void reset_input_buffer_pointers();
550 bool wind_back_input_buffer();
551 bool is_input_stored();
552 bool is_output_stored();
553 void set_input_error(GError*);
554 void set_output_error(GError*);
589 virtual int_type
overflow(int_type);
590 #ifndef CGU_GSTREAM_USE_STD_N_READ_WRITE
602 virtual std::streamsize
xsgetn(char_type*, std::streamsize);
615 virtual std::streamsize
xsputn(
const char_type*, std::streamsize);
679 virtual pos_type
seekoff(off_type off,
680 std::ios_base::seekdir way,
681 std::ios_base::openmode m = std::ios_base::in | std::ios_base::out);
727 virtual pos_type
seekpos(pos_type p,
728 std::ios_base::openmode m = std::ios_base::in | std::ios_base::out);
1355 template <
class charT ,
class Traits = std::
char_traits<
charT> >
1434 std::basic_ostream<charT, Traits>(0),
1435 buf(stream, manage, converter) {
1515 {buf.
attach_stream(stream, manage, converter); this->clear();}
1638 template <
class charT ,
class Traits = std::
char_traits<
charT> >
1715 std::basic_istream<charT, Traits>(0),
1716 buf(stream, manage, converter) {
1796 {buf.
attach_stream(stream, manage, converter); this->clear();}
1914 template <
class charT ,
class Traits = std::
char_traits<
charT> >
1999 std::basic_iostream<charT, Traits>(0),
2000 buf(stream, manage, input_converter, output_converter) {
2090 {buf.
attach_stream(stream, manage, input_converter, output_converter); this->clear();}
2422 #include <c++-gtk-utils/gstream.tpp>
2425 #warning gstreams are not available: glib >= 2.16.0 is required
basic_gstreambuf< char16_t > u16gstreambuf
C++ stream buffer for GIO streams for char16_t type.
Definition: gstream.h:2363
virtual pos_type seekpos(pos_type p, std::ios_base::openmode m=std::ios_base::in|std::ios_base::out)
GobjHandle< GIOStream > get_gio_io_stream() const
Definition: gstream.h:2125
void set_byteswap(bool swap)
Definition: gstream.h:1859
C++ input-output stream for GIO streams.
Definition: gstream.h:1915
GobjHandle< GInputStream > get_gio_stream() const
Definition: gstream.h:1833
basic_gstreambuf< char > gstreambuf
C++ stream buffer for GIO streams for char type.
Definition: gstream.h:2301
basic_gstreambuf< wchar_t > wgstreambuf
C++ stream buffer for GIO streams for wchar_t type.
Definition: gstream.h:2332
basic_giostream< wchar_t > wgiostream
C++ input/output stream for GIO streams for wchar_t type.
Definition: gstream.h:2356
charT char_type
Definition: gstream.h:515
void close()
Definition: gstream.h:2110
basic_gostream(const GobjHandle< GOutputStream > &stream, bool manage, const GobjHandle< GConverter > &converter=GobjHandle< GConverter >())
Definition: gstream.h:1431
traits_type::int_type int_type
Definition: gstream.h:517
basic_gostream & operator=(const basic_gostream &)=delete
void swap(Cgu::AsyncQueue< T, Container > &q1, Cgu::AsyncQueue< T, Container > &q2)
Definition: async_queue.h:1483
GError * is_output_error()
Definition: gstream.h:2265
basic_giostream & operator=(const basic_giostream &)=delete
GError * is_input_error()
basic_giostream(const GobjHandle< GIOStream > &stream, bool manage, const GobjHandle< GConverter > &input_converter=GobjHandle< GConverter >(), const GobjHandle< GConverter > &output_converter=GobjHandle< GConverter >())
Definition: gstream.h:1995
C++ input stream for GIO streams.
Definition: gstream.h:1639
bool can_seek() const
Definition: gstream.h:1301
traits_type::pos_type pos_type
Definition: gstream.h:518
void attach(const GobjHandle< GIOStream > &stream, bool manage, const GobjHandle< GConverter > &input_converter=GobjHandle< GConverter >(), const GobjHandle< GConverter > &output_converter=GobjHandle< GConverter >())
Definition: gstream.h:2086
GobjHandle< GOutputStream > get_ostream() const
basic_gostream< char32_t > u32gostream
C++ output stream for GIO streams for char32_t type.
Definition: gstream.h:2410
basic_gostream< wchar_t > wgostream
C++ output stream for GIO streams for wchar_t type.
Definition: gstream.h:2348
basic_gostream()
Definition: gstream.h:1448
basic_gistream()
Definition: gstream.h:1729
A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1().
Definition: shared_handle.h:418
GError * is_error()
Definition: gstream.h:1621
bool can_seek() const
Definition: gstream.h:2244
virtual std::streamsize xsputn(const char_type *, std::streamsize)
basic_giostream< char > giostream
C++ input/output stream for GIO streams for char type.
Definition: gstream.h:2325
Traits traits_type
Definition: gstream.h:516
void set_output_buffered(bool buffered)
virtual pos_type seekoff(off_type off, std::ios_base::seekdir way, std::ios_base::openmode m=std::ios_base::in|std::ios_base::out)
basic_giostream< char16_t > u16giostream
C++ input/output stream for GIO streams for char16_t type.
Definition: gstream.h:2387
virtual int_type overflow(int_type)
GobjHandle< GInputStream > get_istream() const
GError * is_input_error()
Definition: gstream.h:2286
virtual std::streamsize xsgetn(char_type *, std::streamsize)
void attach(const GobjHandle< GInputStream > &stream, bool manage, const GobjHandle< GConverter > &converter=GobjHandle< GConverter >())
Definition: gstream.h:1793
void set_buffered(bool buffered)
Definition: gstream.h:1583
basic_gistream & operator=(const basic_gistream &)=delete
void set_byteswap(bool swap)
GError * is_output_error()
basic_gostream< char > gostream
C++ output stream for GIO streams for char type.
Definition: gstream.h:2317
basic_giostream()
Definition: gstream.h:2013
void close()
Definition: gstream.h:1535
This is a generic scoped class for managing the lifetime of objects allocated on freestore.
Definition: shared_handle.h:449
basic_gstreambuf< char32_t > u32gstreambuf
C++ stream buffer for GIO streams for char32_t type.
Definition: gstream.h:2394
basic_giostream< char32_t > u32giostream
C++ input/output stream for GIO streams for char32_t type.
Definition: gstream.h:2418
virtual ~basic_gstreambuf()
GobjHandle< GIOStream > get_iostream() const
Definition: application.h:44
GobjHandle< GInputStream > get_gio_input_stream() const
Definition: gstream.h:2161
basic_gostream< char16_t > u16gostream
C++ output stream for GIO streams for char16_t type.
Definition: gstream.h:2379
GobjHandle< GOutputStream > get_gio_output_stream() const
Definition: gstream.h:2143
bool can_seek() const
Definition: gstream.h:1600
void close()
Definition: gstream.h:1816
basic_gistream< char > gistream
C++ input stream for GIO streams for char type.
Definition: gstream.h:2309
basic_gistream< char16_t > u16gistream
C++ input stream for GIO streams for char16_t type.
Definition: gstream.h:2371
GError * is_error()
Definition: gstream.h:1897
void attach_stream(const GobjHandle< GInputStream > &input_stream_, bool manage_, const GobjHandle< GConverter > &converter_=GobjHandle< GConverter >())
bool can_seek() const
Definition: gstream.h:1876
basic_gistream< wchar_t > wgistream
C++ input stream for GIO streams for wchar_t type.
Definition: gstream.h:2340
basic_gstreambuf & operator=(const basic_gstreambuf &)=delete
virtual int_type underflow()
void set_byteswap(bool swap)
Definition: gstream.h:2191
C++ stream buffer for GIO streams.
Definition: gstream.h:512
C++ output stream for GIO streams.
Definition: gstream.h:1356
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
void set_output_buffered(bool buffered)
Definition: gstream.h:2226
traits_type::off_type off_type
Definition: gstream.h:519
GobjHandle< GOutputStream > get_gio_stream() const
Definition: gstream.h:1552
basic_gistream(const GobjHandle< GInputStream > &stream, bool manage, const GobjHandle< GConverter > &converter=GobjHandle< GConverter >())
Definition: gstream.h:1712
void attach(const GobjHandle< GOutputStream > &stream, bool manage, const GobjHandle< GConverter > &converter=GobjHandle< GConverter >())
Definition: gstream.h:1512
basic_gistream< char32_t > u32gistream
C++ input stream for GIO streams for char32_t type.
Definition: gstream.h:2402