LLDB  mainline
OptionValueEnumeration.h
Go to the documentation of this file.
1 //===-- OptionValueEnumeration.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_OPTIONVALUEENUMERATION_H
10 #define LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
11 
15 #include "lldb/Utility/Status.h"
16 #include "lldb/Utility/Stream.h"
19 
20 namespace lldb_private {
21 
23  : public Cloneable<OptionValueEnumeration, OptionValue> {
24 public:
25  typedef int64_t enum_type;
26  struct EnumeratorInfo {
28  const char *description;
29  };
32 
33  OptionValueEnumeration(const OptionEnumValues &enumerators, enum_type value);
34 
35  ~OptionValueEnumeration() override = default;
36 
37  // Virtual subclass pure virtual overrides
38 
39  OptionValue::Type GetType() const override { return eTypeEnum; }
40 
41  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
42  uint32_t dump_mask) override;
43 
44  Status
45  SetValueFromString(llvm::StringRef value,
47 
48  void Clear() override {
50  m_value_was_set = false;
51  }
52 
53  void AutoComplete(CommandInterpreter &interpreter,
54  CompletionRequest &request) override;
55 
56  // Subclass specific functions
57 
59  m_current_value = value;
60  return m_current_value;
61  }
62 
64 
66 
67  void SetCurrentValue(enum_type value) { m_current_value = value; }
68 
69  void SetDefaultValue(enum_type value) { m_default_value = value; }
70 
71 protected:
72  void SetEnumerations(const OptionEnumValues &enumerators);
73 
77 };
78 
79 } // namespace lldb_private
80 
81 #endif // LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
lldb_private::OptionValueEnumeration::EnumeratorInfo::value
enum_type value
Definition: OptionValueEnumeration.h:27
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb-private-types.h
lldb_private::OptionValueEnumeration::m_default_value
enum_type m_default_value
Definition: OptionValueEnumeration.h:75
lldb_private::OptionValueEnumeration::GetDefaultValue
enum_type GetDefaultValue() const
Definition: OptionValueEnumeration.h:65
lldb_private::OptionValueEnumeration::EnumerationMapEntry
EnumerationMap::Entry EnumerationMapEntry
Definition: OptionValueEnumeration.h:31
lldb_private::OptionValueEnumeration::~OptionValueEnumeration
~OptionValueEnumeration() override=default
lldb_private::OptionValueEnumeration::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition: OptionValueEnumeration.cpp:40
lldb_private::Stream
Definition: Stream.h:28
UniqueCStringMap.h
lldb_private::OptionValueEnumeration::Clear
void Clear() override
Definition: OptionValueEnumeration.h:48
lldb_private::Cloneable
Definition: Cloneable.h:40
lldb_private::OptionValueEnumeration::AutoComplete
void AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override
Definition: OptionValueEnumeration.cpp:98
lldb_private::OptionValueEnumeration
Definition: OptionValueEnumeration.h:22
OptionValue.h
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
lldb_private::OptionValueEnumeration::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition: OptionValueEnumeration.cpp:22
StreamString.h
lldb_private::OptionValueEnumeration::EnumeratorInfo::description
const char * description
Definition: OptionValueEnumeration.h:28
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::OptionValueEnumeration::m_enumerations
EnumerationMap m_enumerations
Definition: OptionValueEnumeration.h:76
lldb_private::UniqueCStringMap< EnumeratorInfo >
lldb_private::OptionValueEnumeration::OptionValueEnumeration
OptionValueEnumeration(const OptionEnumValues &enumerators, enum_type value)
Definition: OptionValueEnumeration.cpp:16
lldb_private::OptionValueEnumeration::EnumerationMap
UniqueCStringMap< EnumeratorInfo > EnumerationMap
Definition: OptionValueEnumeration.h:30
lldb_private::Status
Definition: Status.h:44
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
lldb_private::OptionValueEnumeration::enum_type
int64_t enum_type
Definition: OptionValueEnumeration.h:25
uint32_t
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition: OptionValue.h:332
lldb_private::OptionValueEnumeration::GetCurrentValue
enum_type GetCurrentValue() const
Definition: OptionValueEnumeration.h:63
lldb_private::OptionValueEnumeration::operator=
enum_type operator=(enum_type value)
Definition: OptionValueEnumeration.h:58
lldb_private::OptionValueEnumeration::m_current_value
enum_type m_current_value
Definition: OptionValueEnumeration.h:74
lldb_private::OptionValueEnumeration::SetEnumerations
void SetEnumerations(const OptionEnumValues &enumerators)
Definition: OptionValueEnumeration.cpp:85
lldb_private::OptionValueEnumeration::SetDefaultValue
void SetDefaultValue(enum_type value)
Definition: OptionValueEnumeration.h:69
lldb_private::OptionValueEnumeration::EnumeratorInfo
Definition: OptionValueEnumeration.h:26
lldb_private::OptionValueEnumeration::SetCurrentValue
void SetCurrentValue(enum_type value)
Definition: OptionValueEnumeration.h:67
Status.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
ConstString.h
Entry
FormatEntity::Entry Entry
Definition: FormatEntity.cpp:82
Stream.h
lldb_private::OptionValueEnumeration::GetType
OptionValue::Type GetType() const override
Definition: OptionValueEnumeration.h:39
lldb_private::OptionValue::eTypeEnum
@ eTypeEnum
Definition: OptionValue.h:34
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90