LLDB  mainline
OptionValueFileSpec.h
Go to the documentation of this file.
1 //===-- OptionValueFileSpec.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_OPTIONVALUEFILESPEC_H
10 #define LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
11 
14 
15 #include "lldb/Utility/FileSpec.h"
16 #include "llvm/Support/Chrono.h"
17 
18 namespace lldb_private {
19 
20 class OptionValueFileSpec : public Cloneable<OptionValueFileSpec, 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 = default;
30 
31  // Virtual subclass pure virtual overrides
32 
33  OptionValue::Type GetType() const override { return eTypeFileSpec; }
34 
35  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
36  uint32_t dump_mask) override;
37 
38  Status
39  SetValueFromString(llvm::StringRef value,
41 
42  void Clear() override {
44  m_value_was_set = false;
45  m_data_sp.reset();
46  m_data_mod_time = llvm::sys::TimePoint<>();
47  }
48 
49  void AutoComplete(CommandInterpreter &interpreter,
50  CompletionRequest &request) override;
51 
52  // Subclass specific functions
53 
55 
56  const FileSpec &GetCurrentValue() const { return m_current_value; }
57 
58  const FileSpec &GetDefaultValue() const { return m_default_value; }
59 
60  void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
61  m_current_value = value;
62  if (set_value_was_set)
63  m_value_was_set = true;
64  m_data_sp.reset();
65  }
66 
67  void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
68 
69  const lldb::DataBufferSP &GetFileContents();
70 
72 
73 protected:
76  lldb::DataBufferSP m_data_sp;
77  llvm::sys::TimePoint<> m_data_mod_time;
79  bool m_resolve;
80 };
81 
82 } // namespace lldb_private
83 
84 #endif // LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::OptionValueFileSpec::SetDefaultValue
void SetDefaultValue(const FileSpec &value)
Definition: OptionValueFileSpec.h:67
lldb_private::OptionValueFileSpec::m_completion_mask
uint32_t m_completion_mask
Definition: OptionValueFileSpec.h:78
lldb_private::OptionValueFileSpec::m_current_value
FileSpec m_current_value
Definition: OptionValueFileSpec.h:74
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Cloneable
Definition: Cloneable.h:40
lldb_private::OptionValueFileSpec::GetDefaultValue
const FileSpec & GetDefaultValue() const
Definition: OptionValueFileSpec.h:58
lldb_private::OptionValueFileSpec::SetCurrentValue
void SetCurrentValue(const FileSpec &value, bool set_value_was_set)
Definition: OptionValueFileSpec.h:60
lldb_private::OptionValueFileSpec::GetCurrentValue
FileSpec & GetCurrentValue()
Definition: OptionValueFileSpec.h:54
OptionValue.h
lldb_private::OptionValueFileSpec
Definition: OptionValueFileSpec.h:20
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
lldb_private::OptionValue::eTypeFileSpec
@ eTypeFileSpec
Definition: OptionValue.h:36
lldb_private::OptionValueFileSpec::AutoComplete
void AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override
Definition: OptionValueFileSpec.cpp:85
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::Status
Definition: Status.h:44
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
lldb_private::OptionValueFileSpec::m_data_sp
lldb::DataBufferSP m_data_sp
Definition: OptionValueFileSpec.h:76
uint32_t
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition: OptionValue.h:332
lldb_private::OptionValueFileSpec::m_default_value
FileSpec m_default_value
Definition: OptionValueFileSpec.h:75
lldb_private::OptionValueFileSpec::m_data_mod_time
llvm::sys::TimePoint m_data_mod_time
Definition: OptionValueFileSpec.h:77
lldb_private::OptionValueFileSpec::GetFileContents
const lldb::DataBufferSP & GetFileContents()
Definition: OptionValueFileSpec.cpp:91
lldb_private::OptionValueFileSpec::GetCurrentValue
const FileSpec & GetCurrentValue() const
Definition: OptionValueFileSpec.h:56
lldb_private::OptionValueFileSpec::SetCompletionMask
void SetCompletionMask(uint32_t mask)
Definition: OptionValueFileSpec.h:71
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionValueFileSpec::OptionValueFileSpec
OptionValueFileSpec(bool resolve=true)
Definition: OptionValueFileSpec.cpp:21
FileSpec.h
lldb_private::OptionValueFileSpec::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition: OptionValueFileSpec.cpp:49
lldb_private::OptionValueFileSpec::Clear
void Clear() override
Definition: OptionValueFileSpec.h:42
lldb_private::OptionValueFileSpec::~OptionValueFileSpec
~OptionValueFileSpec() override=default
lldb_private::OptionValueFileSpec::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition: OptionValueFileSpec.cpp:35
lldb_private::CommandCompletions::eDiskFileCompletion
@ eDiskFileCompletion
Definition: CommandCompletions.h:29
CommandCompletions.h
lldb_private::OptionValueFileSpec::GetType
OptionValue::Type GetType() const override
Definition: OptionValueFileSpec.h:33
lldb_private::OptionValueFileSpec::m_resolve
bool m_resolve
Definition: OptionValueFileSpec.h:79
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90