blob: 7c2f9fba0242ed62c57a92f901e5fb28b7907217 [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===-- OptionValueFormatEntity.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
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02009#ifndef LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
10#define LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
Andrew Walbran3d2c1972020-04-07 12:24:26 +010011
12#include "lldb/Core/FormatEntity.h"
13#include "lldb/Interpreter/OptionValue.h"
14
15namespace lldb_private {
16
17class OptionValueFormatEntity : public OptionValue {
18public:
19 OptionValueFormatEntity(const char *default_format);
20
21 ~OptionValueFormatEntity() override {}
22
23 // Virtual subclass pure virtual overrides
24
25 OptionValue::Type GetType() const override { return eTypeFormatEntity; }
26
27 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
28 uint32_t dump_mask) override;
29
30 Status
31 SetValueFromString(llvm::StringRef value,
32 VarSetOperationType op = eVarSetOperationAssign) override;
33 Status
34 SetValueFromString(const char *,
35 VarSetOperationType = eVarSetOperationAssign) = delete;
36
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020037 void Clear() override;
Andrew Walbran3d2c1972020-04-07 12:24:26 +010038
39 lldb::OptionValueSP DeepCopy() const override;
40
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020041 void AutoComplete(CommandInterpreter &interpreter,
42 CompletionRequest &request) override;
Andrew Walbran3d2c1972020-04-07 12:24:26 +010043
44 // Subclass specific functions
45
46 FormatEntity::Entry &GetCurrentValue() { return m_current_entry; }
47
48 const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; }
49
50 void SetCurrentValue(const FormatEntity::Entry &value) {
51 m_current_entry = value;
52 }
53
54 FormatEntity::Entry &GetDefaultValue() { return m_default_entry; }
55
56 const FormatEntity::Entry &GetDefaultValue() const { return m_default_entry; }
57
58protected:
59 std::string m_current_format;
60 std::string m_default_format;
61 FormatEntity::Entry m_current_entry;
62 FormatEntity::Entry m_default_entry;
63};
64
65} // namespace lldb_private
66
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020067#endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H