Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 6:41:22 PM (9 years ago)
Author:
landauf
Message:

merged remaining commits from cpp11_v2 to cpp11_v3 (for some reason they were not merged in the first attempt)

Location:
code/branches/cpp11_v3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommand.h

    r11054 r11068  
    6060    }
    6161
    62     namespace AccessLevel
     62    /**
     63        @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level.
     64    */
     65    enum class AccessLevel
    6366    {
    64         /**
    65             @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level.
    66         */
    67         enum Enum
    68         {
    69             All,
    70             Standalone,
    71             Master,
    72             Server,
    73             Client,
    74             Online,
    75             Offline,
    76             None
    77         };
    78     }
     67        All,
     68        Standalone,
     69        Master,
     70        Server,
     71        Client,
     72        Online,
     73        Offline,
     74        None
     75    };
    7976
    8077    /**
     
    249246
    250247                    /// Changes the access level of the command.
    251                     inline ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level)
     248                    inline ConsoleCommandManipulator& accessLevel(AccessLevel level)
    252249                        { if (this->command_) { this->command_->accessLevel(level); } return *this; }
    253250
     
    332329
    333330            /// Changes the access level of the command.
    334             inline ConsoleCommand& accessLevel(AccessLevel::Enum level)
     331            inline ConsoleCommand& accessLevel(AccessLevel level)
    335332                { this->accessLevel_ = level; return *this; }
    336333            /// Returns the access level of the command.
    337             inline AccessLevel::Enum getAccessLevel() const
     334            inline AccessLevel getAccessLevel() const
    338335                { return this->accessLevel_; }
    339336
     
    394391            bool bActive_;                                                  ///< True if the command should be active (it can still be inactive, for example if the function is missing)
    395392            bool bHidden_;                                                  ///< True if the command is hidden (it is still executable, but not visible in the list of available commands)
    396             AccessLevel::Enum accessLevel_;                                 ///< The access level (the state of the game in which you can access the command)
     393            AccessLevel accessLevel_;                                       ///< The access level (the state of the game in which you can access the command)
    397394            std::string baseName_;                                          ///< The name that was first assigned to the command
    398395            std::vector<CommandName> names_;                                ///< All names and aliases of this command
  • code/branches/cpp11_v3/src/libraries/core/command/Executor.h

    r11054 r11068  
    147147                { return this->functor_->hasReturnvalue(); }
    148148            /// Returns the type of the wrapped function (static or member).
    149             inline Functor::Type::Enum getType() const
     149            inline Functor::Type getType() const
    150150                { return this->functor_->getType(); }
    151151            /// Returns the name of the type of a parameter with given index (the first parameter has index 0).
  • code/branches/cpp11_v3/src/libraries/core/command/Functor.h

    r11054 r11068  
    176176    {
    177177        public:
    178             struct Type
    179             {
    180                 /// Defines the type of a function (static or member)
    181                 enum Enum
    182                 {
    183                     Static,
    184                     Member
    185                 };
     178            /// Defines the type of a function (static or member)
     179            enum class Type
     180            {
     181                Static,
     182                Member
    186183            };
    187184
     
    196193
    197194            /// Returns the type of the function: static or member.
    198             virtual Type::Enum getType() const = 0;
     195            virtual Type getType() const = 0;
    199196            /// Returns the number of parameters of the function.
    200197            virtual unsigned int getParamCount() const = 0;
     
    262259
    263260            // see Functor::getType()
    264             virtual inline Functor::Type::Enum getType() const override
     261            virtual inline Functor::Type getType() const override
    265262                { return Functor::Type::Member; }
    266263
     
    339336
    340337            // see Functor::getType()
    341             virtual inline Functor::Type::Enum getType() const override
     338            virtual inline Functor::Type getType() const override
    342339                { return Functor::Type::Static; }
    343340
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsolePOSIX.cc

    r11054 r11068  
    4646    IOConsole* IOConsole::singletonPtr_s = nullptr;
    4747
    48     namespace EscapeMode
    49     {
    50         enum Value
    51         {
    52             None,
    53             First,
    54             Second
    55         };
    56     }
     48    enum class EscapeMode
     49    {
     50        None,
     51        First,
     52        Second
     53    };
    5754
    5855    IOConsole::IOConsole()
     
    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
     
    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
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsoleWindows.cc

    r11054 r11068  
    9797        std::cout.flush();
    9898        if (!this->origCout_.str().empty())
    99             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     99            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    100100
    101101        this->shell_->unregisterListener(this);
     
    190190        if (!this->origCout_.str().empty())
    191191        {
    192             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     192            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    193193            this->origCout_.str("");
    194194        }
     
    202202        switch (type)
    203203        {
    204             case Shell::Message:
    205             case Shell::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    206 
    207             case Shell::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
    208             case Shell::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
    209             case Shell::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
    210             case Shell::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    211 
    212             case Shell::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
    213             case Shell::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
    214             case Shell::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
    215             case Shell::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    216 
    217             case Shell::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    218             case Shell::VerboseMore:     colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    219             case Shell::VerboseUltra:    colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    220 
    221             case Shell::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
    222             case Shell::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
    223 
    224             default:                     colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     204            case Shell::LineType::Message:
     205            case Shell::LineType::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     206
     207            case Shell::LineType::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
     208            case Shell::LineType::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     209            case Shell::LineType::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
     210            case Shell::LineType::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     211
     212            case Shell::LineType::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
     213            case Shell::LineType::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     214            case Shell::LineType::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
     215            case Shell::LineType::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     216
     217            case Shell::LineType::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     218            case Shell::LineType::VerboseMore:     colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     219            case Shell::LineType::VerboseUltra:    colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     220
     221            case Shell::LineType::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     222            case Shell::LineType::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     223
     224            default:                               colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    225225        }
    226226
     
    331331    void IOConsole::executed()
    332332    {
    333         this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     333        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command);
    334334    }
    335335
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.cc

    r11054 r11068  
    268268    {
    269269        // yes it was - push the new line to the list
    270         this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));
     270        this->outputLines_.push_front(std::make_pair(line, type));
    271271
    272272        // adjust the scroll position if needed
     
    381381        const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error);
    382382        if (error)
    383             this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", UserError);
     383            this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", LineType::UserError);
    384384        else if (result != "")
    385             this->addOutput(result, Result);
     385            this->addOutput(result, LineType::Result);
    386386
    387387        this->clearInput();
     
    392392    {
    393393        this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete());
    394         this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);
     394        this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), LineType::Hint);
    395395
    396396        this->inputChanged();
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.h

    r11054 r11068  
    8888        public:
    8989            /// Defines the type of a line of text in the Shell - some types depend on the output level, others are of internal use.
    90             enum LineType
     90            enum class LineType
    9191            {
    9292                DebugOutput     = debug_output,
     
    133133            LineList::const_iterator getEndIterator() const;
    134134
    135             void addOutput(const std::string& text, LineType type = DebugOutput);
    136             void addLine(const std::string& line, LineType type = DebugOutput);
     135            void addOutput(const std::string& text, LineType type = LineType::DebugOutput);
     136            void addLine(const std::string& line, LineType type = LineType::DebugOutput);
    137137            void clearOutput();
    138138
Note: See TracChangeset for help on using the changeset viewer.