ROSE 2.1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::Strings::FilterSpecification Class Reference

Description

Specification for a single filter criterion.

FilterSpecification provides a type-safe way to specify string matching criteria for use with StringFilter. Each specification defines one of three types of matching: exact match, substring match, or regular expression match. For regular expressions, case sensitivity must be explicitly specified.

Design Intent: All filter semantics are explicit at construction. Users state the filter type and, for regex filters, the case sensitivity.

Thread Safety: FilterSpecification objects are immutable after construction and thus thread-safe for concurrent read access.

Usage Examples:

// Exact match - will only match the exact string "error"
FilterSpecification exact(FSType::EXACT_MATCH, "error");
// Substring match - will match any string containing "lib"
FilterSpecification substring(FSType::SUBSTRING, "lib");
// Case-sensitive regex - matches "Error" but not "error" or "ERROR"
FilterSpecification caseSensitive("Error", FSCase::SENSITIVE);
// Case-insensitive regex - matches "error", "Error", "ERROR", etc.
FilterSpecification caseInsensitive("error", FSCase::INSENSITIVE);
// Complex regex pattern with case sensitivity
FilterSpecification pattern("^ERR[0-9]+:", FSCase::SENSITIVE);
Specification for a single filter criterion.
Definition String.h:227
const std::string & pattern() const
Property: Pattern string.
Definition String.h:272
CaseSensitivity
Regex case sensitivity mode.
Definition String.h:237
See also
StringFilter

Definition at line 227 of file String.h.

#include <Rose/BinaryAnalysis/String.h>

Public Types

enum class  Type {
  EXACT_MATCH ,
  SUBSTRING ,
  REGEX
}
 Type of filter specification. More...
 
enum class  CaseSensitivity {
  SENSITIVE ,
  INSENSITIVE
}
 Regex case sensitivity mode. More...
 

Public Member Functions

 FilterSpecification (Type type, const std::string &pattern)
 Constructor for exact match or substring filter.
 
 FilterSpecification (const std::string &pattern, CaseSensitivity caseSensitivity)
 Constructor for regex filter with explicit case sensitivity.
 
Type type () const
 Property: Type of filter.
 
const std::string & pattern () const
 Property: Pattern string.
 
CaseSensitivity caseSensitivity () const
 Property: Case sensitivity (only meaningful for REGEX type).
 
bool isCaseSensitive () const
 Returns true if this is a case-sensitive regex filter.
 

Member Enumeration Documentation

◆ Type

Type of filter specification.

Enumerator
EXACT_MATCH 

Exact string match (case-sensitive)

SUBSTRING 

Substring match (case-sensitive)

REGEX 

Regular expression match.

Definition at line 230 of file String.h.

◆ CaseSensitivity

Regex case sensitivity mode.

Enumerator
SENSITIVE 

Case-sensitive matching.

INSENSITIVE 

Case-insensitive matching.

Definition at line 237 of file String.h.

Constructor & Destructor Documentation

◆ FilterSpecification() [1/2]

Rose::BinaryAnalysis::Strings::FilterSpecification::FilterSpecification ( Type  type,
const std::string &  pattern 
)

Constructor for exact match or substring filter.

Creates a filter specification for exact string matching or substring matching. Exact match requires the entire string to match exactly (case-sensitive). Substring match succeeds if the pattern appears anywhere in the string (case-sensitive).

Parameters
typeMust be Type::EXACT_MATCH or Type::SUBSTRING
patternThe string pattern to match

◆ FilterSpecification() [2/2]

Rose::BinaryAnalysis::Strings::FilterSpecification::FilterSpecification ( const std::string &  pattern,
CaseSensitivity  caseSensitivity 
)

Constructor for regex filter with explicit case sensitivity.

Creates a filter specification for regular expression matching. The pattern is interpreted as a boost::regex pattern using ECMAScript syntax. Case sensitivity must be explicitly specified.

Parameters
patternThe regular expression pattern (ECMAScript syntax)
caseSensitivityWhether to match case-sensitively or case-insensitively

Member Function Documentation

◆ type()

Type Rose::BinaryAnalysis::Strings::FilterSpecification::type ( ) const
inline

Property: Type of filter.

Definition at line 269 of file String.h.

◆ pattern()

const std::string & Rose::BinaryAnalysis::Strings::FilterSpecification::pattern ( ) const
inline

Property: Pattern string.

Definition at line 272 of file String.h.

◆ caseSensitivity()

CaseSensitivity Rose::BinaryAnalysis::Strings::FilterSpecification::caseSensitivity ( ) const
inline

Property: Case sensitivity (only meaningful for REGEX type).

Definition at line 275 of file String.h.

◆ isCaseSensitive()

bool Rose::BinaryAnalysis::Strings::FilterSpecification::isCaseSensitive ( ) const
inline

Returns true if this is a case-sensitive regex filter.

Definition at line 278 of file String.h.


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