LLDB mainline
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
lldb_private::TypeMatcher Class Reference

Class for matching type names. More...

#include <FormattersContainer.h>

Public Member Functions

 TypeMatcher ()=delete
 
 TypeMatcher (ConstString type_name)
 Creates a matcher that accepts any type with exactly the given type name.
 
 TypeMatcher (RegularExpression regex)
 Creates a matcher that accepts any type matching the given regex.
 
 TypeMatcher (lldb::TypeNameSpecifierImplSP type_specifier)
 Creates a matcher using the matching type and string from the given type name specifier.
 
bool Matches (FormattersMatchCandidate candidate_type) const
 True iff this matches the given type.
 
lldb::FormatterMatchType GetMatchType () const
 
ConstString GetMatchString () const
 Returns the underlying match string for this TypeMatcher.
 
bool CreatedBySameMatchString (TypeMatcher other) const
 Returns true if this TypeMatcher and the given one were most created by the same match string.
 

Static Private Member Functions

static ConstString StripTypeName (ConstString type)
 

Private Attributes

ConstString m_name
 Type name for exact match, or name of the python callback if m_match_type is eFormatterMatchCallback.
 
RegularExpression m_type_name_regex
 
lldb::FormatterMatchType m_match_type
 Indicates what kind of matching strategy should be used:
 

Detailed Description

Class for matching type names.

Definition at line 41 of file FormattersContainer.h.

Constructor & Destructor Documentation

◆ TypeMatcher() [1/4]

lldb_private::TypeMatcher::TypeMatcher ( )
delete

◆ TypeMatcher() [2/4]

lldb_private::TypeMatcher::TypeMatcher ( ConstString  type_name)
inline

Creates a matcher that accepts any type with exactly the given type name.

Definition at line 79 of file FormattersContainer.h.

◆ TypeMatcher() [3/4]

lldb_private::TypeMatcher::TypeMatcher ( RegularExpression  regex)
inline

Creates a matcher that accepts any type matching the given regex.

Definition at line 82 of file FormattersContainer.h.

◆ TypeMatcher() [4/4]

lldb_private::TypeMatcher::TypeMatcher ( lldb::TypeNameSpecifierImplSP  type_specifier)
inline

Creates a matcher using the matching type and string from the given type name specifier.

Definition at line 87 of file FormattersContainer.h.

References lldb::eFormatterMatchRegex, m_match_type, and m_type_name_regex.

Member Function Documentation

◆ CreatedBySameMatchString()

bool lldb_private::TypeMatcher::CreatedBySameMatchString ( TypeMatcher  other) const
inline

Returns true if this TypeMatcher and the given one were most created by the same match string.

The main purpose of this function is to find existing TypeMatcher instances by the user input that created them. This is necessary as LLDB allows referencing existing TypeMatchers in commands by the user input that originally created them: (lldb) type summary add –summary-string "A" -x TypeName (lldb) type summary delete TypeName

Definition at line 136 of file FormattersContainer.h.

References GetMatchString().

◆ GetMatchString()

ConstString lldb_private::TypeMatcher::GetMatchString ( ) const
inline

◆ GetMatchType()

lldb::FormatterMatchType lldb_private::TypeMatcher::GetMatchType ( ) const
inline

◆ Matches()

bool lldb_private::TypeMatcher::Matches ( FormattersMatchCandidate  candidate_type) const
inline

◆ StripTypeName()

static ConstString lldb_private::TypeMatcher::StripTypeName ( ConstString  type)
inlinestaticprivate

Member Data Documentation

◆ m_match_type

lldb::FormatterMatchType lldb_private::TypeMatcher::m_match_type
private

Indicates what kind of matching strategy should be used:

  • eFormatterMatchExact: match the exact type name in m_name.
  • eFormatterMatchRegex: match using the RegularExpression object m_type_name_regex instead.
  • eFormatterMatchCallback: run the function in m_name to decide if a type matches or not.

Definition at line 52 of file FormattersContainer.h.

Referenced by GetMatchString(), GetMatchType(), Matches(), and TypeMatcher().

◆ m_name

ConstString lldb_private::TypeMatcher::m_name
private

Type name for exact match, or name of the python callback if m_match_type is eFormatterMatchCallback.

Definition at line 44 of file FormattersContainer.h.

Referenced by GetMatchString(), and Matches().

◆ m_type_name_regex

RegularExpression lldb_private::TypeMatcher::m_type_name_regex
private

Definition at line 45 of file FormattersContainer.h.

Referenced by GetMatchString(), Matches(), and TypeMatcher().


The documentation for this class was generated from the following file: