1 //===-- CommandObjectMultiword.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_CommandObjectMultiword_h_
11 #define liblldb_CommandObjectMultiword_h_
17 // Other libraries and framework includes
19 #include "lldb/Interpreter/CommandObject.h"
21 namespace lldb_private {
23 //-------------------------------------------------------------------------
24 // CommandObjectMultiword
25 //-------------------------------------------------------------------------
27 class CommandObjectMultiword : public CommandObject
29 // These two want to iterate over the subcommand dictionary.
30 friend class CommandInterpreter;
31 friend class CommandObjectSyntax;
33 CommandObjectMultiword (CommandInterpreter &interpreter,
35 const char *help = NULL,
36 const char *syntax = NULL,
40 ~CommandObjectMultiword ();
43 IsMultiwordObject () { return true; }
46 LoadSubCommand (const char *cmd_name,
47 const lldb::CommandObjectSP& command_obj);
50 GenerateHelpText (Stream &output_stream);
52 virtual lldb::CommandObjectSP
53 GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
55 virtual CommandObject *
56 GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
59 AproposAllSubCommands (const char *prefix,
60 const char *search_word,
61 StringList &commands_found,
62 StringList &commands_help);
65 WantsRawCommandString() { return false; };
68 HandleCompletion (Args &input,
70 int &cursor_char_position,
71 int match_start_point,
72 int max_return_elements,
76 virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index);
79 Execute (const char *args_string,
80 CommandReturnObject &result);
83 IsRemovable() const { return m_can_be_removed; }
86 SetRemovable (bool removable)
88 m_can_be_removed = removable;
93 CommandObject::CommandMap m_subcommand_dict;
94 bool m_can_be_removed;
98 class CommandObjectProxy : public CommandObject
101 CommandObjectProxy (CommandInterpreter &interpreter,
103 const char *help = NULL,
104 const char *syntax = NULL,
108 ~CommandObjectProxy ();
110 // Subclasses must provide a command object that will be transparently
111 // used for this object.
112 virtual CommandObject *
113 GetProxyCommandObject() = 0;
122 IsMultiwordObject ();
124 virtual lldb::CommandObjectSP
125 GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
127 virtual CommandObject *
128 GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
131 AproposAllSubCommands (const char *prefix,
132 const char *search_word,
133 StringList &commands_found,
134 StringList &commands_help);
137 LoadSubCommand (const char *cmd_name,
138 const lldb::CommandObjectSP& command_obj);
141 WantsRawCommandString();
151 HandleCompletion (Args &input,
153 int &cursor_char_position,
154 int match_start_point,
155 int max_return_elements,
157 StringList &matches);
160 HandleArgumentCompletion (Args &input,
162 int &cursor_char_position,
163 OptionElementVector &opt_element_vector,
164 int match_start_point,
165 int max_return_elements,
167 StringList &matches);
170 GetRepeatCommand (Args ¤t_command_args,
174 Execute (const char *args_string,
175 CommandReturnObject &result);
179 // These two want to iterate over the subcommand dictionary.
180 friend class CommandInterpreter;
181 friend class CommandObjectSyntax;
185 } // namespace lldb_private
187 #endif // liblldb_CommandObjectMultiword_h_