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
20namespace lldb_private {
21
23 : public Cloneable<OptionValueEnumeration, OptionValue> {
24public:
25 typedef int64_t enum_type;
28 const char *description;
29 };
31 typedef EnumerationMap::Entry EnumerationMapEntry;
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 llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override;
45
46 Status
47 SetValueFromString(llvm::StringRef value,
49
50 void Clear() override {
52 m_value_was_set = false;
53 }
54
55 void AutoComplete(CommandInterpreter &interpreter,
56 CompletionRequest &request) override;
57
58 // Subclass specific functions
59
61 m_current_value = value;
62 return m_current_value;
63 }
64
66
68
69 void SetCurrentValue(enum_type value) { m_current_value = value; }
70
71 void SetDefaultValue(enum_type value) { m_default_value = value; }
72
73protected:
74 void SetEnumerations(const OptionEnumValues &enumerators);
75 void DumpEnum(Stream &strm, enum_type value);
76
80};
81
82} // namespace lldb_private
83
84#endif // LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
A class that implements CRTP-based "virtual constructor" idiom.
Definition Cloneable.h:40
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
UniqueCStringMap< EnumeratorInfo > EnumerationMap
void DumpEnum(Stream &strm, enum_type value)
void SetEnumerations(const OptionEnumValues &enumerators)
OptionValue::Type GetType() const override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
~OptionValueEnumeration() override=default
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
OptionValueEnumeration(const OptionEnumValues &enumerators, enum_type value)
void AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues