本文整理汇总了C++中StringList::DeleteStringAtIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::DeleteStringAtIndex方法的具体用法?C++ StringList::DeleteStringAtIndex怎么用?C++ StringList::DeleteStringAtIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::DeleteStringAtIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCompletion
int CommandObjectMultiword::HandleCompletion(Args &input, int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches) {
// Any of the command matches will provide a complete word, otherwise the
// individual
// completers will override this.
word_complete = true;
const char *arg0 = input.GetArgumentAtIndex(0);
if (cursor_index == 0) {
AddNamesMatchingPartialString(m_subcommand_dict, arg0, matches);
if (matches.GetSize() == 1 && matches.GetStringAtIndex(0) != nullptr &&
strcmp(arg0, matches.GetStringAtIndex(0)) == 0) {
StringList temp_matches;
CommandObject *cmd_obj = GetSubcommandObject(arg0, &temp_matches);
if (cmd_obj != nullptr) {
if (input.GetArgumentCount() == 1) {
word_complete = true;
} else {
matches.DeleteStringAtIndex(0);
input.Shift();
cursor_char_position = 0;
input.AppendArgument("");
return cmd_obj->HandleCompletion(
input, cursor_index, cursor_char_position, match_start_point,
max_return_elements, word_complete, matches);
}
}
}
return matches.GetSize();
} else {
CommandObject *sub_command_object = GetSubcommandObject(arg0, &matches);
if (sub_command_object == nullptr) {
return matches.GetSize();
} else {
// Remove the one match that we got from calling GetSubcommandObject.
matches.DeleteStringAtIndex(0);
input.Shift();
cursor_index--;
return sub_command_object->HandleCompletion(
input, cursor_index, cursor_char_position, match_start_point,
max_return_elements, word_complete, matches);
}
}
}
示例2: if
int
CommandInterpreter::HandleCompletionMatches (Args &parsed_line,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches)
{
int num_command_matches = 0;
bool look_for_subcommand = false;
// For any of the command completions a unique match will be a complete word.
word_complete = true;
if (cursor_index == -1)
{
// We got nothing on the command line, so return the list of commands
bool include_aliases = true;
num_command_matches = GetCommandNamesMatchingPartialString ("", include_aliases, matches);
}
else if (cursor_index == 0)
{
// The cursor is in the first argument, so just do a lookup in the dictionary.
CommandObject *cmd_obj = GetCommandObject (parsed_line.GetArgumentAtIndex(0), &matches);
num_command_matches = matches.GetSize();
if (num_command_matches == 1
&& cmd_obj && cmd_obj->IsMultiwordObject()
&& matches.GetStringAtIndex(0) != NULL
&& strcmp (parsed_line.GetArgumentAtIndex(0), matches.GetStringAtIndex(0)) == 0)
{
look_for_subcommand = true;
num_command_matches = 0;
matches.DeleteStringAtIndex(0);
parsed_line.AppendArgument ("");
cursor_index++;
cursor_char_position = 0;
}
}
if (cursor_index > 0 || look_for_subcommand)
{
// We are completing further on into a commands arguments, so find the command and tell it
// to complete the command.
// First see if there is a matching initial command:
CommandObject *command_object = GetCommandObject (parsed_line.GetArgumentAtIndex(0));
if (command_object == NULL)
{
return 0;
}
else
{
parsed_line.Shift();
cursor_index--;
num_command_matches = command_object->HandleCompletion (*this,
parsed_line,
cursor_index,
cursor_char_position,
match_start_point,
max_return_elements,
word_complete,
matches);
}
}
return num_command_matches;
}