33
44using MixedReality . Toolkit . Subsystems ;
55using System ;
6- using UnityEngine ;
7- using UnityEngine . SubsystemsImplementation ;
86
97namespace MixedReality . Toolkit . Accessibility
108{
119 /// <summary>
1210 /// Encapsulates the parameters for creating a new <see cref="AccessibilitySubsystemDescriptor"/>.
1311 /// </summary>
14- public struct AccessibilitySubsystemCinfo :
15- IEquatable < AccessibilitySubsystemCinfo > , IMRTKSubsystemDescriptor
16- {
17- #region IMRTKDescriptor implementation
18-
19- ///<inheritdoc/>
20- public string Name { get ; set ; }
21-
22- ///<inheritdoc/>
23- public string DisplayName { get ; set ; }
24-
25- ///<inheritdoc/>
26- public string Author { get ; set ; }
27-
28- ///<inheritdoc/>
29- public Type ConfigType { get ; set ; }
30-
31- ///<inheritdoc/>
32- public Type ProviderType { get ; set ; }
33-
34- ///<inheritdoc/>
35- public Type SubsystemTypeOverride { get ; set ; }
36-
37- #endregion IMRTKDescriptor implementation
38-
39- /// <summary>
40- /// Tests for equality.
41- /// </summary>
42- /// <param name="other">The other <see cref="AccessibilitySubsystemCinfo"/> to compare against.</param>
43- /// <returns>
44- /// <see langword="true"/> if every field in <paramref name="other"/> is equal to this
45- /// <see cref="AccessibilitySubsystemCinfo"/>, otherwise <see langword="false"/>.
46- /// </returns>
47- public bool Equals ( AccessibilitySubsystemCinfo other )
48- {
49- return
50- ReferenceEquals ( Name , other . Name )
51- && ReferenceEquals ( ProviderType , other . ProviderType )
52- && ReferenceEquals ( SubsystemTypeOverride , other . SubsystemTypeOverride ) ;
53- }
54-
55- /// <summary>
56- /// Tests for equality.
57- /// </summary>
58- /// <param name="obj">The `object` to compare against.</param>
59- /// <returns>
60- /// <see langword="true"/> if <paramref name="obj"/> is of type <see cref="AccessibilitySubsystemCinfo" /> and
61- /// <see cref="Equals(AccessibilitySubsystemCinfo)"/> also returns <see langword="true"/>,
62- /// otherwise <see langword="false"/>.
63- /// </returns>
64- public override bool Equals ( System . Object obj )
65- {
66- return ( obj is AccessibilitySubsystemCinfo cinfo ) && Equals ( cinfo ) ;
67- }
68-
69- /// <summary>
70- /// Tests for equality.
71- /// </summary>
72- /// <remarks>
73- /// This is a same as <see cref="Equals(AccessibilitySubsystemCinfo)"/>.
74- /// </remarks>
75- /// <param name="lhs">The left-hand side of the comparison.</param>
76- /// <param name="rhs">The right-hand side of the comparison.</param>
77- /// <returns>
78- /// <see langword="true"/> if <paramref name="lhs"/> is equal to <paramref name="rhs"/>,
79- /// otherwise <see langword="false"/>.
80- /// </returns>
81- public static bool operator == ( AccessibilitySubsystemCinfo lhs , AccessibilitySubsystemCinfo rhs )
82- {
83- return lhs . Equals ( rhs ) ;
84- }
85-
86- /// <summary>
87- /// Tests for inequality. Same as `!`<see cref="Equals(AccessibilitySubsystemCinfo)"/>.
88- /// </summary>
89- /// <param name="lhs">The left-hand side of the comparison.</param>
90- /// <param name="rhs">The right-hand side of the comparison.</param>
91- /// <returns><see langword="true"/> if <paramref name="lhs"/> is not equal to <paramref name="rhs"/>, otherwise <see langword="false"/>.</returns>
92- public static bool operator != ( AccessibilitySubsystemCinfo lhs , AccessibilitySubsystemCinfo rhs )
93- {
94- return ! ( lhs == rhs ) ;
95- }
96-
97- /// <summary>
98- /// This <see cref="GetHashCode"/> override is meant to disable hash lookups of
99- /// <see cref="AccessibilitySubsystemCinfo"/> objects.
100- /// </summary>
101- /// <remarks>
102- /// This will throw a <see cref="ApplicationException"/> if called.
103- /// </remarks>
104- /// <exception cref="ApplicationException">
105- /// Thrown if this function is called.
106- /// </exception>
107- public override int GetHashCode ( )
108- {
109- throw new ApplicationException ( "Do not hash subsystem descriptors as keys." ) ;
110- }
111- }
12+ public class AccessibilitySubsystemCinfo : MRTKSubsystemCinfo { }
11213
11314 /// <summary>
11415 /// Specifies a functionality description that may be registered for each implementation that provides the
11516 /// <see cref="AccessibilitySubsystem"/> interface.
11617 /// </summary>
11718 public class AccessibilitySubsystemDescriptor :
118- SubsystemDescriptorWithProvider < AccessibilitySubsystem , AccessibilitySubsystem . Provider > ,
119- IMRTKSubsystemDescriptor
19+ MRTKSubsystemDescriptor < AccessibilitySubsystem , AccessibilitySubsystem . Provider >
12020 {
12121 /// <summary>
12222 /// Initializes a new instance of the <see cref="AccessibilitySubsystemDescriptor"/> class.
12323 /// </summary>
124- /// <param name='accessibilitySubsystemCinfo'>The parameters required to initialize the descriptor.</param>
125- AccessibilitySubsystemDescriptor ( AccessibilitySubsystemCinfo accessibilitySubsystemCinfo )
126- {
127- Name = accessibilitySubsystemCinfo . Name ;
128- DisplayName = accessibilitySubsystemCinfo . DisplayName ;
129- Author = accessibilitySubsystemCinfo . Author ;
130- ProviderType = accessibilitySubsystemCinfo . ProviderType ;
131- SubsystemTypeOverride = accessibilitySubsystemCinfo . SubsystemTypeOverride ;
132- }
133-
134- #region IMRTKDescriptor implementation
135-
136- ///<inheritdoc/>
137- public string Name { get => id ; set => id = value ; }
138-
139- ///<inheritdoc/>
140- public string DisplayName { get ; set ; }
141-
142- ///<inheritdoc/>
143- public string Author { get ; set ; }
144-
145- ///<inheritdoc/>
146- public Type ConfigType { get ; set ; }
147-
148- ///<inheritdoc/>
149- public Type ProviderType { get => providerType ; set => providerType = value ; }
150-
151- ///<inheritdoc/>
152- public Type SubsystemTypeOverride { get => subsystemTypeOverride ; set => subsystemTypeOverride = value ; }
153-
154- #endregion IMRTKDescriptor implementation
24+ /// <param name="cinfo">The parameters required to initialize the descriptor.</param>
25+ AccessibilitySubsystemDescriptor ( AccessibilitySubsystemCinfo cinfo ) : base ( cinfo ) { }
15526
15627 /// <summary>
15728 /// Creates a <see cref="AccessibilitySubsystemDescriptor"/> based on the given parameters.
@@ -167,8 +38,8 @@ internal static AccessibilitySubsystemDescriptor Create(AccessibilitySubsystemCi
16738 {
16839 // Validates cinfo.
16940 if ( ! XRSubsystemHelpers . CheckTypes < AccessibilitySubsystem , AccessibilitySubsystem . Provider > ( cinfo . Name ,
170- cinfo . SubsystemTypeOverride ,
171- cinfo . ProviderType ) )
41+ cinfo . SubsystemTypeOverride ,
42+ cinfo . ProviderType ) )
17243 {
17344 throw new ArgumentException ( "Could not create AccessibilitySubsystemDescriptor." ) ;
17445 }
0 commit comments