]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
Merge compiler-rt trunk r321414 to contrib/compiler-rt.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueFileSpec.h
1 //===-- OptionValueFileSpec.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionValueFileSpec_h_
11 #define liblldb_OptionValueFileSpec_h_
12
13 #include "lldb/Interpreter/OptionValue.h"
14
15 #include "lldb/Utility/FileSpec.h"
16 #include "llvm/Support/Chrono.h"
17
18 namespace lldb_private {
19
20 class OptionValueFileSpec : public OptionValue {
21 public:
22   OptionValueFileSpec(bool resolve = true);
23
24   OptionValueFileSpec(const FileSpec &value, bool resolve = true);
25
26   OptionValueFileSpec(const FileSpec &current_value,
27                       const FileSpec &default_value, bool resolve = true);
28
29   ~OptionValueFileSpec() override {}
30
31   //---------------------------------------------------------------------
32   // Virtual subclass pure virtual overrides
33   //---------------------------------------------------------------------
34
35   OptionValue::Type GetType() const override { return eTypeFileSpec; }
36
37   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
38                  uint32_t dump_mask) override;
39
40   Status
41   SetValueFromString(llvm::StringRef value,
42                      VarSetOperationType op = eVarSetOperationAssign) override;
43   Status
44   SetValueFromString(const char *,
45                      VarSetOperationType = eVarSetOperationAssign) = delete;
46
47   bool Clear() override {
48     m_current_value = m_default_value;
49     m_value_was_set = false;
50     m_data_sp.reset();
51     m_data_mod_time = llvm::sys::TimePoint<>();
52     return true;
53   }
54
55   lldb::OptionValueSP DeepCopy() const override;
56
57   size_t AutoComplete(CommandInterpreter &interpreter, llvm::StringRef s,
58                       int match_start_point, int max_return_elements,
59                       bool &word_complete, StringList &matches) override;
60
61   //---------------------------------------------------------------------
62   // Subclass specific functions
63   //---------------------------------------------------------------------
64
65   FileSpec &GetCurrentValue() { return m_current_value; }
66
67   const FileSpec &GetCurrentValue() const { return m_current_value; }
68
69   const FileSpec &GetDefaultValue() const { return m_default_value; }
70
71   void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
72     m_current_value = value;
73     if (set_value_was_set)
74       m_value_was_set = true;
75     m_data_sp.reset();
76   }
77
78   void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
79
80   const lldb::DataBufferSP &GetFileContents();
81
82   void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
83
84 protected:
85   FileSpec m_current_value;
86   FileSpec m_default_value;
87   lldb::DataBufferSP m_data_sp;
88   llvm::sys::TimePoint<> m_data_mod_time;
89   uint32_t m_completion_mask;
90   bool m_resolve;
91 };
92
93 } // namespace lldb_private
94
95 #endif // liblldb_OptionValueFileSpec_h_