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 : // pre-defined output pipe
34 4 : class io_capture_pipe
35 : : public io_pipe
36 : {
37 : public:
38 : typedef std::shared_ptr<io_capture_pipe>
39 : pointer_t;
40 :
41 : io_capture_pipe();
42 :
43 : // pipe_connection implementation
44 : //
45 : virtual void process_read() override;
46 :
47 : std::string get_output(bool reset = false) const;
48 : std::string get_trimmed_output(bool inside = false, bool reset = false) const;
49 : buffer_t get_binary_output(bool reset = false) const;
50 :
51 : private:
52 : buffer_t f_output = buffer_t();
53 : };
54 :
55 :
56 :
57 : } // namespace cppprocess
58 : // vim: ts=4 sw=4 et
|