1//===-- OptionValueFileSpecList.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_OptionValueFileSpecList_h_ 10#define liblldb_OptionValueFileSpecList_h_ 11 12#include <mutex> 13 14#include "lldb/Core/FileSpecList.h" 15#include "lldb/Interpreter/OptionValue.h" 16 17namespace lldb_private { 18 19class OptionValueFileSpecList : public OptionValue { 20public: 21 OptionValueFileSpecList() : OptionValue(), m_current_value() {} 22 23 OptionValueFileSpecList(const FileSpecList ¤t_value) 24 : OptionValue(), m_current_value(current_value) {} 25 26 ~OptionValueFileSpecList() override {} 27 28 // Virtual subclass pure virtual overrides 29 30 OptionValue::Type GetType() const override { return eTypeFileSpecList; } 31 32 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, 33 uint32_t dump_mask) override; 34 35 Status 36 SetValueFromString(llvm::StringRef value, 37 VarSetOperationType op = eVarSetOperationAssign) override; 38 Status 39 SetValueFromString(const char *, 40 VarSetOperationType = eVarSetOperationAssign) = delete; 41 42 bool Clear() override { 43 std::lock_guard<std::recursive_mutex> lock(m_mutex); 44 m_current_value.Clear(); 45 m_value_was_set = false; 46 return true; 47 } 48 49 lldb::OptionValueSP DeepCopy() const override; 50 51 bool IsAggregateValue() const override { return true; } 52 53 // Subclass specific functions 54 55 FileSpecList GetCurrentValue() const { 56 std::lock_guard<std::recursive_mutex> lock(m_mutex); 57 return m_current_value; 58 } 59 60 void SetCurrentValue(const FileSpecList &value) { 61 std::lock_guard<std::recursive_mutex> lock(m_mutex); 62 m_current_value = value; 63 } 64 65 void AppendCurrentValue(const FileSpec &value) { 66 std::lock_guard<std::recursive_mutex> lock(m_mutex); 67 m_current_value.Append(value); 68 } 69 70protected: 71 mutable std::recursive_mutex m_mutex; 72 FileSpecList m_current_value; 73}; 74 75} // namespace lldb_private 76 77#endif // liblldb_OptionValueFileSpecList_h_ 78