llvm::StringRef help = llvm::StringRef(),
llvm::StringRef syntax = llvm::StringRef(), uint32_t flags = 0);
- void GetAliasExpansion(StreamString &help_string);
+ void GetAliasExpansion(StreamString &help_string) const;
- bool IsValid() { return m_underlying_command_sp && m_option_args_sp; }
+ bool IsValid() const { return m_underlying_command_sp && m_option_args_sp; }
- explicit operator bool() { return IsValid(); }
+ explicit operator bool() const { return IsValid(); }
bool WantsRawCommandString() override;
lldb::CommandObjectSP GetUnderlyingCommand() {
return m_underlying_command_sp;
}
- OptionArgVectorSP GetOptionArguments() { return m_option_args_sp; }
+ OptionArgVectorSP GetOptionArguments() const { return m_option_args_sp; }
const char *GetOptionString() { return m_option_string.c_str(); }
// this takes an alias - potentially nested (i.e. an alias to an alias)
bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
bool can_replace);
- bool AddCommand(const char *, const lldb::CommandObjectSP &, bool) = delete;
- bool AddUserCommand(std::string name, const lldb::CommandObjectSP &cmd_sp,
+ bool AddUserCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
bool can_replace);
lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd,
CommandObject *GetCommandObject(llvm::StringRef cmd,
StringList *matches = nullptr) const;
- bool CommandExists(const char *cmd);
+ bool CommandExists(llvm::StringRef cmd) const;
- bool AliasExists(const char *cmd);
+ bool AliasExists(llvm::StringRef cmd) const;
- bool UserCommandExists(const char *cmd);
+ bool UserCommandExists(llvm::StringRef cmd) const;
- CommandAlias *AddAlias(const char *alias_name,
+ CommandAlias *AddAlias(llvm::StringRef alias_name,
lldb::CommandObjectSP &command_obj_sp,
- const char *args_string = nullptr);
+ llvm::StringRef args_string = llvm::StringRef());
// Remove a command if it is removable (python or regex command)
- bool RemoveCommand(const char *cmd);
+ bool RemoveCommand(llvm::StringRef cmd);
- bool RemoveAlias(const char *alias_name);
+ bool RemoveAlias(llvm::StringRef alias_name);
- bool GetAliasFullName(const char *cmd, std::string &full_name);
+ bool GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const;
- bool RemoveUser(const char *alias_name);
+ bool RemoveUser(llvm::StringRef alias_name);
void RemoveAllUser() { m_user_dict.clear(); }
- CommandAlias *GetAlias(const char *alias_name);
+ const CommandAlias *GetAlias(llvm::StringRef alias_name) const;
- CommandObject *BuildAliasResult(const char *alias_name,
+ CommandObject *BuildAliasResult(llvm::StringRef alias_name,
std::string &raw_input_string,
std::string &alias_result,
CommandReturnObject &result);
return true;
}
-bool CommandInterpreter::AddUserCommand(std::string name,
+bool CommandInterpreter::AddUserCommand(llvm::StringRef name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace) {
if (cmd_sp.get())
"tried to add a CommandObject from a different interpreter");
if (!name.empty()) {
- const char *name_cstr = name.c_str();
-
// do not allow replacement of internal commands
- if (CommandExists(name_cstr)) {
+ if (CommandExists(name)) {
if (can_replace == false)
return false;
if (m_command_dict[name]->IsRemovable() == false)
return false;
}
- if (UserCommandExists(name_cstr)) {
+ if (UserCommandExists(name)) {
if (can_replace == false)
return false;
if (m_user_dict[name]->IsRemovable() == false)
return GetCommandSP(cmd_str, true, false, matches).get();
}
-bool CommandInterpreter::CommandExists(const char *cmd) {
+bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const {
return m_command_dict.find(cmd) != m_command_dict.end();
}
-bool CommandInterpreter::GetAliasFullName(const char *cmd,
- std::string &full_name) {
+bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd,
+ std::string &full_name) const {
bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end());
if (exact_match) {
full_name.assign(cmd);
}
}
-bool CommandInterpreter::AliasExists(const char *cmd) {
+bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const {
return m_alias_dict.find(cmd) != m_alias_dict.end();
}
-bool CommandInterpreter::UserCommandExists(const char *cmd) {
+bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const {
return m_user_dict.find(cmd) != m_user_dict.end();
}
CommandAlias *
-CommandInterpreter::AddAlias(const char *alias_name,
+CommandInterpreter::AddAlias(llvm::StringRef alias_name,
lldb::CommandObjectSP &command_obj_sp,
- const char *args_string) {
+ llvm::StringRef args_string) {
if (command_obj_sp.get())
assert((this == &command_obj_sp->GetCommandInterpreter()) &&
"tried to add a CommandObject from a different interpreter");
return nullptr;
}
-bool CommandInterpreter::RemoveAlias(const char *alias_name) {
+bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) {
auto pos = m_alias_dict.find(alias_name);
if (pos != m_alias_dict.end()) {
m_alias_dict.erase(pos);
return false;
}
-bool CommandInterpreter::RemoveCommand(const char *cmd) {
+bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) {
auto pos = m_command_dict.find(cmd);
if (pos != m_command_dict.end()) {
if (pos->second->IsRemovable()) {
}
return false;
}
-bool CommandInterpreter::RemoveUser(const char *alias_name) {
+bool CommandInterpreter::RemoveUser(llvm::StringRef alias_name) {
CommandObject::CommandMap::iterator pos = m_user_dict.find(alias_name);
if (pos != m_user_dict.end()) {
m_user_dict.erase(pos);
}
CommandObject *CommandInterpreter::BuildAliasResult(
- const char *alias_name, std::string &raw_input_string,
+ llvm::StringRef alias_name, std::string &raw_input_string,
std::string &alias_result, CommandReturnObject &result) {
CommandObject *alias_cmd_obj = nullptr;
Args cmd_args(raw_input_string);
return confirm->GetResponse();
}
-CommandAlias *CommandInterpreter::GetAlias(const char *alias_name) {
+const CommandAlias *
+CommandInterpreter::GetAlias(llvm::StringRef alias_name) const {
OptionArgVectorSP ret_val;
- std::string alias(alias_name);
-
- auto pos = m_alias_dict.find(alias);
+ auto pos = m_alias_dict.find(alias_name);
if (pos != m_alias_dict.end())
return (CommandAlias *)pos->second.get();