// hint to the help system that one cannot pass options to this command
virtual bool IsDashDashCommand() { return false; }
- virtual lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) {
return lldb::CommandObjectSP();
}
- virtual CommandObject *GetSubcommandObject(const char *sub_cmd,
+ virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) {
return nullptr;
}
- virtual void AproposAllSubCommands(const char *prefix,
- const char *search_word,
+ virtual void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {}
// transparently try and load subcommands - it will fail on
// anything but a multiword command, but it avoids us doing
// type checkings and casts
- virtual bool LoadSubCommand(const char *cmd_name,
+ virtual bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) {
return false;
}
return 0;
}
- bool HelpTextContainsWord(const char *search_word,
+ bool HelpTextContainsWord(llvm::StringRef search_word,
bool search_short_help = true,
bool search_long_help = true,
bool search_syntax = true,
CommandObjectMultiword *GetAsMultiwordCommand() override { return this; }
- bool LoadSubCommand(const char *cmd_name,
+ bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) override;
void GenerateHelpText(Stream &output_stream) override;
- lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- CommandObject *GetSubcommandObject(const char *sub_cmd,
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- void AproposAllSubCommands(const char *prefix, const char *search_word,
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) override;
void GenerateHelpText(Stream &result) override;
- lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- CommandObject *GetSubcommandObject(const char *sub_cmd,
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- void AproposAllSubCommands(const char *prefix, const char *search_word,
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) override;
- bool LoadSubCommand(const char *cmd_name,
+ bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) override;
bool WantsRawCommandString() override;
CommandObjectMultiword::~CommandObjectMultiword() = default;
-CommandObjectSP CommandObjectMultiword::GetSubcommandSP(const char *sub_cmd,
+CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches) {
CommandObjectSP return_cmd_sp;
CommandObject::CommandMap::iterator pos;
}
CommandObject *
-CommandObjectMultiword::GetSubcommandObject(const char *sub_cmd,
+CommandObjectMultiword::GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches) {
return GetSubcommandSP(sub_cmd, matches).get();
}
-bool CommandObjectMultiword::LoadSubCommand(const char *name,
+bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef name,
const CommandObjectSP &cmd_obj) {
if (cmd_obj)
assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) &&
return sub_command_object->GetRepeatCommand(current_command_args, index);
}
-void CommandObjectMultiword::AproposAllSubCommands(const char *prefix,
- const char *search_word,
+void CommandObjectMultiword::AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {
CommandObject::CommandMap::const_iterator pos;
}
if (sub_cmd_obj->IsMultiwordObject())
- sub_cmd_obj->AproposAllSubCommands(complete_command_name.GetData(),
+ sub_cmd_obj->AproposAllSubCommands(complete_command_name.GetString(),
search_word, commands_found,
commands_help);
}
return proxy_command->GenerateHelpText(result);
}
-lldb::CommandObjectSP CommandObjectProxy::GetSubcommandSP(const char *sub_cmd,
- StringList *matches) {
+lldb::CommandObjectSP
+CommandObjectProxy::GetSubcommandSP(llvm::StringRef sub_cmd,
+ StringList *matches) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetSubcommandSP(sub_cmd, matches);
return lldb::CommandObjectSP();
}
-CommandObject *CommandObjectProxy::GetSubcommandObject(const char *sub_cmd,
+CommandObject *CommandObjectProxy::GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return nullptr;
}
-void CommandObjectProxy::AproposAllSubCommands(const char *prefix,
- const char *search_word,
+void CommandObjectProxy::AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {
CommandObject *proxy_command = GetProxyCommandObject();
}
bool CommandObjectProxy::LoadSubCommand(
- const char *cmd_name, const lldb::CommandObjectSP &command_sp) {
+ llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_sp) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->LoadSubCommand(cmd_name, command_sp);
}
}
-bool CommandObject::HelpTextContainsWord(const char *search_word,
+bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
bool search_short_help,
bool search_long_help,
bool search_syntax,
GetOptions()->GenerateOptionUsage(
usage_help, this,
GetCommandInterpreter().GetDebugger().GetTerminalWidth());
- if (usage_help.GetSize() > 0) {
- const char *usage_text = usage_help.GetData();
- if (strcasestr(usage_text, search_word))
+ if (!usage_help.Empty()) {
+ llvm::StringRef usage_text = usage_help.GetString();
+ if (usage_text.contains_lower(search_word))
found_word = true;
}
}