LLDB  mainline
OptionValueUInt64.h
Go to the documentation of this file.
1 //===-- OptionValueUInt64.h --------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_INTERPRETER_OPTIONVALUEUINT64_H
11 #define LLDB_INTERPRETER_OPTIONVALUEUINT64_H
12 
14 
15 namespace lldb_private {
16 
17 class OptionValueUInt64 : public Cloneable<OptionValueUInt64, OptionValue> {
18 public:
19  OptionValueUInt64() = default;
20 
21  OptionValueUInt64(uint64_t value)
22  : m_current_value(value), m_default_value(value) {}
23 
24  OptionValueUInt64(uint64_t current_value, uint64_t default_value)
25  : m_current_value(current_value), m_default_value(default_value) {}
26 
27  ~OptionValueUInt64() override = default;
28 
29  // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
30  // inside of a lldb::OptionValueSP object if all goes well. If the string
31  // isn't a uint64_t value or any other error occurs, return an empty
32  // lldb::OptionValueSP and fill error in with the correct stuff.
33  static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error);
34  // Virtual subclass pure virtual overrides
35 
36  OptionValue::Type GetType() const override { return eTypeUInt64; }
37 
38  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39  uint32_t dump_mask) override;
40 
41  Status
42  SetValueFromString(llvm::StringRef value,
44 
45  void Clear() override {
47  m_value_was_set = false;
48  }
49 
50  // Subclass specific functions
51 
52  const uint64_t &operator=(uint64_t value) {
53  m_current_value = value;
54  return m_current_value;
55  }
56 
57  operator uint64_t() const { return m_current_value; }
58 
59  uint64_t GetCurrentValue() const { return m_current_value; }
60 
61  uint64_t GetDefaultValue() const { return m_default_value; }
62 
63  void SetCurrentValue(uint64_t value) { m_current_value = value; }
64 
65  void SetDefaultValue(uint64_t value) { m_default_value = value; }
66 
67 protected:
68  uint64_t m_current_value = 0;
69  uint64_t m_default_value = 0;
70 };
71 
72 } // namespace lldb_private
73 
74 #endif // LLDB_INTERPRETER_OPTIONVALUEUINT64_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::OptionValueUInt64::GetCurrentValue
uint64_t GetCurrentValue() const
Definition: OptionValueUInt64.h:59
lldb_private::OptionValue::eTypeUInt64
@ eTypeUInt64
Definition: OptionValue.h:45
lldb_private::OptionValueUInt64::OptionValueUInt64
OptionValueUInt64(uint64_t current_value, uint64_t default_value)
Definition: OptionValueUInt64.h:24
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Cloneable
Definition: Cloneable.h:40
OptionValue.h
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
lldb_private::OptionValueUInt64::OptionValueUInt64
OptionValueUInt64(uint64_t value)
Definition: OptionValueUInt64.h:21
lldb_private::OptionValueUInt64::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition: OptionValueUInt64.cpp:26
lldb_private::OptionValueUInt64::Create
static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error)
Definition: OptionValueUInt64.cpp:17
lldb_private::OptionValueUInt64::m_current_value
uint64_t m_current_value
Definition: OptionValueUInt64.h:68
lldb_private::OptionValueUInt64::Clear
void Clear() override
Definition: OptionValueUInt64.h:45
lldb_private::OptionValueUInt64::SetDefaultValue
void SetDefaultValue(uint64_t value)
Definition: OptionValueUInt64.h:65
lldb_private::OptionValueUInt64::m_default_value
uint64_t m_default_value
Definition: OptionValueUInt64.h:69
lldb_private::OptionValueUInt64::operator=
const uint64_t & operator=(uint64_t value)
Definition: OptionValueUInt64.h:52
lldb_private::OptionValueUInt64::~OptionValueUInt64
~OptionValueUInt64() override=default
lldb_private::OptionValueUInt64::GetType
OptionValue::Type GetType() const override
Definition: OptionValueUInt64.h:36
lldb_private::Status
Definition: Status.h:44
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
uint32_t
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition: OptionValue.h:332
lldb_private::OptionValueUInt64::GetDefaultValue
uint64_t GetDefaultValue() const
Definition: OptionValueUInt64.h:61
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionValueUInt64
Definition: OptionValueUInt64.h:17
lldb_private::OptionValueUInt64::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition: OptionValueUInt64.cpp:37
lldb_private::OptionValueUInt64::SetCurrentValue
void SetCurrentValue(uint64_t value)
Definition: OptionValueUInt64.h:63
lldb_private::OptionValueUInt64::OptionValueUInt64
OptionValueUInt64()=default
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90