Table of Contents

Class FlagsPattern<T>

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern for bitmasks.

public record FlagsPattern<T> : Pattern<T>, IEquatable<Pattern>, IEquatable<Pattern<T>>, IEquatable<FlagsPattern<T>> where T : Enum, IConvertible

Type Parameters

T

The type of bit mask

Inheritance
FlagsPattern<T>
Implements
Inherited Members

Constructors

FlagsPattern(FlagsPattern<T>)

protected FlagsPattern(FlagsPattern<T> original)

Parameters

original FlagsPattern<T>

FlagsPattern(T, T)

Defines the pattern for bitmasks.

public FlagsPattern(T ExpectedValue, T Mask)

Parameters

ExpectedValue T

The expected bit flags.

Mask T

The flags that should be tested within the bitmask.

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

ExpectedValue

The expected bit flags.

public T ExpectedValue { get; init; }

Property Value

T

Mask

The flags that should be tested within the bitmask.

public T Mask { get; init; }

Property Value

T

Methods

Deconstruct(out T, out T)

public void Deconstruct(out T ExpectedValue, out T Mask)

Parameters

ExpectedValue T
Mask T

Equals(FlagsPattern<T>?)

public virtual bool Equals(FlagsPattern<T>? other)

Parameters

other FlagsPattern<T>

Returns

bool

Equals(Pattern<T>?)

public override sealed bool Equals(Pattern<T>? other)

Parameters

other Pattern<T>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Format(IndentedTextWriter)

Serializes the pattern to a readable string.

public override void Format(IndentedTextWriter writer)

Parameters

writer IndentedTextWriter

The output stream.

GetHashCode()

public override int GetHashCode()

Returns

int

Match(T, MatchingContext)

Attempts to match the provided input to the pattern.

public override IMatchNode<T>? Match(T input, MatchingContext context)

Parameters

input T

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<T>

When successful, returns the root node of the match tree, otherwise null.

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Operators

operator ==(FlagsPattern<T>?, FlagsPattern<T>?)

public static bool operator ==(FlagsPattern<T>? left, FlagsPattern<T>? right)

Parameters

left FlagsPattern<T>
right FlagsPattern<T>

Returns

bool

operator !=(FlagsPattern<T>?, FlagsPattern<T>?)

public static bool operator !=(FlagsPattern<T>? left, FlagsPattern<T>? right)

Parameters

left FlagsPattern<T>
right FlagsPattern<T>

Returns

bool