LLDB  mainline
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 
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  Status
32  SetValueFromString(llvm::StringRef value,
34 
35  void Clear() override {
37  m_value_was_set = false;
38  }
39 
40  // Subclass specific functions
42  return (m_regex.IsValid() ? &m_regex : nullptr);
43  }
44 
45  void SetCurrentValue(const char *value) {
46  if (value && value[0])
47  m_regex = RegularExpression(llvm::StringRef(value));
48  else
50  }
51 
52  bool IsValid() const { return m_regex.IsValid(); }
53 
54 protected:
57 };
58 
59 } // namespace lldb_private
60 
61 #endif // LLDB_INTERPRETER_OPTIONVALUEREGEX_H
RegularExpression.h
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::OptionValueRegex::GetCurrentValue
const RegularExpression * GetCurrentValue() const
Definition: OptionValueRegex.h:41
lldb_private::OptionValueRegex::Clear
void Clear() override
Definition: OptionValueRegex.h:35
lldb_private::OptionValueRegex::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition: OptionValueRegex.cpp:16
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Cloneable
Definition: Cloneable.h:40
lldb_private::OptionValue::eTypeRegex
@ eTypeRegex
Definition: OptionValue.h:42
OptionValue.h
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
lldb_private::OptionValueRegex::OptionValueRegex
OptionValueRegex(const char *value=nullptr)
Definition: OptionValueRegex.h:19
lldb_private::RegularExpression::IsValid
bool IsValid() const
Test if this object contains a valid regular expression.
Definition: RegularExpression.cpp:31
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::OptionValueRegex::IsValid
bool IsValid() const
Definition: OptionValueRegex.h:52
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::OptionValueRegex::SetCurrentValue
void SetCurrentValue(const char *value)
Definition: OptionValueRegex.h:45
lldb_private::OptionValueRegex::m_default_regex_str
std::string m_default_regex_str
Definition: OptionValueRegex.h:56
lldb_private::OptionValueRegex::~OptionValueRegex
~OptionValueRegex() override=default
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionValueRegex::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition: OptionValueRegex.cpp:30
lldb_private::OptionValueRegex::m_regex
RegularExpression m_regex
Definition: OptionValueRegex.h:55
lldb_private::OptionValueRegex::GetType
OptionValue::Type GetType() const override
Definition: OptionValueRegex.h:26
lldb_private::OptionValueRegex
Definition: OptionValueRegex.h:17
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90