summaryrefslogtreecommitdiff
path: root/indra/llui/llcommandmanager.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-09-23 15:20:25 -0700
committerMerov Linden <merov@lindenlab.com>2011-09-23 15:20:25 -0700
commite42a9ec70c0e5fc98282c98358039445d0d68b84 (patch)
tree555cc9b4023e5eef6e2e019eb392a1267b378de3 /indra/llui/llcommandmanager.cpp
parent1bcf6882c5faa94385f045e1c591da96408bb032 (diff)
parent53a8e1299305a4acad83f52401679c86485fcf51 (diff)
EXP-1207 : pull from viewer-experience-fui
Diffstat (limited to 'indra/llui/llcommandmanager.cpp')
-rw-r--r--indra/llui/llcommandmanager.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp
index 306b357d6a..6be616b980 100644
--- a/indra/llui/llcommandmanager.cpp
+++ b/indra/llui/llcommandmanager.cpp
@@ -72,9 +72,15 @@ LLCommandManager::LLCommandManager()
LLCommandManager::~LLCommandManager()
{
+ for (CommandVector::iterator cmdIt = mCommands.begin(); cmdIt != mCommands.end(); ++cmdIt)
+ {
+ LLCommand * command = *cmdIt;
+
+ delete command;
+ }
}
-U32 LLCommandManager::count() const
+U32 LLCommandManager::commandCount() const
{
return mCommands.size();
}
@@ -88,20 +94,24 @@ LLCommand * LLCommandManager::getCommand(const std::string& commandName)
{
LLCommand * command_name_match = NULL;
- for (CommandVector::iterator it = mCommands.begin(); it != mCommands.end(); ++it)
+ CommandIndexMap::const_iterator found = mCommandIndices.find(commandName);
+
+ if (found != mCommandIndices.end())
{
- LLCommand * command = *it;
-
- if (command->name() == commandName)
- {
- command_name_match = command;
- break;
- }
+ command_name_match = mCommands[found->second];
}
return command_name_match;
}
+void LLCommandManager::addCommand(LLCommand * command)
+{
+ mCommandIndices[command->name()] = mCommands.size();
+ mCommands.push_back(command);
+
+ llinfos << "Successfully added command: " << command->name() << llendl;
+}
+
//static
bool LLCommandManager::load()
{
@@ -129,9 +139,7 @@ bool LLCommandManager::load()
{
LLCommand * command = new LLCommand(commandParams);
- mgr.mCommands.push_back(command);
-
- llinfos << "Successfully loaded command: " << command->name() << llendl;
+ mgr.addCommand(command);
}
return true;