LLDB  mainline
CommandObjectHelp.h
Go to the documentation of this file.
1 //===-- CommandObjectHelp.h -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H
10 #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H
11 
12 #include "lldb/Host/OptionParser.h"
15 
16 namespace lldb_private {
17 
18 // CommandObjectHelp
19 
21 public:
23 
24  ~CommandObjectHelp() override;
25 
26  void HandleCompletion(CompletionRequest &request) override;
27 
29  Stream *s, llvm::StringRef command, llvm::StringRef prefix,
30  llvm::StringRef subcommand, bool include_upropos = true,
31  bool include_type_lookup = true);
32 
33  class CommandOptions : public Options {
34  public:
36 
37  ~CommandOptions() override {}
38 
39  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
40  ExecutionContext *execution_context) override {
41  Status error;
42  const int short_option = m_getopt_table[option_idx].val;
43 
44  switch (short_option) {
45  case 'a':
46  m_show_aliases = false;
47  break;
48  case 'u':
49  m_show_user_defined = false;
50  break;
51  case 'h':
52  m_show_hidden = true;
53  break;
54  default:
55  llvm_unreachable("Unimplemented option");
56  }
57 
58  return error;
59  }
60 
61  void OptionParsingStarting(ExecutionContext *execution_context) override {
62  m_show_aliases = true;
63  m_show_user_defined = true;
64  m_show_hidden = false;
65  }
66 
67  llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
68 
69  // Instance variables to hold the values for command options.
70 
74  };
75 
76  Options *GetOptions() override { return &m_options; }
77 
78 protected:
79  bool DoExecute(Args &command, CommandReturnObject &result) override;
80 
81 private:
83 };
84 
85 } // namespace lldb_private
86 
87 #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H
lldb_private::CommandObjectParsed
Definition: CommandObject.h:378
lldb_private::ExecutionContext
Definition: ExecutionContext.h:291
lldb_private::CommandObjectHelp
Definition: CommandObjectHelp.h:20
lldb_private::CommandObjectHelp::CommandOptions::CommandOptions
CommandOptions()
Definition: CommandObjectHelp.h:35
lldb_private::CommandObjectHelp::DoExecute
bool DoExecute(Args &command, CommandReturnObject &result) override
Definition: CommandObjectHelp.cpp:76
lldb_private::CommandObjectHelp::CommandOptions::~CommandOptions
~CommandOptions() override
Definition: CommandObjectHelp.h:37
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb_private::CommandObjectHelp::~CommandObjectHelp
~CommandObjectHelp() override
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
Options.h
lldb_private::Options
Definition: Options.h:57
lldb_private::CommandObjectHelp::CommandOptions::SetOptionValue
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
Definition: CommandObjectHelp.h:39
lldb_private::CommandObjectHelp::CommandOptions::GetDefinitions
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Definition: CommandObjectHelp.cpp:72
lldb_private::CommandObjectHelp::CommandOptions
Definition: CommandObjectHelp.h:33
lldb_private::CommandObjectHelp::CommandOptions::m_show_user_defined
bool m_show_user_defined
Definition: CommandObjectHelp.h:72
lldb_private::CommandObjectHelp::CommandObjectHelp
CommandObjectHelp(CommandInterpreter &interpreter)
Definition: CommandObjectHelp.cpp:44
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:221
lldb_private::Status
Definition: Status.h:44
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
uint32_t
CommandObject.h
lldb_private::CommandObjectHelp::CommandOptions::OptionParsingStarting
void OptionParsingStarting(ExecutionContext *execution_context) override
Definition: CommandObjectHelp.h:61
lldb_private::CommandObjectHelp::CommandOptions::m_show_hidden
bool m_show_hidden
Definition: CommandObjectHelp.h:73
OptionParser.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage
static void GenerateAdditionalHelpAvenuesMessage(Stream *s, llvm::StringRef command, llvm::StringRef prefix, llvm::StringRef subcommand, bool include_upropos=true, bool include_type_lookup=true)
Definition: CommandObjectHelp.cpp:18
lldb_private::CommandObjectHelp::GetOptions
Options * GetOptions() override
Definition: CommandObjectHelp.h:76
lldb_private::CommandObjectHelp::HandleCompletion
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
Definition: CommandObjectHelp.cpp:204
lldb_private::CommandObjectHelp::m_options
CommandOptions m_options
Definition: CommandObjectHelp.h:82
lldb_private::CommandObjectHelp::CommandOptions::m_show_aliases
bool m_show_aliases
Definition: CommandObjectHelp.h:71
lldb_private::Options::m_getopt_table
std::vector< Option > m_getopt_table
Definition: Options.h:197
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100