mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
23 lines
694 B
C#
23 lines
694 B
C#
#nullable enable
|
|
namespace Terminal.Gui.Drivers;
|
|
|
|
/// <summary>
|
|
/// Implementation of <see cref="IHeld"/> for <see cref="AnsiResponseParser{TInputRecord}"/>
|
|
/// </summary>
|
|
/// <typeparam name="TInputRecord"></typeparam>
|
|
internal class GenericHeld<TInputRecord> : IHeld
|
|
{
|
|
private readonly List<Tuple<char, TInputRecord>> held = [];
|
|
|
|
public void ClearHeld () { held.Clear (); }
|
|
|
|
public string? HeldToString () { return new (held.Select (h => h.Item1).ToArray ()); }
|
|
|
|
public IEnumerable<object> HeldToObjects () { return held; }
|
|
|
|
public void AddToHeld (object o) { held.Add ((Tuple<char, TInputRecord>)o); }
|
|
|
|
/// <inheritdoc/>
|
|
public int Length => held.Count;
|
|
}
|