1 //===-- OptionValuePathMappings.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_OPTIONVALUEPATHMAPPINGS_H
10 #define LLDB_INTERPRETER_OPTIONVALUEPATHMAPPINGS_H
11 
12 #include "lldb/Interpreter/OptionValue.h"
13 #include "lldb/Target/PathMappingList.h"
14 
15 namespace lldb_private {
16 
17 class OptionValuePathMappings : public OptionValue {
18 public:
19   OptionValuePathMappings(bool notify_changes)
20       : OptionValue(), m_path_mappings(), m_notify_changes(notify_changes) {}
21 
22   ~OptionValuePathMappings() override {}
23 
24   // Virtual subclass pure virtual overrides
25 
26   OptionValue::Type GetType() const override { return eTypePathMap; }
27 
28   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
29                  uint32_t dump_mask) override;
30 
31   Status
32   SetValueFromString(llvm::StringRef value,
33                      VarSetOperationType op = eVarSetOperationAssign) override;
34   Status
35   SetValueFromString(const char *,
36                      VarSetOperationType = eVarSetOperationAssign) = delete;
37 
38   void Clear() override {
39     m_path_mappings.Clear(m_notify_changes);
40     m_value_was_set = false;
41   }
42 
43   lldb::OptionValueSP DeepCopy() const override;
44 
45   bool IsAggregateValue() const override { return true; }
46 
47   // Subclass specific functions
48 
49   PathMappingList &GetCurrentValue() { return m_path_mappings; }
50 
51   const PathMappingList &GetCurrentValue() const { return m_path_mappings; }
52 
53 protected:
54   PathMappingList m_path_mappings;
55   bool m_notify_changes;
56 };
57 
58 } // namespace lldb_private
59 
60 #endif // LLDB_INTERPRETER_OPTIONVALUEPATHMAPPINGS_H
61