| 94 | } |
| 95 | |
| 96 | bool RootConsoleMenu::AddRootConsoleCommand3(const char *cmd, |
| 97 | const char *text, |
| 98 | IRootConsoleCommand *pHandler) |
| 99 | { |
| 100 | if (m_Commands.contains(cmd)) |
| 101 | return false; |
| 102 | |
| 103 | /* Sort this into the menu */ |
| 104 | List<ConsoleEntry *>::iterator iter = m_Menu.begin(); |
| 105 | ConsoleEntry *pEntry; |
| 106 | bool inserted = false; |
| 107 | while (iter != m_Menu.end()) |
| 108 | { |
| 109 | pEntry = (*iter); |
| 110 | if (strcmp(cmd, pEntry->command.c_str()) < 0) |
| 111 | { |
| 112 | ConsoleEntry *pNew = new ConsoleEntry; |
| 113 | pNew->command.assign(cmd); |
| 114 | pNew->description.assign(text); |
| 115 | pNew->cmd = pHandler; |
| 116 | m_Commands.insert(cmd, pNew); |
| 117 | m_Menu.insert(iter, pNew); |
| 118 | inserted = true; |
| 119 | break; |
| 120 | } |
| 121 | iter++; |
| 122 | } |
| 123 | |
| 124 | if (!inserted) |
| 125 | { |
| 126 | ConsoleEntry *pNew = new ConsoleEntry; |
| 127 | pNew->command.assign(cmd); |
| 128 | pNew->description.assign(text); |
| 129 | pNew->cmd = pHandler; |
| 130 | m_Commands.insert(cmd, pNew); |
| 131 | m_Menu.push_back(pNew); |
| 132 | } |
| 133 | |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | bool RootConsoleMenu::RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) |
| 138 | { |
no test coverage detected