Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/IOConsole.h @ 6121

Last change on this file since 6121 was 6105, checked in by rgrieder, 15 years ago

Merged console branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.8 KB
RevLine 
[5971]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:
[5968]23 *      Oliver Scheuss
24 *      Reto Grieder
[5971]25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _IOConsole_H__
31#define _IOConsole_H__
32
33#include "CorePrereqs.h"
34
[6037]35#include <sstream>
[6015]36#include <string>
37#include <vector>
[5971]38#include "util/Singleton.h"
39#include "core/Shell.h"
40
[6015]41#ifdef ORXONOX_PLATFORM_UNIX
[5971]42struct termios;
[6015]43#endif
[5971]44
45namespace orxonox
46{
47    class _CoreExport IOConsole : public Singleton<IOConsole>, public ShellListener
48    {
49        friend class Singleton<IOConsole>;
50
51    public:
52        IOConsole();
53        ~IOConsole();
54
55        void update(const Clock& time);
56
57    private:
58        void setTerminalMode();
[6007]59        void resetTerminalMode();
[6013]60        void getTerminalSize();
61        bool willPrintStatusLines();
[6015]62        int extractLogLevel(std::string* text);
[5971]63
[5998]64        void printLogText(const std::string& line);
[5971]65        void printInputLine();
[5995]66        void printStatusLines();
[5971]67
68        // Methods from ShellListener
69        void linesChanged();
70        void onlyLastLineChanged();
71        void lineAdded();
72        void inputChanged();
73        void cursorChanged();
[5983]74        void executed();
[5971]75        void exit();
[6004]76        Shell*                  shell_;
[5971]77        InputBuffer*            buffer_;
[6037]78        std::ostream            cout_;
79        std::ostringstream      origCout_;
[6013]80        unsigned int            terminalWidth_;
81        unsigned int            terminalHeight_;
[6014]82        unsigned int            lastTerminalWidth_;
83        unsigned int            lastTerminalHeight_;
[5995]84        bool                    bPrintStatusLine_;
85        bool                    bStatusPrinted_;
86        std::vector<unsigned>   statusLineWidths_;
[6004]87        unsigned int            statusLineMaxWidth_;
[6010]88        const std::string       promptString_;
[6004]89        static const unsigned   minOutputLines_ = 3;
[5971]90
[6015]91#ifdef ORXONOX_PLATFORM_UNIX
92        termios*                originalTerminalSettings_;
93#endif
94
[5971]95        static IOConsole* singletonPtr_s;
96    };
97}
98
99#endif /* _IOConsole_H__ */
Note: See TracBrowser for help on using the repository browser.