LLDB  mainline
OptionValueSInt64.h
Go to the documentation of this file.
1 //===-- OptionValueSInt64.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_OptionValueSInt64_h_
11 #define liblldb_OptionValueSInt64_h_
12 
14 
15 namespace lldb_private {
16 
18 public:
21  m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
22 
23  OptionValueSInt64(int64_t value)
24  : OptionValue(), m_current_value(value), m_default_value(value),
25  m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
26 
27  OptionValueSInt64(int64_t current_value, int64_t default_value)
28  : OptionValue(), m_current_value(current_value),
29  m_default_value(default_value), m_min_value(INT64_MIN),
30  m_max_value(INT64_MAX) {}
31 
35  m_max_value(rhs.m_max_value) {}
36 
37  ~OptionValueSInt64() override {}
38 
39  // Virtual subclass pure virtual overrides
40 
41  OptionValue::Type GetType() const override { return eTypeSInt64; }
42 
43  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
44  uint32_t dump_mask) override;
45 
46  Status
47  SetValueFromString(llvm::StringRef value,
49  Status
50  SetValueFromString(const char *,
52 
53  bool Clear() override {
55  m_value_was_set = false;
56  return true;
57  }
58 
59  lldb::OptionValueSP DeepCopy() const override;
60 
61  // Subclass specific functions
62 
63  const int64_t &operator=(int64_t value) {
64  m_current_value = value;
65  return m_current_value;
66  }
67 
68  int64_t GetCurrentValue() const { return m_current_value; }
69 
70  int64_t GetDefaultValue() const { return m_default_value; }
71 
72  bool SetCurrentValue(int64_t value) {
73  if (value >= m_min_value && value <= m_max_value) {
74  m_current_value = value;
75  return true;
76  }
77  return false;
78  }
79 
80  bool SetDefaultValue(int64_t value) {
81  if (value >= m_min_value && value <= m_max_value) {
82  m_default_value = value;
83  return true;
84  }
85  return false;
86  }
87 
88  void SetMinimumValue(int64_t v) { m_min_value = v; }
89 
90  int64_t GetMinimumValue() const { return m_min_value; }
91 
92  void SetMaximumValue(int64_t v) { m_max_value = v; }
93 
94  int64_t GetMaximumValue() const { return m_max_value; }
95 
96 protected:
97  int64_t m_current_value;
98  int64_t m_default_value;
99  int64_t m_min_value;
100  int64_t m_max_value;
101 };
102 
103 } // namespace lldb_private
104 
105 #endif // liblldb_OptionValueSInt64_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
OptionValueSInt64(const OptionValueSInt64 &rhs)
VarSetOperationType
Settable state variable types.
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
bool SetDefaultValue(int64_t value)
bool SetCurrentValue(int64_t value)
const int64_t & operator=(int64_t value)
OptionValue::Type GetType() const override
lldb::OptionValueSP DeepCopy() const override
OptionValueSInt64(int64_t current_value, int64_t default_value)
An error handling class.
Definition: Status.h:44