Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/doc/src/libraries/core/command/IOConsolePOSIX.h @ 7352

Last change on this file since 7352 was 7287, checked in by rgrieder, 14 years ago

Split IOConsole in two separate files for better browsing.

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
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.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oliver Scheuss
24 *      Reto Grieder
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _IOConsole_H__
31#define _IOConsole_H__
32
33#include "core/CorePrereqs.h"
34
35#include <sstream>
36#include <string>
37#include <vector>
38#include "util/Singleton.h"
39#include "Shell.h"
40
41struct termios;
42
43namespace orxonox
44{
45    class _CoreExport IOConsole : public Singleton<IOConsole>, public ShellListener
46    {
47        friend class Singleton<IOConsole>;
48
49    public:
50        IOConsole();
51        ~IOConsole();
52
53        void preUpdate(const Clock& time);
54
55    private:
56        void setTerminalMode();
57        void getTerminalSize();
58        void printStatusLines();
59        static int extractLogLevel(std::string* text);
60
61        // Methods from ShellListener
62        void linesChanged();
63        void onlyLastLineChanged();
64        void lineAdded();
65        void inputChanged();
66        void cursorChanged();
67        void executed();
68        void exit();
69
70        bool willPrintStatusLines();
71        void printInputLine();
72        void printOutputLine(const std::string& line, Shell::LineType type);
73        static void resetTerminalMode();
74
75        Shell*                  shell_;
76        InputBuffer*            buffer_;
77        std::ostream            cout_;
78        std::ostringstream      origCout_;
79        int                     terminalWidth_;
80        int                     terminalHeight_;
81        int                     lastTerminalWidth_;
82        int                     lastTerminalHeight_;
83        const std::string       promptString_;
84
85        bool                    bPrintStatusLine_;
86        bool                    bStatusPrinted_;
87        std::vector<int>        statusLineWidths_;
88        int                     statusLineMaxWidth_;
89        static const int        minOutputLines_ = 3;
90        termios*                originalTerminalSettings_;
91
92        static IOConsole* singletonPtr_s;
93    };
94}
95
96#endif /* _IOConsole_H__ */
Note: See TracBrowser for help on using the repository browser.