Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2009, 2:47:14 PM (15 years ago)
Author:
rgrieder
Message:

Changed Output concept a little bit to allow for more general use.
Every output (log) target has to be implemented as OutputListener. There is already a LogFileWriter and a MemoryLogWriter (stores ALL the log in a vector and provides iterators).
The OutputListener has a unique and constant name, a stream pointer and a soft debug level (that can only be changed via OutputHandler::setSoftDebugLevel(name, level)).
This concept doesn't require the OutputBuffer anymore, so I deleted it.

The adjustments in the Shell are just preliminary for this commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/libraries/core/IOConsole.cc

    r5986 r5994  
    6262        this->originalTerminalSettings_ = new termios;
    6363        this->setTerminalMode();
    64                 this->shell_.registerListener(this);
     64        this->shell_.registerListener(this);
    6565    }
    6666
     
    234234    }
    235235
     236#elif defined(ORXONOX_PLATFORM_WINDOWS)
     237
     238    IOConsole::IOConsole()
     239        : shell_(Shell::getInstance())
     240        , buffer_(Shell::getInstance().getInputBuffer())
     241    {
     242        this->setTerminalMode();
     243    }
     244
     245    IOConsole::~IOConsole()
     246    {
     247    }
     248
     249    void IOConsole::setTerminalMode()
     250    {
     251    }
     252
     253    void IOConsole::resetTerminalMode()
     254    {
     255    }
     256
     257    void IOConsole::update(const Clock& time)
     258    {
     259    }
     260
     261    void IOConsole::print(const std::string& text)
     262    {
     263    }
     264
     265    void IOConsole::printInputLine()
     266    {
     267    }
     268
    236269#endif /* ORXONOX_PLATFORM_UNIX */
    237270
     
    256289    void IOConsole::onlyLastLineChanged()
    257290    {
    258                 // Save cursor position and move it the beginning of the second to last line
    259                 std::cout << "\033[s\033[1F";
    260                 // Erase the second to last line
    261                 std::cout << "\033[K";
    262                 this->print(*(this->shell_.getNewestLineIterator()));
    263                 // Restore cursor
    264                 std::cout << "\033[u";
    265                 std::cout.flush();
     291        // Save cursor position and move it the beginning of the second to last line
     292        std::cout << "\033[s\033[1F";
     293        // Erase the second to last line
     294        std::cout << "\033[K";
     295        this->print(*(this->shell_.getNewestLineIterator()));
     296        // Restore cursor
     297        std::cout << "\033[u";
     298        std::cout.flush();
    266299    }
    267300
     
    272305    void IOConsole::lineAdded()
    273306    {
    274                 // Move curosr the beginning of the line and erase it
    275                 std::cout << "\033[1G\033[K";
    276                 this->print(*(this->shell_.getNewestLineIterator()));
    277                 std::cout << std::endl;
    278                 this->printInputLine();
     307        // Move curosr the beginning of the line and erase it
     308        std::cout << "\033[1G\033[K";
     309        this->print(*(this->shell_.getNewestLineIterator()));
     310        std::cout << std::endl;
     311        this->printInputLine();
    279312    }
    280313
     
    303336    void IOConsole::executed()
    304337    {
    305                 // Move curosr the beginning of the line
    306                 std::cout << "\033[1G";
    307         // Print command so the user knows what he typed
     338        // Move cursor the beginning of the line
     339        std::cout << "\033[1G";
     340        // Print command so the user knows what he has typed
    308341        std::cout << "orxonox>" << this->shell_.getInput() << std::endl;
    309                 this->printInputLine();
     342        this->printInputLine();
    310343    }
    311344
Note: See TracChangeset for help on using the changeset viewer.