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