| 83 | |
| 84 | |
| 85 | int CCommandTree::FindCommandId(const wxString& command, wxString& args, wxString& cmdstr) const |
| 86 | { |
| 87 | wxString cmd = command.BeforeFirst(' ').Lower(); |
| 88 | for (CmdPosConst_t it = m_subcommands.begin(); it != m_subcommands.end(); ++it) { |
| 89 | if ((*it)->m_command.Lower() == cmd) { |
| 90 | args = command.AfterFirst(' ').Trim(false); |
| 91 | return (*it)->FindCommandId(args, args, cmdstr); |
| 92 | } |
| 93 | } |
| 94 | cmdstr = GetFullCommand().Lower(); |
| 95 | if (m_params == CMD_PARAM_ALWAYS && args.IsEmpty()) { |
| 96 | return CMD_ERR_MUST_HAVE_PARAM; |
| 97 | } else if (m_params == CMD_PARAM_NEVER && !args.IsEmpty()) { |
| 98 | return CMD_ERR_NO_PARAM; |
| 99 | } else { |
| 100 | if ((m_cmd_id >= 0) && (m_cmd_id & CMD_DEPRECATED)) { |
| 101 | m_app->Show('\n' + m_verbose + '\n'); |
| 102 | return m_cmd_id & ~CMD_DEPRECATED; |
| 103 | } else { |
| 104 | return m_cmd_id; |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | |
| 110 | wxString CCommandTree::GetFullCommand() const |
no test coverage detected