1 /* Copyright (C) 2002 The gtkmm Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _GLIBMM_STREAMIOCHANNEL_H
18 #define _GLIBMM_STREAMIOCHANNEL_H
19 
20 #include <glibmmconfig.h>
21 #include <glibmm/iochannel.h>
22 #include <iosfwd>
23 
24 namespace Glib
25 {
26 
27 #ifndef GLIBMM_DISABLE_DEPRECATED
28 
29 /** @deprecated This whole class was deprecated in glibmm 2.2 - See the Glib::IOChannel
30  * documentation for an explanation.
31  */
32 class GLIBMM_API StreamIOChannel : public Glib::IOChannel
33 {
34 public:
35   ~StreamIOChannel() noexcept override;
36 
37   static Glib::RefPtr<StreamIOChannel> create(std::istream& stream);
38   static Glib::RefPtr<StreamIOChannel> create(std::ostream& stream);
39   static Glib::RefPtr<StreamIOChannel> create(std::iostream& stream);
40 
41 protected:
42   std::istream* stream_in_;
43   std::ostream* stream_out_;
44 
45   StreamIOChannel(std::istream* stream_in, std::ostream* stream_out);
46 
47   IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read) override;
48   IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written) override;
49   IOStatus seek_vfunc(gint64 offset, SeekType type) override;
50   IOStatus close_vfunc() override;
51   IOStatus set_flags_vfunc(IOFlags flags) override;
52   IOFlags get_flags_vfunc() override;
53   Glib::RefPtr<Glib::Source> create_watch_vfunc(IOCondition cond) override;
54 };
55 
56 #endif //#GLIBMM_DISABLE_DEPRECATED
57 
58 } // namespace Glib
59 
60 #endif /* _GLIBMM_STREAMIOCHANNEL_H */
61