1//===-- 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
9#ifndef liblldb_OptionValueFormatEntity_h_
10#define liblldb_OptionValueFormatEntity_h_
11
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
37  bool Clear() override;
38
39  lldb::OptionValueSP DeepCopy() const override;
40
41  void AutoComplete(CommandInterpreter &interpreter,
42                    CompletionRequest &request) override;
43
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
67#endif // liblldb_OptionValueFormatEntity_h_
68