LLDB mainline
CommandAlias.h
Go to the documentation of this file.
1//===-- CommandAlias.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_INTERPRETER_COMMANDALIAS_H
10#define LLDB_INTERPRETER_COMMANDALIAS_H
11
12#include <memory>
13
15#include "lldb/Utility/Args.h"
17#include "lldb/lldb-forward.h"
18
19namespace lldb_private {
21public:
22 typedef std::unique_ptr<CommandAlias> UniquePointer;
23
25 llvm::StringRef options_args, llvm::StringRef name,
26 llvm::StringRef help = llvm::StringRef(),
27 llvm::StringRef syntax = llvm::StringRef(), uint32_t flags = 0);
28
29 void GetAliasExpansion(StreamString &help_string) const;
30
32
33 explicit operator bool() const { return IsValid(); }
34
35 bool WantsRawCommandString() override;
36
37 bool WantsCompletion() override;
38
39 void HandleCompletion(CompletionRequest &request) override;
40
41 void
43 OptionElementVector &opt_element_vector) override;
44
45 Options *GetOptions() override;
46
47 bool IsAlias() override { return true; }
48
49 bool IsDashDashCommand() override;
50
51 llvm::StringRef GetHelp() override;
52
53 llvm::StringRef GetHelpLong() override;
54
55 void SetHelp(llvm::StringRef str) override;
56
57 void SetHelpLong(llvm::StringRef str) override;
58
59 void Execute(const char *args_string, CommandReturnObject &result) override;
60
63 }
65 const char *GetOptionString() { return m_option_string.c_str(); }
66
67 // this takes an alias - potentially nested (i.e. an alias to an alias) and
68 // expands it all the way to a non-alias command
69 std::pair<lldb::CommandObjectSP, OptionArgVectorSP> Desugar();
70
71protected:
72 bool IsNestedAlias();
73
74private:
76 std::string m_option_string;
81};
82} // namespace lldb_private
83
84#endif // LLDB_INTERPRETER_COMMANDALIAS_H
lldb::CommandObjectSP GetUnderlyingCommand()
Definition: CommandAlias.h:61
llvm::StringRef GetHelpLong() override
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
const char * GetOptionString()
Definition: CommandAlias.h:65
void Execute(const char *args_string, CommandReturnObject &result) override
OptionArgVectorSP GetOptionArguments() const
Definition: CommandAlias.h:64
bool WantsCompletion() override
OptionArgVectorSP m_option_args_sp
Definition: CommandAlias.h:77
Options * GetOptions() override
void SetHelp(llvm::StringRef str) override
bool WantsRawCommandString() override
void GetAliasExpansion(StreamString &help_string) const
void SetHelpLong(llvm::StringRef str) override
std::pair< lldb::CommandObjectSP, OptionArgVectorSP > Desugar()
bool IsAlias() override
Definition: CommandAlias.h:47
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
lldb::CommandObjectSP m_underlying_command_sp
Definition: CommandAlias.h:75
llvm::StringRef GetHelp() override
bool IsDashDashCommand() override
std::unique_ptr< CommandAlias > UniquePointer
Definition: CommandAlias.h:22
"lldb/Utility/ArgCompletionRequest.h"
A command line option parsing protocol class.
Definition: Options.h:58
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
Definition: Options.h:43
std::shared_ptr< OptionArgVector > OptionArgVectorSP
Definition: Options.h:30
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
Definition: lldb-forward.h:330