-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIGlobalsDeclarer.cs
More file actions
100 lines (78 loc) · 3.49 KB
/
Copy pathIGlobalsDeclarer.cs
File metadata and controls
100 lines (78 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System.Collections.Generic;
namespace Screenplay
{
public interface IUntypedGlobalsDeclarer : IScreenplayNode
{
/// <summary> Guid for this declarer </summary>
guid Guid { get; set; }
/// <summary>
/// Return ids for each value this object declares.
/// Were <see cref="ValueIds"/>[i] can be used as input in <see cref="TryGetValue"/> to retrieve a value
/// </summary>
IEnumerable<guid> ValueIds { get; }
/// <summary> Try to get the actual value associated to a guid returned by <see cref="ValueIds"/> </summary>
bool TryGetValue(guid valueId, out object? value);
/// <summary> Fallback for previews </summary>
object? GetDefault(out guid valueId);
}
public interface IUntypedGlobalsProxy : IUntypedGlobalsDeclarer
{
/// <summary> The Proxy to forward calls to, may be self when this isn't a true proxy </summary>
IUntypedGlobalsDeclarer ProxyTarget { get; }
/// <inheritdoc/>
guid IUntypedGlobalsDeclarer.Guid
{
get => ProxyTarget.Guid;
set => ProxyTarget.Guid = value;
}
/// <inheritdoc/>
IEnumerable<guid> IUntypedGlobalsDeclarer.ValueIds => ProxyTarget.ValueIds;
/// <inheritdoc/>
bool IUntypedGlobalsDeclarer.TryGetValue(guid valueId, out object? value) => ProxyTarget.TryGetValue(valueId, out value);
/// <inheritdoc/>
object? IUntypedGlobalsDeclarer.GetDefault(out guid valueId) => ProxyTarget.GetDefault(out valueId);
}
public interface IGlobalsDeclarer<T> : IUntypedGlobalsDeclarer
{
/// <inheritdoc cref="IUntypedGlobalsDeclarer.TryGetValue"/>
bool TryGetValue(guid valueId, out T val);
/// <inheritdoc cref="IUntypedGlobalsDeclarer.GetDefault"/>
new T GetDefault(out guid guid);
/// <inheritdoc/>
bool IUntypedGlobalsDeclarer.TryGetValue(guid valueId, out object? value)
{
if (TryGetValue(valueId, out var o))
{
value = o;
return true;
}
value = null;
return false;
}
/// <inheritdoc/>
object? IUntypedGlobalsDeclarer.GetDefault(out guid valueId) => GetDefault(out valueId);
}
public interface IGlobalsProxy<T> : IGlobalsDeclarer<T>, IUntypedGlobalsProxy
{
/// <inheritdoc cref="IUntypedGlobalsProxy.ProxyTarget"/>
new IGlobalsDeclarer<T> ProxyTarget { get; }
/// <inheritdoc/>
guid IUntypedGlobalsDeclarer.Guid
{
get => ProxyTarget.Guid;
set => ProxyTarget.Guid = value;
}
/// <inheritdoc/>
IUntypedGlobalsDeclarer IUntypedGlobalsProxy.ProxyTarget => ProxyTarget;
/// <inheritdoc/>
IEnumerable<guid> IUntypedGlobalsDeclarer.ValueIds => ProxyTarget.ValueIds;
/// <inheritdoc cref="IUntypedGlobalsDeclarer.GetDefault"/>
object? IUntypedGlobalsDeclarer.GetDefault(out guid valueId) => ProxyTarget.GetDefault(out valueId);
/// <inheritdoc cref="IUntypedGlobalsDeclarer.TryGetValue"/>
bool IUntypedGlobalsDeclarer.TryGetValue(guid valueId, out object? val) => ProxyTarget.TryGetValue(valueId, out val);
/// <inheritdoc/>
bool IGlobalsDeclarer<T>.TryGetValue(guid valueId, out T val) => ProxyTarget.TryGetValue(valueId, out val);
/// <inheritdoc/>
T IGlobalsDeclarer<T>.GetDefault(out guid guid) => ProxyTarget.GetDefault(out guid);
}
}