|
| 1 | +//===-- OptionValueFormatEntityList.h --------------------------------*- |
| 2 | +// C++-*-===// |
| 3 | +// |
| 4 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | +// See https://llvm.org/LICENSE.txt for license information. |
| 6 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | +// |
| 8 | +//===----------------------------------------------------------------------===// |
| 9 | + |
| 10 | +#ifndef LLDB_INTERPRETER_OPTIONVALUEFORMATENTITYLIST_H |
| 11 | +#define LLDB_INTERPRETER_OPTIONVALUEFORMATENTITYLIST_H |
| 12 | + |
| 13 | +#include "lldb/Core/FormatEntity.h" |
| 14 | +#include "lldb/Interpreter/OptionValue.h" |
| 15 | + |
| 16 | +namespace lldb_private { |
| 17 | + |
| 18 | +class OptionValueFormatEntityList |
| 19 | + : public Cloneable<OptionValueFormatEntityList, OptionValue> { |
| 20 | +public: |
| 21 | + OptionValueFormatEntityList(); |
| 22 | + |
| 23 | + OptionValueFormatEntityList(const OptionValueFormatEntityList &other) |
| 24 | + : Cloneable(other), m_current_entries(other.m_current_entries), |
| 25 | + m_current_formats(other.m_current_formats) {} |
| 26 | + |
| 27 | + ~OptionValueFormatEntityList() override = default; |
| 28 | + |
| 29 | + // Virtual subclass pure virtual overrides |
| 30 | + |
| 31 | + OptionValue::Type GetType() const override { return eTypeFormatEntityList; } |
| 32 | + |
| 33 | + void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, |
| 34 | + uint32_t dump_mask) override; |
| 35 | + |
| 36 | + Status |
| 37 | + SetValueFromString(llvm::StringRef value, |
| 38 | + VarSetOperationType op = eVarSetOperationAssign) override; |
| 39 | + |
| 40 | + void Clear() override; |
| 41 | + |
| 42 | + std::vector<FormatEntity::Entry> GetCurrentValue() const { |
| 43 | + std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| 44 | + return m_current_entries; |
| 45 | + } |
| 46 | + |
| 47 | +protected: |
| 48 | + llvm::Error Append(llvm::StringRef str); |
| 49 | + llvm::Error Insert(size_t idx, llvm::StringRef str); |
| 50 | + llvm::Error Replace(size_t idx, llvm::StringRef str); |
| 51 | + llvm::Error Remove(size_t idx); |
| 52 | + |
| 53 | + lldb::OptionValueSP Clone() const override; |
| 54 | + |
| 55 | + std::vector<FormatEntity::Entry> m_current_entries; |
| 56 | + std::vector<std::string> m_current_formats; |
| 57 | + mutable std::recursive_mutex m_mutex; |
| 58 | +}; |
| 59 | + |
| 60 | +} // namespace lldb_private |
| 61 | + |
| 62 | +#endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITYLIST_H |
0 commit comments