Line data Source code
1 : // Copyright (c) 2013-2022 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/eventdispatcher
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 : // self
22 : //
23 : #include <cppprocess/io_pipe.h>
24 : #include <cppprocess/buffer.h>
25 :
26 :
27 :
28 : namespace cppprocess
29 : {
30 :
31 :
32 :
33 3 : class io_data_pipe
34 : : public io_pipe
35 : {
36 : public:
37 : typedef std::shared_ptr<io_data_pipe>
38 : pointer_t;
39 :
40 : io_data_pipe();
41 :
42 : void add_input(std::string const & input);
43 : void add_input(buffer_t const & input);
44 : std::string get_input(bool reset = false) const;
45 : buffer_t get_binary_input(bool reset = false) const;
46 :
47 : // pipe_connection implementation
48 : //
49 : virtual bool is_writer() const override;
50 : virtual void process_write() override;
51 :
52 : private:
53 : buffer_t f_input = buffer_t();
54 : std::size_t f_pos = 0;
55 : };
56 :
57 :
58 :
59 : } // namespace cppprocess
60 : // vim: ts=4 sw=4 et
|