LLDB  mainline
OptionDefinition.h
Go to the documentation of this file.
1 //===-- OptionDefinition.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_UTILITY_OPTIONDEFINITION_H
10 #define LLDB_UTILITY_OPTIONDEFINITION_H
11 
12 #include "lldb/lldb-enumerations.h"
14 #include "llvm/ADT/StringExtras.h"
15 #include "llvm/Support/MathExtras.h"
16 #include <climits>
17 #include <cstdint>
18 
19 namespace lldb_private {
21  /// Used to mark options that can be used together. If
22  /// `(1 << n & usage_mask) != 0` then this option belongs to option set n.
24  /// This option is required (in the current usage level).
25  bool required;
26  /// Full name for this option.
27  const char *long_option;
28  /// Single character for this option. If the option doesn't use a short
29  /// option character, this has to be a integer value that is not a printable
30  /// ASCII code point and also unique in the used set of options.
31  /// @see OptionDefinition::HasShortOption
33  /// no_argument, required_argument or optional_argument
35  /// If non-NULL, option is valid iff |validator->IsValid()|, otherwise
36  /// always valid.
38  /// If not empty, an array of enum values.
39  OptionEnumValues enum_values;
40  /// The kind of completion for this option.
41  /// Contains values of the CommandCompletions::CommonCompletionTypes enum.
43  /// Type of argument this option takes.
45  /// Full text explaining what this options does and what (if any) argument to
46  /// pass it.
47  const char *usage_text;
48 
49  /// Whether this has a short option character.
50  bool HasShortOption() const {
51  // See the short_option documentation for more.
52  return llvm::isUInt<CHAR_BIT>(short_option) &&
53  llvm::isPrint(short_option);
54  }
55 };
56 } // namespace lldb_private
57 
58 #endif // LLDB_UTILITY_OPTIONDEFINITION_H
lldb-private-types.h
lldb_private::OptionDefinition::required
bool required
This option is required (in the current usage level).
Definition: OptionDefinition.h:25
lldb_private::OptionDefinition::validator
OptionValidator * validator
If non-NULL, option is valid iff |validator->IsValid()|, otherwise always valid.
Definition: OptionDefinition.h:37
lldb_private::OptionDefinition::completion_type
uint32_t completion_type
The kind of completion for this option.
Definition: OptionDefinition.h:42
lldb::CommandArgumentType
CommandArgumentType
Definition: lldb-enumerations.h:515
lldb_private::OptionDefinition::usage_text
const char * usage_text
Full text explaining what this options does and what (if any) argument to pass it.
Definition: OptionDefinition.h:47
lldb_private::OptionDefinition::long_option
const char * long_option
Full name for this option.
Definition: OptionDefinition.h:27
lldb_private::OptionDefinition::option_has_arg
int option_has_arg
no_argument, required_argument or optional_argument
Definition: OptionDefinition.h:34
lldb-enumerations.h
uint32_t
lldb_private::OptionDefinition::usage_mask
uint32_t usage_mask
Used to mark options that can be used together.
Definition: OptionDefinition.h:23
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionDefinition
Definition: OptionDefinition.h:20
lldb_private::OptionDefinition::enum_values
OptionEnumValues enum_values
If not empty, an array of enum values.
Definition: OptionDefinition.h:39
OptionValidator
lldb_private::OptionDefinition::argument_type
lldb::CommandArgumentType argument_type
Type of argument this option takes.
Definition: OptionDefinition.h:44
lldb_private::OptionDefinition::short_option
int short_option
Single character for this option.
Definition: OptionDefinition.h:32
lldb_private::OptionDefinition::HasShortOption
bool HasShortOption() const
Whether this has a short option character.
Definition: OptionDefinition.h:50