]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
Update llvm to trunk r256945.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / CommandObjectMultiword.h
1 //===-- CommandObjectMultiword.h --------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_CommandObjectMultiword_h_
11 #define liblldb_CommandObjectMultiword_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/CommandObject.h"
18
19 namespace lldb_private {
20
21 //-------------------------------------------------------------------------
22 // CommandObjectMultiword
23 //-------------------------------------------------------------------------
24
25 class CommandObjectMultiword : public CommandObject
26 {
27 // These two want to iterate over the subcommand dictionary.
28 friend class CommandInterpreter;
29 friend class CommandObjectSyntax;
30 public:
31     CommandObjectMultiword(CommandInterpreter &interpreter,
32                            const char *name,
33                            const char *help = nullptr,
34                            const char *syntax = nullptr,
35                            uint32_t flags = 0);
36     
37     ~CommandObjectMultiword() override;
38
39     bool
40     IsMultiwordObject() override
41     {
42         return true;
43     }
44
45     bool
46     LoadSubCommand(const char *cmd_name,
47                    const lldb::CommandObjectSP& command_obj) override;
48
49     void
50     GenerateHelpText(Stream &output_stream) override;
51
52     lldb::CommandObjectSP
53     GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
54
55     CommandObject *
56     GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
57
58     void
59     AproposAllSubCommands(const char *prefix,
60                           const char *search_word,
61                           StringList &commands_found,
62                           StringList &commands_help) override;
63
64     bool
65     WantsRawCommandString() override
66     {
67         return false;
68     }
69
70     int
71     HandleCompletion(Args &input,
72                      int &cursor_index,
73                      int &cursor_char_position,
74                      int match_start_point,
75                      int max_return_elements,
76                      bool &word_complete,
77                      StringList &matches) override;
78
79     const char *
80     GetRepeatCommand (Args &current_command_args, uint32_t index) override;
81
82     bool
83     Execute(const char *args_string,
84             CommandReturnObject &result) override;
85     
86     bool
87     IsRemovable() const override
88     {
89         return m_can_be_removed;
90     }
91     
92     void
93     SetRemovable (bool removable)
94     {
95         m_can_be_removed = removable;
96     }
97     
98 protected:
99
100     CommandObject::CommandMap m_subcommand_dict;
101     bool m_can_be_removed;
102 };
103     
104 class CommandObjectProxy : public CommandObject
105 {
106 public:
107     CommandObjectProxy(CommandInterpreter &interpreter,
108                        const char *name,
109                        const char *help = nullptr,
110                        const char *syntax = nullptr,
111                        uint32_t flags = 0);
112     
113     ~CommandObjectProxy() override;
114     
115     // Subclasses must provide a command object that will be transparently
116     // used for this object.
117     virtual CommandObject *
118     GetProxyCommandObject() = 0;
119
120     const char *
121     GetHelpLong() override;
122     
123     bool
124     IsRemovable() const override;
125
126     bool
127     IsMultiwordObject() override;
128     
129     void
130     GenerateHelpText (Stream &result) override;
131     
132     lldb::CommandObjectSP
133     GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
134     
135     CommandObject *
136     GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
137     
138     void
139     AproposAllSubCommands(const char *prefix,
140                           const char *search_word,
141                           StringList &commands_found,
142                           StringList &commands_help) override;
143
144     bool
145     LoadSubCommand(const char *cmd_name,
146                    const lldb::CommandObjectSP& command_obj) override;
147     
148     bool
149     WantsRawCommandString() override;
150     
151     bool
152     WantsCompletion() override;
153     
154     Options *
155     GetOptions() override;
156
157     int
158     HandleCompletion(Args &input,
159                      int &cursor_index,
160                      int &cursor_char_position,
161                      int match_start_point,
162                      int max_return_elements,
163                      bool &word_complete,
164                      StringList &matches) override;
165
166     int
167     HandleArgumentCompletion(Args &input,
168                              int &cursor_index,
169                              int &cursor_char_position,
170                              OptionElementVector &opt_element_vector,
171                              int match_start_point,
172                              int max_return_elements,
173                              bool &word_complete,
174                              StringList &matches) override;
175
176     const char *
177     GetRepeatCommand(Args &current_command_args,
178                      uint32_t index) override;
179
180     bool
181     Execute(const char *args_string,
182             CommandReturnObject &result) override;
183
184 protected:
185     // These two want to iterate over the subcommand dictionary.
186     friend class CommandInterpreter;
187     friend class CommandObjectSyntax;
188 };
189
190 } // namespace lldb_private
191
192 #endif // liblldb_CommandObjectMultiword_h_