Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 27, 2010, 2:41:03 PM (14 years ago)
Author:
landauf
Message:

re-implemented CommandExecutor and CommandEvaluation. parameter evaluation is currently not implemented, will come soon.

File:
1 edited

Legend:

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

    r7203 r7228  
    3939#include "core/ConfigValueContainer.h"
    4040#include "TclThreadManager.h"
     41#include "ConsoleCommand.h"
    4142
    4243// Boost 1.36 has some issues with deprecated functions that have been omitted
     
    5455        {
    5556            return ArgumentCompletionList();
     57        }
     58
     59        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(groupsandcommands)()
     60        {
     61            ArgumentCompletionList groupList;
     62
     63            const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& commands = _ConsoleCommand::getCommands();
     64            for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
     65                // todo: check if active / not hidden / not denied
     66                groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
     67
     68            std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.find("");
     69            if (it_group != commands.end())
     70            {
     71                groupList.push_back(ArgumentCompletionListElement("\n"));
     72
     73                for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
     74                    // todo: check if active / not hidden / not denied
     75                    groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     76            }
     77
     78            return groupList;
     79        }
     80
     81        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(subcommands)(const std::string& fragment, const std::string& group)
     82        {
     83            ArgumentCompletionList commandList;
     84
     85            std::string groupLC = getLowercase(group);
     86
     87            std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().begin();
     88            for ( ; it_group != _ConsoleCommand::getCommands().end(); ++it_group)
     89                if (getLowercase(it_group->first) == groupLC)
     90                    break;
     91
     92            if (it_group != _ConsoleCommand::getCommands().end())
     93            {
     94                for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
     95                    // todo: check if active / not hidden / not denied
     96                    commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     97            }
     98
     99            return commandList;
    56100        }
    57101
Note: See TracChangeset for help on using the changeset viewer.