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 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
71protected:
72 void SetEnumerations(const OptionEnumValues &enumerators);
73
77};
78
79} // namespace lldb_private
80
81#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 SetEnumerations(const OptionEnumValues &enumerators)
OptionValue::Type GetType() const override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
~OptionValueEnumeration() override=default
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
void AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override
An error handling class.
Definition: Status.h:44
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.
Definition: SBAttachInfo.h:14
VarSetOperationType
Settable state variable types.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues