4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief LineEditor public header */
26 #ifndef HH_SENF_Utils_Console_LineEditor_
27 #define HH_SENF_Utils_Console_LineEditor_ 1
30 #include <boost/scoped_ptr.hpp>
31 #include "../Termlib/TelnetTerminal.hh"
32 #include "../Termlib/Editor.hh"
35 //#include "LineEditor.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
42 class LineEditorSwitcher
46 explicit LineEditorSwitcher(Client & client);
48 void editorSetupFailed();
51 virtual void v_disablePrompt();
52 virtual void v_enablePrompt();
53 virtual void v_write(std::string const & data);
55 boost::scoped_ptr<ClientReader> reader_;
58 class LineEditorClientReader
59 : public ClientReader, public term::TelnetTerminal
62 explicit LineEditorClientReader(Client & client, LineEditorSwitcher & switcher);
65 // TelnetTerminal API implementation
66 virtual void v_setupFailed();
69 // ClientReader API implementation
70 virtual void v_disablePrompt();
71 virtual void v_enablePrompt();
72 virtual void v_write(std::string const & data);
75 void executeLine(std::string const & text);
76 void deleteCharOrExit(term::LineEditor & editor);
78 term::LineEditor editor_;
79 LineEditorSwitcher * switcher_;
84 ///////////////////////////////hh.e////////////////////////////////////////
85 //#include "LineEditor.cci"
86 //#include "LineEditor.ct"
87 //#include "LineEditor.cti"
95 // c-file-style: "senf"
96 // indent-tabs-mode: nil
97 // ispell-local-dictionary: "american"
98 // compile-command: "scons -u test"