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, llvm::StringRef s,
58 int match_start_point, int max_return_elements,
59 bool &word_complete, StringList &matches) override;
61 //---------------------------------------------------------------------
62 // Subclass specific functions
63 //---------------------------------------------------------------------
65 FileSpec &GetCurrentValue() { return m_current_value; }
67 const FileSpec &GetCurrentValue() const { return m_current_value; }
69 const FileSpec &GetDefaultValue() const { return m_default_value; }
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;
78 void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
80 const lldb::DataBufferSP &GetFileContents(bool null_terminate);
82 void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
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;
93 } // namespace lldb_private
95 #endif // liblldb_OptionValueFileSpec_h_