LLDB
mainline
llvm-project
lldb
include
lldb
Interpreter
OptionValueRegex.h
Go to the documentation of this file.
1
//===-- OptionValueRegex.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_OPTIONVALUEREGEX_H
10
#define LLDB_INTERPRETER_OPTIONVALUEREGEX_H
11
12
#include "
lldb/Interpreter/OptionValue.h
"
13
#include "
lldb/Utility/RegularExpression.h
"
14
15
namespace
lldb_private
{
16
17
class
OptionValueRegex
:
public
Cloneable
<OptionValueRegex, OptionValue> {
18
public
:
19
OptionValueRegex
(
const
char
*value =
nullptr
)
20
:
m_regex
(value),
m_default_regex_str
(value) {}
21
22
~OptionValueRegex
()
override
=
default
;
23
24
// Virtual subclass pure virtual overrides
25
26
OptionValue::Type
GetType
()
const override
{
return
eTypeRegex
; }
27
28
void
DumpValue
(
const
ExecutionContext
*exe_ctx,
Stream
&strm,
29
uint32_t dump_mask)
override
;
30
31
llvm::json::Value
ToJSON
(
const
ExecutionContext
*exe_ctx)
override
{
32
return
m_regex
.
GetText
();
33
}
34
35
Status
36
SetValueFromString
(llvm::StringRef value,
37
VarSetOperationType
op =
eVarSetOperationAssign
)
override
;
38
39
void
Clear
()
override
{
40
m_regex
=
RegularExpression
(
m_default_regex_str
);
41
m_value_was_set
=
false
;
42
}
43
44
// Subclass specific functions
45
const
RegularExpression
*
GetCurrentValue
()
const
{
46
return
(
m_regex
.
IsValid
() ? &
m_regex
:
nullptr
);
47
}
48
49
void
SetCurrentValue
(
const
char
*value) {
50
if
(value && value[0])
51
m_regex
=
RegularExpression
(llvm::StringRef(value));
52
else
53
m_regex
=
RegularExpression
();
54
}
55
56
bool
IsValid
()
const
{
return
m_regex
.
IsValid
(); }
57
58
protected
:
59
RegularExpression
m_regex
;
60
std::string
m_default_regex_str
;
61
};
62
63
}
// namespace lldb_private
64
65
#endif
// LLDB_INTERPRETER_OPTIONVALUEREGEX_H
OptionValue.h
RegularExpression.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:292
lldb_private::OptionValueRegex
Definition:
OptionValueRegex.h:17
lldb_private::OptionValueRegex::GetCurrentValue
const RegularExpression * GetCurrentValue() const
Definition:
OptionValueRegex.h:45
lldb_private::OptionValueRegex::GetType
OptionValue::Type GetType() const override
Definition:
OptionValueRegex.h:26
lldb_private::OptionValueRegex::IsValid
bool IsValid() const
Definition:
OptionValueRegex.h:56
lldb_private::OptionValueRegex::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition:
OptionValueRegex.cpp:30
lldb_private::OptionValueRegex::OptionValueRegex
OptionValueRegex(const char *value=nullptr)
Definition:
OptionValueRegex.h:19
lldb_private::OptionValueRegex::SetCurrentValue
void SetCurrentValue(const char *value)
Definition:
OptionValueRegex.h:49
lldb_private::OptionValueRegex::Clear
void Clear() override
Definition:
OptionValueRegex.h:39
lldb_private::OptionValueRegex::m_default_regex_str
std::string m_default_regex_str
Definition:
OptionValueRegex.h:60
lldb_private::OptionValueRegex::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition:
OptionValueRegex.cpp:16
lldb_private::OptionValueRegex::m_regex
RegularExpression m_regex
Definition:
OptionValueRegex.h:59
lldb_private::OptionValueRegex::~OptionValueRegex
~OptionValueRegex() override=default
lldb_private::OptionValueRegex::ToJSON
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
Definition:
OptionValueRegex.h:31
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition:
OptionValue.h:346
lldb_private::OptionValue::Type
Type
Definition:
OptionValue.h:33
lldb_private::OptionValue::eTypeRegex
@ eTypeRegex
Definition:
OptionValue.h:49
lldb_private::RegularExpression
Definition:
RegularExpression.h:18
lldb_private::RegularExpression::IsValid
bool IsValid() const
Test if this object contains a valid regular expression.
Definition:
RegularExpression.cpp:32
lldb_private::RegularExpression::GetText
llvm::StringRef GetText() const
Access the regular expression text.
Definition:
RegularExpression.cpp:34
lldb_private::Status
An error handling class.
Definition:
Status.h:44
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:85
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition:
lldb-private-enumerations.h:92
Generated on Wed Nov 20 2024 18:14:35 for LLDB by
1.9.6