Line data Source code
1 : // Copyright (c) 2012-2019 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // This program is free software; you can redistribute it and/or modify
4 : // it under the terms of the GNU General Public License as published by
5 : // the Free Software Foundation; either version 2 of the License, or
6 : // (at your option) any later version.
7 : //
8 : // This program 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
11 : // GNU General Public License for more details.
12 : //
13 : // You should have received a copy of the GNU General Public License
14 : // along with this program; if not, write to the Free Software
15 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 : #pragma once
17 :
18 : // self
19 : //
20 : #include "eventdispatcher/tcp_server_client_connection.h"
21 :
22 :
23 :
24 : namespace ed
25 : {
26 :
27 :
28 :
29 0 : class tcp_server_client_buffer_connection
30 : : public tcp_server_client_connection
31 : {
32 : public:
33 : typedef std::shared_ptr<tcp_server_client_buffer_connection> pointer_t;
34 :
35 : tcp_server_client_buffer_connection(tcp_bio_client::pointer_t client);
36 :
37 : bool has_input() const;
38 : bool has_output() const;
39 :
40 : // connection implementation
41 : virtual bool is_writer() const override;
42 :
43 : // tcp_server_client_connection implementation
44 : virtual ssize_t write(void const * data, size_t const length) override;
45 : virtual void process_read() override;
46 : virtual void process_write() override;
47 : virtual void process_hup() override;
48 :
49 : // new callback
50 : virtual void process_line(std::string const & line) = 0;
51 :
52 : private:
53 : std::string f_line = std::string();
54 : std::vector<char> f_output = std::vector<char>();
55 : size_t f_position = 0;
56 : };
57 :
58 :
59 :
60 : } // namespace ed
61 : // vim: ts=4 sw=4 et
|