This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
ARPlusSystem/ARPlusSystem-250418/Library/PackageCache/com.unity.xr.arkit@4.2.10/Runtime/Frameworks/ObjCRuntime/Class.cs

40 lines
1.1 KiB
C#

using System;
namespace UnityEngine.XR.ARKit
{
struct Class : IEquatable<Class>
{
IntPtr m_Self;
public override int GetHashCode() => m_Self.GetHashCode();
public override bool Equals(object obj) => obj is Class data && Equals(data);
public bool Equals(Class other) => m_Self == other.m_Self;
public static bool operator ==(Class lhs, Class rhs) => lhs.Equals(rhs);
public static bool operator !=(Class lhs, Class rhs) => !lhs.Equals(rhs);
public static bool operator ==(Class? lhs, Class? rhs)
{
// Both have a value, so compare values
if (lhs.HasValue && rhs.HasValue)
return lhs.Value.m_Self == rhs.Value.m_Self;
// lhs has a value; rhs is null
if (lhs.HasValue)
return lhs.Value.m_Self == IntPtr.Zero;
// rhs has a value; lhs is null
if (rhs.HasValue)
return rhs.Value.m_Self == IntPtr.Zero;
// Neither has a value
return true;
}
public static bool operator !=(Class? lhs, Class? rhs) => !(lhs == rhs);
}
}