1254721Semaste//===-- CommandObjectMultiword.h --------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef liblldb_CommandObjectMultiword_h_ 11254721Semaste#define liblldb_CommandObjectMultiword_h_ 12254721Semaste 13254721Semaste// C Includes 14254721Semaste// C++ Includes 15254721Semaste#include <map> 16254721Semaste 17254721Semaste// Other libraries and framework includes 18254721Semaste// Project includes 19254721Semaste#include "lldb/Interpreter/CommandObject.h" 20254721Semaste 21254721Semastenamespace lldb_private { 22254721Semaste 23254721Semaste//------------------------------------------------------------------------- 24254721Semaste// CommandObjectMultiword 25254721Semaste//------------------------------------------------------------------------- 26254721Semaste 27254721Semasteclass CommandObjectMultiword : public CommandObject 28254721Semaste{ 29254721Semaste// These two want to iterate over the subcommand dictionary. 30254721Semastefriend class CommandInterpreter; 31254721Semastefriend class CommandObjectSyntax; 32254721Semastepublic: 33254721Semaste CommandObjectMultiword (CommandInterpreter &interpreter, 34254721Semaste const char *name, 35254721Semaste const char *help = NULL, 36254721Semaste const char *syntax = NULL, 37254721Semaste uint32_t flags = 0); 38254721Semaste 39254721Semaste virtual 40254721Semaste ~CommandObjectMultiword (); 41254721Semaste 42254721Semaste virtual bool 43254721Semaste IsMultiwordObject () { return true; } 44254721Semaste 45254721Semaste virtual bool 46254721Semaste LoadSubCommand (const char *cmd_name, 47254721Semaste const lldb::CommandObjectSP& command_obj); 48254721Semaste 49254721Semaste virtual void 50254721Semaste GenerateHelpText (Stream &output_stream); 51254721Semaste 52254721Semaste virtual lldb::CommandObjectSP 53254721Semaste GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL); 54254721Semaste 55254721Semaste virtual CommandObject * 56254721Semaste GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL); 57254721Semaste 58254721Semaste virtual void 59254721Semaste AproposAllSubCommands (const char *prefix, 60254721Semaste const char *search_word, 61254721Semaste StringList &commands_found, 62254721Semaste StringList &commands_help); 63254721Semaste 64254721Semaste virtual bool 65254721Semaste WantsRawCommandString() { return false; }; 66254721Semaste 67254721Semaste virtual int 68254721Semaste HandleCompletion (Args &input, 69254721Semaste int &cursor_index, 70254721Semaste int &cursor_char_position, 71254721Semaste int match_start_point, 72254721Semaste int max_return_elements, 73254721Semaste bool &word_complete, 74254721Semaste StringList &matches); 75254721Semaste 76254721Semaste virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index); 77254721Semaste 78254721Semaste virtual bool 79254721Semaste Execute (const char *args_string, 80254721Semaste CommandReturnObject &result); 81254721Semaste 82254721Semaste virtual bool 83254721Semaste IsRemovable() const { return m_can_be_removed; } 84254721Semaste 85254721Semaste void 86254721Semaste SetRemovable (bool removable) 87254721Semaste { 88254721Semaste m_can_be_removed = removable; 89254721Semaste } 90254721Semaste 91254721Semasteprotected: 92254721Semaste 93254721Semaste CommandObject::CommandMap m_subcommand_dict; 94254721Semaste bool m_can_be_removed; 95254721Semaste}; 96254721Semaste 97254721Semaste 98254721Semasteclass CommandObjectProxy : public CommandObject 99254721Semaste{ 100254721Semastepublic: 101254721Semaste CommandObjectProxy (CommandInterpreter &interpreter, 102254721Semaste const char *name, 103254721Semaste const char *help = NULL, 104254721Semaste const char *syntax = NULL, 105254721Semaste uint32_t flags = 0); 106254721Semaste 107254721Semaste virtual 108254721Semaste ~CommandObjectProxy (); 109254721Semaste 110254721Semaste // Subclasses must provide a command object that will be transparently 111254721Semaste // used for this object. 112254721Semaste virtual CommandObject * 113254721Semaste GetProxyCommandObject() = 0; 114254721Semaste 115254721Semaste virtual const char * 116254721Semaste GetHelpLong (); 117254721Semaste 118254721Semaste virtual bool 119254721Semaste IsRemovable() const; 120254721Semaste 121254721Semaste virtual bool 122254721Semaste IsMultiwordObject (); 123254721Semaste 124254721Semaste virtual lldb::CommandObjectSP 125254721Semaste GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL); 126254721Semaste 127254721Semaste virtual CommandObject * 128254721Semaste GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL); 129254721Semaste 130254721Semaste virtual void 131254721Semaste AproposAllSubCommands (const char *prefix, 132254721Semaste const char *search_word, 133254721Semaste StringList &commands_found, 134254721Semaste StringList &commands_help); 135254721Semaste 136254721Semaste virtual bool 137254721Semaste LoadSubCommand (const char *cmd_name, 138254721Semaste const lldb::CommandObjectSP& command_obj); 139254721Semaste 140254721Semaste virtual bool 141254721Semaste WantsRawCommandString(); 142254721Semaste 143254721Semaste virtual bool 144254721Semaste WantsCompletion(); 145254721Semaste 146254721Semaste virtual Options * 147254721Semaste GetOptions (); 148254721Semaste 149254721Semaste 150254721Semaste virtual int 151254721Semaste HandleCompletion (Args &input, 152254721Semaste int &cursor_index, 153254721Semaste int &cursor_char_position, 154254721Semaste int match_start_point, 155254721Semaste int max_return_elements, 156254721Semaste bool &word_complete, 157254721Semaste StringList &matches); 158254721Semaste 159254721Semaste virtual int 160254721Semaste HandleArgumentCompletion (Args &input, 161254721Semaste int &cursor_index, 162254721Semaste int &cursor_char_position, 163254721Semaste OptionElementVector &opt_element_vector, 164254721Semaste int match_start_point, 165254721Semaste int max_return_elements, 166254721Semaste bool &word_complete, 167254721Semaste StringList &matches); 168254721Semaste 169254721Semaste virtual const char * 170254721Semaste GetRepeatCommand (Args ¤t_command_args, 171254721Semaste uint32_t index); 172254721Semaste 173254721Semaste virtual bool 174254721Semaste Execute (const char *args_string, 175254721Semaste CommandReturnObject &result); 176254721Semaste 177254721Semasteprotected: 178254721Semaste 179254721Semaste // These two want to iterate over the subcommand dictionary. 180254721Semaste friend class CommandInterpreter; 181254721Semaste friend class CommandObjectSyntax; 182254721Semaste 183254721Semaste}; 184254721Semaste 185254721Semaste} // namespace lldb_private 186254721Semaste 187254721Semaste#endif // liblldb_CommandObjectMultiword_h_ 188