]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Interpreter/OptionValueFileSpec.h
Vendor import of lldb trunk r338150:
[FreeBSD/FreeBSD.git] / 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,
58                       CompletionRequest &request) override;
59
60   //---------------------------------------------------------------------
61   // Subclass specific functions
62   //---------------------------------------------------------------------
63
64   FileSpec &GetCurrentValue() { return m_current_value; }
65
66   const FileSpec &GetCurrentValue() const { return m_current_value; }
67
68   const FileSpec &GetDefaultValue() const { return m_default_value; }
69
70   void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
71     m_current_value = value;
72     if (set_value_was_set)
73       m_value_was_set = true;
74     m_data_sp.reset();
75   }
76
77   void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
78
79   const lldb::DataBufferSP &GetFileContents();
80
81   void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
82
83 protected:
84   FileSpec m_current_value;
85   FileSpec m_default_value;
86   lldb::DataBufferSP m_data_sp;
87   llvm::sys::TimePoint<> m_data_mod_time;
88   uint32_t m_completion_mask;
89   bool m_resolve;
90 };
91
92 } // namespace lldb_private
93
94 #endif // liblldb_OptionValueFileSpec_h_