Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2008, 1:18:18 AM (16 years ago)
Author:
landauf
Message:

changed large parts of CommandExecutor and CommandEvaluation. very unfinished.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/core/CommandEvaluation.h

    r1341 r1351  
    4444        CS_Uninitialized,
    4545        CS_Empty,
    46         CS_FunctionClass_Or_Shortcut_Or_Keyword,
     46        CS_FunctionClass_Or_Shortcut,
    4747        CS_Shortcut_Params,
    4848        CS_Shortcut_Finished,
     
    5050        CS_Function_Params,
    5151        CS_Function_Finished,
    52         CS_ConfigValueClass,
    53         CS_ConfigValue,
    54         CS_ConfigValueType,
    55         CS_ConfigValueFinished,
    56         CS_KeybindKey,
    57         CS_KeybindCommand,
    58         CS_KeybindFinished,
    5952        CS_Error
    6053    };
    6154
    62     enum KeybindMode {}; // temporary
    63 
    6455    class _CoreExport CommandEvaluation
    6556    {
    66         friend class CommandExecutor;
    67 
    6857        public:
    6958            CommandEvaluation();
    7059
    71             KeybindMode getKeybindMode();
     60            void initialize(const std::string& command);
     61
     62            void execute() const;
     63            std::string complete() const;
     64            std::string hint() const;
     65            void evaluateParams();
     66
    7267            bool isValid() const;
     68
     69            inline Identifier* getIdentifier() const
     70                { return this->functionclass_; }
     71            inline void setIdentifier(Identifier* identifier)
     72                { this->functionclass_ = identifier; }
     73            inline ConsoleCommand* getFunction() const
     74                { return this->function_; }
     75            inline void setFunction(ConsoleCommand* command)
     76                { this->function_ = command; }
     77
     78            inline const std::string& getOriginalCommand() const
     79                { return this->originalCommand_; }
     80            inline const std::string& getCommand() const
     81                { return this->command_; }
     82            inline void setCommand(const std::string& command)
     83                { this->command_ = command; }
     84            inline const CommandState& getState() const
     85                { return this->state_; }
     86            inline void setState(CommandState state)
     87                { this->state_ = state; }
     88            inline SubString& getOriginalTokens()
     89                { return this->originalCommandTokens_; }
     90            inline SubString& getTokens()
     91                { return this->commandTokens_; }
     92            inline void setTokens(const std::string& command)
     93                { this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0'); }
     94            inline const std::string& getError() const
     95                { return this->errorMessage_; }
     96            inline void setError(const std::string& error)
     97                { this->errorMessage_ = error; }
     98            inline bool isNewCommand() const
     99                { return this->bNewCommand_; }
     100            inline void setNewCommand(bool bNewCommand)
     101                { this->bNewCommand_ = bNewCommand; }
     102
     103            inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctionClasses()
     104                { return this->listOfPossibleFunctionClasses_; }
     105            inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctions()
     106                { return this->listOfPossibleFunctions_; }
    73107
    74108            inline void setAdditionalParameter(const std::string& param)
     
    80114            MultiTypeMath getEvaluatedParameter(unsigned int index) const;
    81115
    82             void evaluateParams();
    83 
    84116            bool hasReturnvalue() const;
    85117            MultiTypeMath getReturnvalue() const;
    86118
    87119        private:
    88             std::string processedCommand_;
    89             SubString tokens_;
     120            unsigned int getStartindex() const;
     121            static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list);
     122            static std::string dump(const std::list<std::pair<const std::string*, const std::string*> >& list);
     123            static std::string dump(const ConsoleCommand* command);
     124
     125
     126            bool bNewCommand_;
     127
     128            std::string originalCommand_;
     129            std::string command_;
     130            SubString originalCommandTokens_;
     131            SubString commandTokens_;
    90132            std::string additionalParameter_;
    91133
    92134            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctionClasses_;
    93             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleShortcuts_;
    94135            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_;
    95             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValueClasses_;
    96             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValues_;
    97             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleKeys_;
    98136
    99137            Identifier* functionclass_;
    100             Identifier* configvalueclass_;
    101             ConsoleCommand* shortcut_;
    102138            ConsoleCommand* function_;
    103             ConfigValueContainer* configvalue_;
    104             ConfigValueContainer* key_;
    105139
    106140            std::string errorMessage_;
     
    109143            bool bEvaluatedParams_;
    110144            MultiTypeMath param_[5];
    111             ConsoleCommand* evaluatedExecutor_;
    112145    };
    113146}
Note: See TracChangeset for help on using the changeset viewer.