| File: Internal\PatternContexts\PatternContext.cs | Web Access |
| Project: src\runtime\src\libraries\Microsoft.Extensions.FileSystemGlobbing\src\Microsoft.Extensions.FileSystemGlobbing.csproj (Microsoft.Extensions.FileSystemGlobbing) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using Microsoft.Extensions.FileSystemGlobbing.Abstractions; namespace Microsoft.Extensions.FileSystemGlobbing.Internal.PatternContexts { public abstract class PatternContext<TFrame> : IPatternContext where TFrame : struct { private readonly Stack<TFrame> _stack = new(); protected TFrame Frame; public virtual void Declare(Action<IPathSegment, bool> declare) { } public abstract PatternTestResult Test(FileInfoBase file); public abstract bool Test(DirectoryInfoBase directory); public abstract void PushDirectory(DirectoryInfoBase directory); public virtual void PopDirectory() { Frame = _stack.Pop(); } protected void PushDataFrame(TFrame frame) { _stack.Push(Frame); Frame = frame; } protected bool IsStackEmpty() { return _stack.Count == 0; } } }