LLDB
mainline
llvm-project
lldb
include
lldb
Interpreter
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 LLDB_INTERPRETER_OPTIONVALUESINT64_H
11
#define LLDB_INTERPRETER_OPTIONVALUESINT64_H
12
13
#include "
lldb/Interpreter/OptionValue.h
"
14
15
namespace
lldb_private
{
16
17
class
OptionValueSInt64
:
public
Cloneable
<OptionValueSInt64, OptionValue> {
18
public
:
19
OptionValueSInt64
() =
default
;
20
21
OptionValueSInt64
(int64_t value)
22
:
m_current_value
(value),
m_default_value
(value) {}
23
24
OptionValueSInt64
(int64_t current_value, int64_t default_value)
25
:
m_current_value
(current_value),
m_default_value
(default_value) {}
26
27
OptionValueSInt64
(
const
OptionValueSInt64
&rhs) =
default
;
28
29
~OptionValueSInt64
()
override
=
default
;
30
31
// Virtual subclass pure virtual overrides
32
33
OptionValue::Type
GetType
()
const override
{
return
eTypeSInt64
; }
34
35
void
DumpValue
(
const
ExecutionContext
*exe_ctx,
Stream
&strm,
36
uint32_t dump_mask)
override
;
37
38
llvm::json::Value
ToJSON
(
const
ExecutionContext
*exe_ctx)
const override
{
39
return
m_current_value
;
40
}
41
42
Status
43
SetValueFromString
(llvm::StringRef value,
44
VarSetOperationType
op =
eVarSetOperationAssign
)
override
;
45
46
void
Clear
()
override
{
47
m_current_value
=
m_default_value
;
48
m_value_was_set
=
false
;
49
}
50
51
bool
IsDefault
()
const override
{
return
m_current_value
==
m_default_value
; }
52
53
// Subclass specific functions
54
55
const
int64_t &
operator=
(int64_t value) {
56
m_current_value
= value;
57
return
m_current_value
;
58
}
59
60
int64_t
GetCurrentValue
()
const
{
return
m_current_value
; }
61
62
int64_t
GetDefaultValue
()
const
{
return
m_default_value
; }
63
64
bool
SetCurrentValue
(int64_t value) {
65
if
(value >=
m_min_value
&& value <=
m_max_value
) {
66
m_current_value
= value;
67
return
true
;
68
}
69
return
false
;
70
}
71
72
bool
SetDefaultValue
(int64_t value) {
73
assert(value >=
m_min_value
&& value <=
m_max_value
&&
74
"disallowed default value"
);
75
m_default_value
= value;
76
return
true
;
77
}
78
79
void
SetMinimumValue
(int64_t v) {
m_min_value
= v; }
80
81
int64_t
GetMinimumValue
()
const
{
return
m_min_value
; }
82
83
void
SetMaximumValue
(int64_t v) {
m_max_value
= v; }
84
85
int64_t
GetMaximumValue
()
const
{
return
m_max_value
; }
86
87
protected
:
88
int64_t
m_current_value
= 0;
89
int64_t
m_default_value
= 0;
90
int64_t
m_min_value
= std::numeric_limits<int64_t>::min();
91
int64_t
m_max_value
= std::numeric_limits<int64_t>::max();
92
};
93
94
}
// namespace lldb_private
95
96
#endif
// LLDB_INTERPRETER_OPTIONVALUESINT64_H
OptionValue.h
lldb_private::Cloneable
A class that implements CRTP-based "virtual constructor" idiom.
Definition
Cloneable.h:40
lldb_private::ExecutionContext
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Definition
ExecutionContext.h:294
lldb_private::OptionValueSInt64::SetCurrentValue
bool SetCurrentValue(int64_t value)
Definition
OptionValueSInt64.h:64
lldb_private::OptionValueSInt64::SetMaximumValue
void SetMaximumValue(int64_t v)
Definition
OptionValueSInt64.h:83
lldb_private::OptionValueSInt64::m_max_value
int64_t m_max_value
Definition
OptionValueSInt64.h:91
lldb_private::OptionValueSInt64::GetCurrentValue
int64_t GetCurrentValue() const
Definition
OptionValueSInt64.h:60
lldb_private::OptionValueSInt64::OptionValueSInt64
OptionValueSInt64(int64_t current_value, int64_t default_value)
Definition
OptionValueSInt64.h:24
lldb_private::OptionValueSInt64::OptionValueSInt64
OptionValueSInt64()=default
lldb_private::OptionValueSInt64::m_current_value
int64_t m_current_value
Definition
OptionValueSInt64.h:88
lldb_private::OptionValueSInt64::SetMinimumValue
void SetMinimumValue(int64_t v)
Definition
OptionValueSInt64.h:79
lldb_private::OptionValueSInt64::~OptionValueSInt64
~OptionValueSInt64() override=default
lldb_private::OptionValueSInt64::m_default_value
int64_t m_default_value
Definition
OptionValueSInt64.h:89
lldb_private::OptionValueSInt64::GetMinimumValue
int64_t GetMinimumValue() const
Definition
OptionValueSInt64.h:81
lldb_private::OptionValueSInt64::IsDefault
bool IsDefault() const override
Return true if the current value equals the default value.
Definition
OptionValueSInt64.h:51
lldb_private::OptionValueSInt64::GetDefaultValue
int64_t GetDefaultValue() const
Definition
OptionValueSInt64.h:62
lldb_private::OptionValueSInt64::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition
OptionValueSInt64.cpp:17
lldb_private::OptionValueSInt64::Clear
void Clear() override
Definition
OptionValueSInt64.h:46
lldb_private::OptionValueSInt64::operator=
const int64_t & operator=(int64_t value)
Definition
OptionValueSInt64.h:55
lldb_private::OptionValueSInt64::SetDefaultValue
bool SetDefaultValue(int64_t value)
Definition
OptionValueSInt64.h:72
lldb_private::OptionValueSInt64::OptionValueSInt64
OptionValueSInt64(const OptionValueSInt64 &rhs)=default
lldb_private::OptionValueSInt64::OptionValueSInt64
OptionValueSInt64(int64_t value)
Definition
OptionValueSInt64.h:21
lldb_private::OptionValueSInt64::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition
OptionValueSInt64.cpp:38
lldb_private::OptionValueSInt64::ToJSON
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
Definition
OptionValueSInt64.h:38
lldb_private::OptionValueSInt64::GetMaximumValue
int64_t GetMaximumValue() const
Definition
OptionValueSInt64.h:85
lldb_private::OptionValueSInt64::GetType
OptionValue::Type GetType() const override
Definition
OptionValueSInt64.h:33
lldb_private::OptionValueSInt64::m_min_value
int64_t m_min_value
Definition
OptionValueSInt64.h:90
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition
OptionValue.h:367
lldb_private::OptionValue::Type
Type
Definition
OptionValue.h:34
lldb_private::OptionValue::eTypeSInt64
@ eTypeSInt64
Definition
OptionValue.h:51
lldb_private::Status
An error handling class.
Definition
Status.h:118
lldb_private::Stream
A stream class that can stream formatted output to a file.
Definition
Stream.h:28
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition
lldb-private-enumerations.h:86
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition
lldb-private-enumerations.h:93
Generated on
for LLDB by
1.14.0