1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <glibmm/iochannel.h>
7 #include <glibmm/private/iochannel_p.h>
8 
9 
10 /* Copyright (C) 2002 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #include <glibmm/exceptionhandler.h>
27 #include <glibmm/iochannel.h>
28 #include <glibmm/utility.h>
29 #include <glibmm/main.h>
30 
31 namespace
32 {
33 
34 // Glib::IOChannel reference counting issues:
35 //
36 // Normally, you'd expect that the C++ object stays around as long as the
37 // C instance does.  Also Glib::wrap() usually returns always the same C++
38 // wrapper object for a single C instance.
39 //
40 // Unfortunately it isn't possible to implement these features if we didn't
41 // create the underlying GIOChannel.  That is, when wrapping existing
42 // GIOChannel instances such as returned by e.g. g_io_channel_unix_new() or
43 // g_io_channel_new_file().  Neither is there a way to hook up a wrapper
44 // object in an existing GIOChannel, nor exists any destroy notification.
45 //
46 // So that means:  If the IOChannel is implemented in C++ -- that is, our
47 // GlibmmIOChannel backend is used -- we use the GIOChannel reference
48 // counting mechanism.  If the IOChannel backend is unknown, then the
49 // wrapper instance holds always exactly one reference to the GIOChannel.
50 // The wrapper object itself is then managed via our own refcounting
51 // mechanism.  To do that a utility class ForeignIOChannel is introduced to
52 // override reference() and unreference().
53 
54 class ForeignIOChannel : public Glib::IOChannel
55 {
56 public:
ForeignIOChannel(GIOChannel * gobject,bool take_copy)57   ForeignIOChannel(GIOChannel* gobject, bool take_copy)
58   : Glib::IOChannel(gobject, take_copy), ref_count_(0)
59   {
60   }
61 
62   void reference() const override;
63   void unreference() const override;
64 
65 private:
66   mutable int ref_count_;
67 };
68 
69 void
reference() const70 ForeignIOChannel::reference() const
71 {
72   ++ref_count_;
73 }
74 
75 void
unreference() const76 ForeignIOChannel::unreference() const
77 {
78   if (!(--ref_count_))
79     delete this;
80 }
81 
82 } // anonymous namespace
83 
84 namespace Glib
85 {
86 
87 class GlibmmIOChannel
88 {
89 public:
90   GIOChannel base;
91   Glib::IOChannel* wrapper;
92 
93   static const GIOFuncs vfunc_table;
94 
95   static GIOStatus io_read(
96     GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err);
97 
98   static GIOStatus io_write(
99     GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err);
100 
101   static GIOStatus io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err);
102   static GIOStatus io_close(GIOChannel* channel, GError** err);
103 
104   static GSource* io_create_watch(GIOChannel* channel, GIOCondition condition);
105   static void io_free(GIOChannel* channel);
106 
107   static GIOStatus io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err);
108   static GIOFlags io_get_flags(GIOChannel* channel);
109 };
110 
111 // static
112 const GIOFuncs GlibmmIOChannel::vfunc_table = {
113   &GlibmmIOChannel::io_read, &GlibmmIOChannel::io_write, &GlibmmIOChannel::io_seek,
114   &GlibmmIOChannel::io_close, &GlibmmIOChannel::io_create_watch, &GlibmmIOChannel::io_free,
115   &GlibmmIOChannel::io_set_flags, &GlibmmIOChannel::io_get_flags,
116 };
117 
118 /**** GLib::IOChannel ******************************************************/
119 
120 /* Construct a custom C++-implemented IOChannel.  GlibmmIOChannel is an
121  * extended GIOChannel struct which allows us to hook up a pointer to this
122  * persistent wrapper instance.
123  */
IOChannel()124 IOChannel::IOChannel() : gobject_(static_cast<GIOChannel*>(g_malloc(sizeof(GlibmmIOChannel))))
125 {
126   g_io_channel_init(gobject_);
127   gobject_->funcs = const_cast<GIOFuncs*>(&GlibmmIOChannel::vfunc_table);
128 
129   reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = this;
130 }
131 
IOChannel(IOChannel && other)132 IOChannel::IOChannel(IOChannel&& other) noexcept : sigc::trackable(std::move(other)),
133                                                    gobject_(std::move(other.gobject_))
134 {
135   other.gobject_ = nullptr;
136 }
137 
138 IOChannel&
operator =(IOChannel && other)139 IOChannel::operator=(IOChannel&& other) noexcept
140 {
141   sigc::trackable::operator=(std::move(other));
142 
143   release_gobject();
144 
145   gobject_ = std::move(other.gobject_);
146   other.gobject_ = nullptr;
147 
148   return *this;
149 }
150 
151 /* Construct an IOChannel wrapper for an already created GIOChannel.
152  * See the comment at the top of this file for an explanation of the
153  * problems with this approach.
154  */
IOChannel(GIOChannel * gobject,bool take_copy)155 IOChannel::IOChannel(GIOChannel* gobject, bool take_copy) : gobject_(gobject)
156 {
157   // This ctor should never be called for GlibmmIOChannel instances.
158   g_assert(gobject != nullptr);
159   g_assert(gobject->funcs != &GlibmmIOChannel::vfunc_table);
160 
161   if (take_copy)
162     g_io_channel_ref(gobject_);
163 }
164 
165 void
release_gobject()166 IOChannel::release_gobject()
167 {
168   if (gobject_)
169   {
170     // Check whether this IOChannel is implemented in C++, i.e. whether it
171     // uses our GlibmmIOChannel forwarding backend.  Normally, this will never
172     // be true because the wrapper should only be deleted in the io_free()
173     // callback, which clears gobject_ before deleting.  But in case the ctor
174     // of a derived class threw an exception the GIOChannel must be destroyed
175     // prematurely.
176     //
177     if (gobject_->funcs == &GlibmmIOChannel::vfunc_table)
178     {
179       // Disconnect the wrapper object so that it won't be deleted twice.
180       reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = nullptr;
181     }
182 
183     const auto tmp_gobject = gobject_;
184     gobject_ = nullptr;
185 
186     g_io_channel_unref(tmp_gobject);
187   }
188 }
189 
~IOChannel()190 IOChannel::~IOChannel()
191 {
192   release_gobject();
193 }
194 
195 Glib::RefPtr<IOChannel>
create_from_file(const std::string & filename,const std::string & mode)196 IOChannel::create_from_file(const std::string& filename, const std::string& mode)
197 {
198   GError* gerror = nullptr;
199   const auto channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
200 
201   if (gerror)
202   {
203     Glib::Error::throw_exception(gerror);
204   }
205 
206   return Glib::wrap(channel, false);
207 }
208 
209 Glib::RefPtr<IOChannel>
create_from_fd(int fd)210 IOChannel::create_from_fd(int fd)
211 {
212   return Glib::wrap(g_io_channel_unix_new(fd), false);
213 }
214 
215 #ifdef G_OS_WIN32
216 
217 Glib::RefPtr<IOChannel>
create_from_win32_fd(int fd)218 IOChannel::create_from_win32_fd(int fd)
219 {
220   return Glib::wrap(g_io_channel_win32_new_fd(fd), false);
221 }
222 
223 Glib::RefPtr<IOChannel>
create_from_win32_socket(int socket)224 IOChannel::create_from_win32_socket(int socket)
225 {
226   return Glib::wrap(g_io_channel_win32_new_socket(socket), false);
227 }
228 
229 #endif /* G_OS_WIN32 */
230 
231 IOStatus
write(const Glib::ustring & str)232 IOChannel::write(const Glib::ustring& str)
233 {
234   gsize bytes_written = 0;
235   return write(str.data(), str.bytes(), bytes_written);
236 }
237 
238 IOStatus
read_line(Glib::ustring & line)239 IOChannel::read_line(Glib::ustring& line)
240 {
241   GError* gerror = nullptr;
242   gsize bytes = 0;
243   char* pch_buf = nullptr;
244 
245   const auto status = g_io_channel_read_line(gobj(), &pch_buf, &bytes, nullptr, &gerror);
246   auto buf = make_unique_ptr_gfree(pch_buf);
247   if (gerror)
248   {
249     Glib::Error::throw_exception(gerror);
250   }
251 
252   if (buf.get())
253     line.assign(buf.get(), buf.get() + bytes);
254   else
255     line.erase();
256 
257   return (IOStatus)status;
258 }
259 
260 IOStatus
read_to_end(Glib::ustring & str)261 IOChannel::read_to_end(Glib::ustring& str)
262 {
263   GError* gerror = nullptr;
264   gsize bytes = 0;
265   char* pch_buf = nullptr;
266 
267   const auto status = g_io_channel_read_to_end(gobj(), &pch_buf, &bytes, &gerror);
268   auto buf = make_unique_ptr_gfree(pch_buf);
269   if (gerror)
270   {
271     Glib::Error::throw_exception(gerror);
272   }
273 
274   if (buf.get())
275     str.assign(buf.get(), buf.get() + bytes);
276   else
277     str.erase();
278 
279   return (IOStatus)status;
280 }
281 
282 IOStatus
read(Glib::ustring & str,gsize count)283 IOChannel::read(Glib::ustring& str, gsize count)
284 {
285   auto buf = make_unique_ptr_gfree(g_new(char, count));
286   GError* gerror = nullptr;
287   gsize bytes = 0;
288 
289   const auto status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
290 
291   if (gerror)
292   {
293     Glib::Error::throw_exception(gerror);
294   }
295 
296   if (buf.get())
297     str.assign(buf.get(), buf.get() + bytes);
298   else
299     str.erase();
300 
301   return (IOStatus)status;
302 }
303 
304 IOStatus
set_encoding(const std::string & encoding)305 IOChannel::set_encoding(const std::string& encoding)
306 {
307   GError* gerror = nullptr;
308 
309   const auto status = g_io_channel_set_encoding(gobj(), Glib::c_str_or_nullptr(encoding), &gerror);
310 
311   if (gerror)
312   {
313     Glib::Error::throw_exception(gerror);
314   }
315 
316   return (IOStatus)status;
317 }
318 
319 std::string
get_encoding() const320 IOChannel::get_encoding() const
321 {
322   const char* const encoding = g_io_channel_get_encoding(gobject_);
323   return convert_const_gchar_ptr_to_stdstring(encoding);
324 }
325 
326 void
set_line_term(const std::string & term)327 IOChannel::set_line_term(const std::string& term)
328 {
329   if (term.empty())
330     g_io_channel_set_line_term(gobj(), nullptr, 0);
331   else
332     g_io_channel_set_line_term(gobj(), term.data(), term.size());
333 }
334 
335 std::string
get_line_term() const336 IOChannel::get_line_term() const
337 {
338   int len = 0;
339   const char* const term = g_io_channel_get_line_term(gobject_, &len);
340 
341   return (term) ? std::string(term, len) : std::string();
342 }
343 
344 Glib::RefPtr<IOSource>
create_watch(IOCondition condition)345 IOChannel::create_watch(IOCondition condition)
346 {
347   // The corresponding unreference() takes place in the dtor
348   // of the Glib::RefPtr<IOChannel> object below.
349   reference();
350   return IOSource::create(Glib::RefPtr<IOChannel>(this), condition);
351 }
352 
353 IOStatus
read_vfunc(char *,gsize,gsize &)354 IOChannel::read_vfunc(char*, gsize, gsize&)
355 {
356   g_assert_not_reached();
357   return IO_STATUS_ERROR;
358 }
359 
360 IOStatus
write_vfunc(const char *,gsize,gsize &)361 IOChannel::write_vfunc(const char*, gsize, gsize&)
362 {
363   g_assert_not_reached();
364   return IO_STATUS_ERROR;
365 }
366 
seek_vfunc(gint64,SeekType)367 IOStatus IOChannel::seek_vfunc(gint64, SeekType)
368 {
369   g_assert_not_reached();
370   return IO_STATUS_ERROR;
371 }
372 
373 IOStatus
close_vfunc()374 IOChannel::close_vfunc()
375 {
376   g_assert_not_reached();
377   return IO_STATUS_ERROR;
378 }
379 
create_watch_vfunc(IOCondition)380 Glib::RefPtr<Glib::Source> IOChannel::create_watch_vfunc(IOCondition)
381 {
382   g_assert_not_reached();
383   return Glib::RefPtr<Glib::Source>();
384 }
385 
set_flags_vfunc(IOFlags)386 IOStatus IOChannel::set_flags_vfunc(IOFlags)
387 {
388   g_assert_not_reached();
389   return IO_STATUS_ERROR;
390 }
391 
392 IOFlags
get_flags_vfunc()393 IOChannel::get_flags_vfunc()
394 {
395   g_assert_not_reached();
396   return IOFlags(0);
397 }
398 
399 void
reference() const400 IOChannel::reference() const
401 {
402   g_io_channel_ref(gobject_);
403 }
404 
405 void
unreference() const406 IOChannel::unreference() const
407 {
408   g_io_channel_unref(gobject_);
409 }
410 
411 Glib::RefPtr<IOChannel>
wrap(GIOChannel * gobject,bool take_copy)412 wrap(GIOChannel* gobject, bool take_copy)
413 {
414   IOChannel* cpp_object = nullptr;
415 
416   if (gobject)
417   {
418     if (gobject->funcs == &GlibmmIOChannel::vfunc_table)
419     {
420       cpp_object = reinterpret_cast<GlibmmIOChannel*>(gobject)->wrapper;
421 
422       if (take_copy && cpp_object)
423         cpp_object->reference();
424     }
425     else
426     {
427       cpp_object = new ForeignIOChannel(gobject, take_copy);
428       cpp_object->reference(); // the refcount is initially 0
429     }
430   }
431 
432   return Glib::RefPtr<IOChannel>(cpp_object);
433 }
434 
435 /**** Glib::GlibmmIOChannel ************************************************/
436 
437 GIOStatus
io_read(GIOChannel * channel,char * buf,gsize count,gsize * bytes_read,GError ** err)438 GlibmmIOChannel::io_read(
439   GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err)
440 {
441   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
442 
443   try
444   {
445     return (GIOStatus)wrapper->read_vfunc(buf, count, *bytes_read);
446   }
447   catch (Glib::Error& error)
448   {
449     error.propagate(err);
450   }
451   catch (...)
452   {
453     Glib::exception_handlers_invoke();
454   }
455 
456   return G_IO_STATUS_ERROR;
457 }
458 
459 GIOStatus
io_write(GIOChannel * channel,const char * buf,gsize count,gsize * bytes_written,GError ** err)460 GlibmmIOChannel::io_write(
461   GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err)
462 {
463   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
464 
465   try
466   {
467     return (GIOStatus)wrapper->write_vfunc(buf, count, *bytes_written);
468   }
469   catch (Glib::Error& error)
470   {
471     error.propagate(err);
472   }
473   catch (...)
474   {
475     Glib::exception_handlers_invoke();
476   }
477 
478   return G_IO_STATUS_ERROR;
479 }
480 
481 GIOStatus
io_seek(GIOChannel * channel,gint64 offset,GSeekType type,GError ** err)482 GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err)
483 {
484   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
485 
486   try
487   {
488     return (GIOStatus)wrapper->seek_vfunc(offset, (SeekType)type);
489   }
490   catch (Glib::Error& error)
491   {
492     error.propagate(err);
493   }
494   catch (...)
495   {
496     Glib::exception_handlers_invoke();
497   }
498 
499   return G_IO_STATUS_ERROR;
500 }
501 
502 GIOStatus
io_close(GIOChannel * channel,GError ** err)503 GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
504 {
505   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
506 
507   try
508   {
509     return (GIOStatus)wrapper->close_vfunc();
510   }
511   catch (Glib::Error& error)
512   {
513     error.propagate(err);
514   }
515   catch (...)
516   {
517     Glib::exception_handlers_invoke();
518   }
519 
520   return G_IO_STATUS_ERROR;
521 }
522 
523 // static
524 GSource*
io_create_watch(GIOChannel * channel,GIOCondition condition)525 GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition)
526 {
527   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
528 
529   try
530   {
531     const auto source = wrapper->create_watch_vfunc((IOCondition)condition);
532     return (source) ? source->gobj_copy() : nullptr;
533   }
534   catch (...)
535   {
536     Glib::exception_handlers_invoke();
537   }
538 
539   return nullptr;
540 }
541 
542 // static
543 void
io_free(GIOChannel * channel)544 GlibmmIOChannel::io_free(GIOChannel* channel)
545 {
546   if (IOChannel* const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper)
547   {
548     wrapper->gobject_ = nullptr;
549     delete wrapper;
550   }
551 
552   g_free(channel);
553 }
554 
555 GIOStatus
io_set_flags(GIOChannel * channel,GIOFlags flags,GError ** err)556 GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err)
557 {
558   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
559 
560   try
561   {
562     return (GIOStatus)wrapper->set_flags_vfunc((IOFlags)flags);
563   }
564   catch (Glib::Error& error)
565   {
566     error.propagate(err);
567   }
568   catch (...)
569   {
570     Glib::exception_handlers_invoke();
571   }
572 
573   return G_IO_STATUS_ERROR;
574 }
575 
576 // static
577 GIOFlags
io_get_flags(GIOChannel * channel)578 GlibmmIOChannel::io_get_flags(GIOChannel* channel)
579 {
580   const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
581 
582   try
583   {
584     return (GIOFlags)wrapper->get_flags_vfunc();
585   }
586   catch (...)
587   {
588     Glib::exception_handlers_invoke();
589   }
590 
591   return GIOFlags(0);
592 }
593 
594 } // namespace Glib
595 
596 namespace
597 {
598 } // anonymous namespace
599 
600 
IOChannelError(Glib::IOChannelError::Code error_code,const Glib::ustring & error_message)601 Glib::IOChannelError::IOChannelError(Glib::IOChannelError::Code error_code, const Glib::ustring& error_message)
602 :
603   Glib::Error (G_IO_CHANNEL_ERROR, error_code, error_message)
604 {}
605 
IOChannelError(GError * gobject)606 Glib::IOChannelError::IOChannelError(GError* gobject)
607 :
608   Glib::Error (gobject)
609 {}
610 
code() const611 Glib::IOChannelError::Code Glib::IOChannelError::code() const
612 {
613   return static_cast<Code>(Glib::Error::code());
614 }
615 
throw_func(GError * gobject)616 void Glib::IOChannelError::throw_func(GError* gobject)
617 {
618   throw Glib::IOChannelError(gobject);
619 }
620 
621 
622 namespace Glib
623 {
624 
625 
read(gunichar & thechar)626 IOStatus IOChannel::read(gunichar& thechar)
627 {
628   GError* gerror = nullptr;
629   IOStatus retvalue = ((IOStatus)(g_io_channel_read_unichar(gobj(), &(thechar), &(gerror))));
630   if(gerror)
631     ::Glib::Error::throw_exception(gerror);
632   return retvalue;
633 }
634 
read(char * buf,gsize count,gsize & bytes_read)635 IOStatus IOChannel::read(char* buf, gsize count, gsize& bytes_read)
636 {
637   GError* gerror = nullptr;
638   IOStatus retvalue = ((IOStatus)(g_io_channel_read_chars(gobj(), buf, count, &(bytes_read), &(gerror))));
639   if(gerror)
640     ::Glib::Error::throw_exception(gerror);
641   return retvalue;
642 }
643 
write(const char * buf,gssize count,gsize & bytes_written)644 IOStatus IOChannel::write(const char* buf, gssize count, gsize& bytes_written)
645 {
646   GError* gerror = nullptr;
647   IOStatus retvalue = ((IOStatus)(g_io_channel_write_chars(gobj(), buf, count, &(bytes_written), &(gerror))));
648   if(gerror)
649     ::Glib::Error::throw_exception(gerror);
650   return retvalue;
651 }
652 
write(gunichar unichar)653 IOStatus IOChannel::write(gunichar unichar)
654 {
655   GError* gerror = nullptr;
656   IOStatus retvalue = ((IOStatus)(g_io_channel_write_unichar(gobj(), unichar, &(gerror))));
657   if(gerror)
658     ::Glib::Error::throw_exception(gerror);
659   return retvalue;
660 }
661 
seek(gint64 offset,SeekType type)662 IOStatus IOChannel::seek(gint64 offset, SeekType type)
663 {
664   GError* gerror = nullptr;
665   IOStatus retvalue = ((IOStatus)(g_io_channel_seek_position(gobj(), offset, ((GSeekType)(type)), &(gerror))));
666   if(gerror)
667     ::Glib::Error::throw_exception(gerror);
668   return retvalue;
669 }
670 
flush()671 IOStatus IOChannel::flush()
672 {
673   GError* gerror = nullptr;
674   IOStatus retvalue = ((IOStatus)(g_io_channel_flush(gobj(), &(gerror))));
675   if(gerror)
676     ::Glib::Error::throw_exception(gerror);
677   return retvalue;
678 }
679 
close(bool flush_pending)680 IOStatus IOChannel::close(bool flush_pending)
681 {
682   GError* gerror = nullptr;
683   IOStatus retvalue = ((IOStatus)(g_io_channel_shutdown(gobj(), static_cast<int>(flush_pending), &(gerror))));
684   if(gerror)
685     ::Glib::Error::throw_exception(gerror);
686   return retvalue;
687 }
688 
get_buffer_size() const689 gsize IOChannel::get_buffer_size() const
690 {
691   return g_io_channel_get_buffer_size(const_cast<GIOChannel*>(gobj()));
692 }
693 
set_buffer_size(gsize size)694 void IOChannel::set_buffer_size(gsize size)
695 {
696   g_io_channel_set_buffer_size(gobj(), size);
697 }
698 
get_flags() const699 IOFlags IOChannel::get_flags() const
700 {
701   return ((IOFlags)(g_io_channel_get_flags(const_cast<GIOChannel*>(gobj()))));
702 }
703 
set_flags(IOFlags flags)704 IOStatus IOChannel::set_flags(IOFlags flags)
705 {
706   GError* gerror = nullptr;
707   IOStatus retvalue = ((IOStatus)(g_io_channel_set_flags(gobj(), ((GIOFlags)(flags)), &(gerror))));
708   if(gerror)
709     ::Glib::Error::throw_exception(gerror);
710   return retvalue;
711 }
712 
set_buffered(bool buffered)713 void IOChannel::set_buffered(bool buffered)
714 {
715   g_io_channel_set_buffered(gobj(), static_cast<int>(buffered));
716 }
717 
get_buffered() const718 bool IOChannel::get_buffered() const
719 {
720   return g_io_channel_get_buffered(const_cast<GIOChannel*>(gobj()));
721 }
722 
get_buffer_condition() const723 IOCondition IOChannel::get_buffer_condition() const
724 {
725   return ((IOCondition)(g_io_channel_get_buffer_condition(const_cast<GIOChannel*>(gobj()))));
726 }
727 
get_close_on_unref() const728 bool IOChannel::get_close_on_unref() const
729 {
730   return g_io_channel_get_close_on_unref(const_cast<GIOChannel*>(gobj()));
731 }
732 
set_close_on_unref(bool do_close)733 void IOChannel::set_close_on_unref(bool do_close)
734 {
735   g_io_channel_set_close_on_unref(gobj(), static_cast<int>(do_close));
736 }
737 
738 
739 } // namespace Glib
740 
741 
742