1 //===-- OptionValueFileSpec.h -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OptionValueFileSpec_h_
11 #define liblldb_OptionValueFileSpec_h_
13 #include "lldb/Interpreter/OptionValue.h"
15 #include "lldb/Utility/FileSpec.h"
16 #include "llvm/Support/Chrono.h"
18 namespace lldb_private {
20 class OptionValueFileSpec : public OptionValue {
22 OptionValueFileSpec(bool resolve = true);
24 OptionValueFileSpec(const FileSpec &value, bool resolve = true);
26 OptionValueFileSpec(const FileSpec ¤t_value,
27 const FileSpec &default_value, bool resolve = true);
29 ~OptionValueFileSpec() override {}
31 //---------------------------------------------------------------------
32 // Virtual subclass pure virtual overrides
33 //---------------------------------------------------------------------
35 OptionValue::Type GetType() const override { return eTypeFileSpec; }
37 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
38 uint32_t dump_mask) override;
41 SetValueFromString(llvm::StringRef value,
42 VarSetOperationType op = eVarSetOperationAssign) override;
44 SetValueFromString(const char *,
45 VarSetOperationType = eVarSetOperationAssign) = delete;
47 bool Clear() override {
48 m_current_value = m_default_value;
49 m_value_was_set = false;
51 m_data_mod_time = llvm::sys::TimePoint<>();
55 lldb::OptionValueSP DeepCopy() const override;
57 size_t AutoComplete(CommandInterpreter &interpreter,
58 CompletionRequest &request) override;
60 //---------------------------------------------------------------------
61 // Subclass specific functions
62 //---------------------------------------------------------------------
64 FileSpec &GetCurrentValue() { return m_current_value; }
66 const FileSpec &GetCurrentValue() const { return m_current_value; }
68 const FileSpec &GetDefaultValue() const { return m_default_value; }
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;
77 void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
79 const lldb::DataBufferSP &GetFileContents();
81 void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
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;
92 } // namespace lldb_private
94 #endif // liblldb_OptionValueFileSpec_h_