]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Commands/CommandObjectHelp.h
scp: validate filenames provided by server against wildcard in client
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Commands / CommandObjectHelp.h
1 //===-- CommandObjectHelp.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_CommandObjectHelp_h_
11 #define liblldb_CommandObjectHelp_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Host/OptionParser.h"
18 #include "lldb/Interpreter/CommandObject.h"
19 #include "lldb/Interpreter/Options.h"
20
21 namespace lldb_private {
22
23 //-------------------------------------------------------------------------
24 // CommandObjectHelp
25 //-------------------------------------------------------------------------
26
27 class CommandObjectHelp : public CommandObjectParsed {
28 public:
29   CommandObjectHelp(CommandInterpreter &interpreter);
30
31   ~CommandObjectHelp() override;
32
33   int HandleCompletion(CompletionRequest &request) override;
34
35   static void GenerateAdditionalHelpAvenuesMessage(
36       Stream *s, llvm::StringRef command, llvm::StringRef prefix,
37       llvm::StringRef subcommand, bool include_apropos = true,
38       bool include_type_lookup = true);
39
40   class CommandOptions : public Options {
41   public:
42     CommandOptions() : Options() {}
43
44     ~CommandOptions() override {}
45
46     Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
47                           ExecutionContext *execution_context) override {
48       Status error;
49       const int short_option = m_getopt_table[option_idx].val;
50
51       switch (short_option) {
52       case 'a':
53         m_show_aliases = false;
54         break;
55       case 'u':
56         m_show_user_defined = false;
57         break;
58       case 'h':
59         m_show_hidden = true;
60         break;
61       default:
62         error.SetErrorStringWithFormat("unrecognized option '%c'",
63                                        short_option);
64         break;
65       }
66
67       return error;
68     }
69
70     void OptionParsingStarting(ExecutionContext *execution_context) override {
71       m_show_aliases = true;
72       m_show_user_defined = true;
73       m_show_hidden = false;
74     }
75
76     llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
77
78     // Instance variables to hold the values for command options.
79
80     bool m_show_aliases;
81     bool m_show_user_defined;
82     bool m_show_hidden;
83   };
84
85   Options *GetOptions() override { return &m_options; }
86
87 protected:
88   bool DoExecute(Args &command, CommandReturnObject &result) override;
89
90 private:
91   CommandOptions m_options;
92 };
93
94 } // namespace lldb_private
95
96 #endif // liblldb_CommandObjectHelp_h_