CommandObjectMultiword.h revision da26bd203cbb104291b39891febf7481794f205f
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#include <map>
16
17// Other libraries and framework includes
18// Project includes
19#include "lldb/Interpreter/CommandObject.h"
20
21namespace lldb_private {
22
23//-------------------------------------------------------------------------
24// CommandObjectMultiword
25//-------------------------------------------------------------------------
26
27class CommandObjectMultiword : public CommandObject
28{
29// These two want to iterate over the subcommand dictionary.
30friend class CommandInterpreter;
31friend class CommandObjectSyntax;
32public:
33    CommandObjectMultiword (CommandInterpreter &interpreter,
34                            const char *name,
35                            const char *help = NULL,
36                            const char *syntax = NULL,
37                            uint32_t flags = 0);
38
39    virtual
40    ~CommandObjectMultiword ();
41
42    virtual bool
43    IsMultiwordObject () { return true; }
44
45    bool
46    LoadSubCommand (const char *cmd_name,
47                    const lldb::CommandObjectSP& command_obj);
48
49    void
50    GenerateHelpText (CommandReturnObject &result);
51
52    lldb::CommandObjectSP
53    GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
54
55    CommandObject *
56    GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
57
58    virtual bool
59    WantsRawCommandString() { return false; };
60
61    virtual int
62    HandleCompletion (Args &input,
63                      int &cursor_index,
64                      int &cursor_char_position,
65                      int match_start_point,
66                      int max_return_elements,
67                      bool &word_complete,
68                      StringList &matches);
69
70    virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index);
71
72    virtual bool
73    Execute (const char *args_string,
74             CommandReturnObject &result);
75protected:
76
77    CommandObject::CommandMap m_subcommand_dict;
78};
79
80} // namespace lldb_private
81
82#endif  // liblldb_CommandObjectMultiword_h_
83