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 liblldb_OptionValueUInt64_h_
11 #define liblldb_OptionValueUInt64_h_
12 
14 
15 namespace lldb_private {
16 
18 public:
20 
21  OptionValueUInt64(uint64_t value)
22  : OptionValue(), m_current_value(value), m_default_value(value) {}
23 
24  OptionValueUInt64(uint64_t current_value, uint64_t default_value)
25  : OptionValue(), m_current_value(current_value),
26  m_default_value(default_value) {}
27 
28  ~OptionValueUInt64() override {}
29 
30  // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
31  // inside of a lldb::OptionValueSP object if all goes well. If the string
32  // isn't a uint64_t value or any other error occurs, return an empty
33  // lldb::OptionValueSP and fill error in with the correct stuff.
34  static lldb::OptionValueSP Create(const char *, Status &) = delete;
35  static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error);
36  // Virtual subclass pure virtual overrides
37 
38  OptionValue::Type GetType() const override { return eTypeUInt64; }
39 
40  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
41  uint32_t dump_mask) override;
42 
43  Status
44  SetValueFromString(llvm::StringRef value,
46  Status
47  SetValueFromString(const char *,
49 
50  bool Clear() override {
52  m_value_was_set = false;
53  return true;
54  }
55 
56  lldb::OptionValueSP DeepCopy() const override;
57 
58  // Subclass specific functions
59 
60  const uint64_t &operator=(uint64_t value) {
61  m_current_value = value;
62  return m_current_value;
63  }
64 
65  operator uint64_t() const { return m_current_value; }
66 
67  uint64_t GetCurrentValue() const { return m_current_value; }
68 
69  uint64_t GetDefaultValue() const { return m_default_value; }
70 
71  void SetCurrentValue(uint64_t value) { m_current_value = value; }
72 
73  void SetDefaultValue(uint64_t value) { m_default_value = value; }
74 
75 protected:
76  uint64_t m_current_value;
77  uint64_t m_default_value;
78 };
79 
80 } // namespace lldb_private
81 
82 #endif // liblldb_OptionValueUInt64_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
OptionValueUInt64(uint64_t current_value, uint64_t default_value)
OptionValue::Type GetType() const override
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
lldb::OptionValueSP DeepCopy() const override
VarSetOperationType
Settable state variable types.
void SetCurrentValue(uint64_t value)
void SetDefaultValue(uint64_t value)
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
static lldb::OptionValueSP Create(const char *, Status &)=delete
const uint64_t & operator=(uint64_t value)
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
An error handling class.
Definition: Status.h:44