Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 25, 2010, 7:07:08 PM (14 years ago)
Author:
landauf
Message:

removed old console command implementation (doesn't compile)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/Identifier.cc

    r7204 r7216  
    4040#include "ClassFactory.h"
    4141#include "XMLPort.h"
    42 #include "command/ConsoleCommand.h"
    4342
    4443namespace orxonox
     
    6463
    6564        this->bHasConfigValues_ = false;
    66         this->bHasConsoleCommands_ = false;
    6765
    6866        // Default network ID is the class ID
     
    8078            delete this->factory_;
    8179
    82         for (std::map<std::string, ConsoleCommand*>::iterator it = this->consoleCommands_.begin(); it != this->consoleCommands_.end(); ++it)
    83             delete (it->second);
    8480        for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    8581            delete (it->second);
     
    433429
    434430    /**
    435         @brief Adds a new console command of this class.
    436         @param executor The executor of the command
    437         @param bCreateShortcut If this is true a shortcut gets created so you don't have to add the classname to access this command
    438         @return The executor of the command
    439     */
    440     ConsoleCommand& Identifier::addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut)
    441     {
    442         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(command->getName());
    443         if (it != this->consoleCommands_.end())
    444         {
    445             COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << '.' << std::endl;
    446             delete (it->second);
    447         }
    448 
    449         this->bHasConsoleCommands_ = true;
    450         this->consoleCommands_[command->getName()] = command;
    451         this->consoleCommands_LC_[getLowercase(command->getName())] = command;
    452 
    453         if (bCreateShortcut)
    454             CommandExecutor::addConsoleCommandShortcut(command);
    455 
    456         return (*command);
    457     }
    458 
    459     /**
    460         @brief Returns the executor of a console command with given name.
    461         @brief name The name of the requested console command
    462         @return The executor of the requested console command
    463     */
    464     ConsoleCommand* Identifier::getConsoleCommand(const std::string& name) const
    465     {
    466         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(name);
    467         if (it != this->consoleCommands_.end())
    468             return it->second;
    469         else
    470             return 0;
    471     }
    472 
    473     /**
    474         @brief Returns the executor of a console command with given name in lowercase.
    475         @brief name The name of the requested console command in lowercae
    476         @return The executor of the requested console command
    477     */
    478     ConsoleCommand* Identifier::getLowercaseConsoleCommand(const std::string& name) const
    479     {
    480         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_LC_.find(name);
    481         if (it != this->consoleCommands_LC_.end())
    482             return it->second;
    483         else
    484             return 0;
    485     }
    486 
    487     /**
    488431        @brief Returns a XMLPortParamContainer that loads a parameter of this class.
    489432        @param paramname The name of the parameter
Note: See TracChangeset for help on using the changeset viewer.