Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/IOConsolePOSIX.cc

    r9667 r11071  
    4444namespace orxonox
    4545{
    46     IOConsole* IOConsole::singletonPtr_s = NULL;
    47 
    48     namespace EscapeMode
    49     {
    50         enum Value
    51         {
    52             None,
    53             First,
    54             Second
    55         };
    56     }
     46    IOConsole* IOConsole::singletonPtr_s = nullptr;
     47
     48    enum class EscapeMode
     49    {
     50        None,
     51        First,
     52        Second
     53    };
    5754
    5855    IOConsole::IOConsole()
     
    6259        , promptString_("orxonox # ")
    6360        , bStatusPrinted_(false)
    64         , originalTerminalSettings_(0)
     61        , originalTerminalSettings_(nullptr)
    6562    {
    6663        this->setTerminalMode();
     
    9087        std::cout.flush();
    9188        if (!this->origCout_.str().empty())
    92             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     89            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    9390        // Erase input and status lines
    9491        this->cout_ << "\033[1G\033[J";
     
    111108        unsigned char c;
    112109        std::string escapeSequence;
    113         EscapeMode::Value escapeMode = EscapeMode::None;
     110        EscapeMode escapeMode = EscapeMode::None;
    114111        while (std::cin.good())
    115112        {
     
    231228        if (!this->origCout_.str().empty())
    232229        {
    233             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     230            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    234231            this->origCout_.str("");
    235232        }
     
    241238        switch (type)
    242239        {
    243             case Shell::Message:
    244             case Shell::DebugOutput:     this->cout_ << "\033[0m"; break;
    245 
    246             case Shell::UserError:       this->cout_ << "\033[91m"; break;
    247             case Shell::UserWarning:     this->cout_ << "\033[93m"; break;
    248             case Shell::UserStatus:      this->cout_ << "\033[92m"; break;
    249             case Shell::UserInfo:        this->cout_ << "\033[96m"; break;
    250 
    251             case Shell::InternalError:   this->cout_ << "\033[31m"; break;
    252             case Shell::InternalWarning: this->cout_ << "\033[33m"; break;
    253             case Shell::InternalStatus:  this->cout_ << "\033[32m"; break;
    254             case Shell::InternalInfo:    this->cout_ << "\033[36m"; break;
    255 
    256             case Shell::Verbose:         this->cout_ << "\033[94m"; break;
    257             case Shell::VerboseMore:     this->cout_ << "\033[34m"; break;
    258             case Shell::VerboseUltra:    this->cout_ << "\033[34m"; break;
    259 
    260             case Shell::Command:         this->cout_ << "\033[95m"; break;
    261             case Shell::Hint:            this->cout_ << "\033[35m"; break;
    262 
    263             default:                     this->cout_ << "\033[37m"; break;
     240            case Shell::LineType::Message:
     241            case Shell::LineType::DebugOutput:     this->cout_ << "\033[0m"; break;
     242
     243            case Shell::LineType::UserError:       this->cout_ << "\033[91m"; break;
     244            case Shell::LineType::UserWarning:     this->cout_ << "\033[93m"; break;
     245            case Shell::LineType::UserStatus:      this->cout_ << "\033[92m"; break;
     246            case Shell::LineType::UserInfo:        this->cout_ << "\033[96m"; break;
     247
     248            case Shell::LineType::InternalError:   this->cout_ << "\033[31m"; break;
     249            case Shell::LineType::InternalWarning: this->cout_ << "\033[33m"; break;
     250            case Shell::LineType::InternalStatus:  this->cout_ << "\033[32m"; break;
     251            case Shell::LineType::InternalInfo:    this->cout_ << "\033[36m"; break;
     252
     253            case Shell::LineType::Verbose:         this->cout_ << "\033[94m"; break;
     254            case Shell::LineType::VerboseMore:     this->cout_ << "\033[34m"; break;
     255            case Shell::LineType::VerboseUltra:    this->cout_ << "\033[34m"; break;
     256
     257            case Shell::LineType::Command:         this->cout_ << "\033[95m"; break;
     258            case Shell::LineType::Hint:            this->cout_ << "\033[35m"; break;
     259
     260            default:                               this->cout_ << "\033[37m"; break;
    264261        }
    265262
     
    326323            tcsetattr(0, TCSANOW, IOConsole::singletonPtr_s->originalTerminalSettings_);
    327324            delete IOConsole::singletonPtr_s->originalTerminalSettings_;
    328             IOConsole::singletonPtr_s->originalTerminalSettings_ = 0;
     325            IOConsole::singletonPtr_s->originalTerminalSettings_ = nullptr;
    329326        }
    330327    }
     
    353350        const char* s;
    354351        if (!this->terminalWidth_ && (s = getenv("COLUMNS")))
    355             this->terminalWidth_  = strtol(s, NULL, 10);
     352            this->terminalWidth_  = strtol(s, nullptr, 10);
    356353        if (!this->terminalWidth_)
    357354            this->terminalWidth_ = 80;
    358355        if (!this->terminalHeight_ && (s = getenv("LINES")))
    359             this->terminalHeight_ = strtol(s, NULL, 10);
     356            this->terminalHeight_ = strtol(s, nullptr, 10);
    360357        if (!this->terminalHeight_)
    361358            this->terminalHeight_ = 24;
     
    384381    void IOConsole::executed()
    385382    {
    386         this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     383        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command);
    387384    }
    388385
Note: See TracChangeset for help on using the changeset viewer.