From 2c5ea739e7f9536aec46f09500ef5e42fa1e2b1f Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Thu, 14 Nov 2019 16:27:14 -0300 Subject: [PATCH] csharp: Add IEquatable on classes. Summary: ref T8418 Reviewers: lauromoura, felipealmeida, segfaultxavi, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8418 Differential Revision: https://phab.enlightenment.org/D10647 --- .../mono/eina_mono/eina_container_common.cs | 96 +++++++- src/bindings/mono/eina_mono/eina_hash.cs | 48 +++- src/bindings/mono/eina_mono/eina_slice.cs | 90 +++++++- src/bindings/mono/eina_mono/eina_value.cs | 45 +++- .../mono/eldbus_mono/eldbus_common.cs | 132 ++++++++++- src/bindings/mono/eo_mono/EoWrapper.cs | 48 +++- src/bindings/mono/eo_mono/workaround.cs | 209 +++++++++++++++++- 7 files changed, 654 insertions(+), 14 deletions(-) diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs index 7b94ab7924..5366fab20c 100644 --- a/src/bindings/mono/eina_mono/eina_container_common.cs +++ b/src/bindings/mono/eina_mono/eina_container_common.cs @@ -43,19 +43,111 @@ public enum ElementType [EditorBrowsable(EditorBrowsableState.Never)] [StructLayout(LayoutKind.Sequential)] -public struct InlistMem +public struct InlistMem : IEquatable { public IntPtr next {get;set;} public IntPtr prev {get;set;} public IntPtr last {get;set;} + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => next.GetHashCode() ^ prev.GetHashCode() ^ last.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is InlistMem)) ? false : Equals((InlistMem)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(InlistMem other) + => (next == other.next) && (prev == other.prev) + && (last == other.last); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(InlistMem lhs, InlistMem rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(InlistMem lhs, InlistMem rhs) => !(lhs == rhs); } [EditorBrowsable(EditorBrowsableState.Never)] [StructLayout(LayoutKind.Sequential)] -public struct InlistNode +public struct InlistNode : IEquatable> { public InlistMem __in_list {get;set;} public T Val {get;set;} + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => __in_list.GetHashCode() ^ Val.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is InlistNode)) ? false : Equals((InlistNode)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(InlistNode other) + => (__in_list == other.__in_list) && (Val.Equals(other.Val)); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(InlistNode lhs, InlistNode rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(InlistNode lhs, InlistNode rhs) + => !(lhs == rhs); } [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/src/bindings/mono/eina_mono/eina_hash.cs b/src/bindings/mono/eina_mono/eina_hash.cs index 29f0d0ddcd..c254d58ae5 100644 --- a/src/bindings/mono/eina_mono/eina_hash.cs +++ b/src/bindings/mono/eina_mono/eina_hash.cs @@ -30,11 +30,57 @@ namespace Eina [StructLayout(LayoutKind.Sequential)] [EditorBrowsable(EditorBrowsableState.Never)] -public struct HashTupleNative +public struct HashTupleNative : IEquatable { public IntPtr key; public IntPtr data; public uint key_length; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => key.GetHashCode() ^ data.GetHashCode() ^ key_length.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is HashTupleNative)) ? false : Equals((HashTupleNative)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(HashTupleNative other) + => (key == other.key) && (data == other.data) + && (key_length == other.key_length); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(HashTupleNative lhs, HashTupleNative rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(HashTupleNative lhs, HashTupleNative rhs) => !(lhs == rhs); } [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/src/bindings/mono/eina_mono/eina_slice.cs b/src/bindings/mono/eina_mono/eina_slice.cs index 8bf056e37b..c7a1fd984f 100644 --- a/src/bindings/mono/eina_mono/eina_slice.cs +++ b/src/bindings/mono/eina_mono/eina_slice.cs @@ -52,7 +52,7 @@ public interface ISliceBase /// Since EFL 1.23. /// [StructLayout(LayoutKind.Sequential)] -public struct Slice : ISliceBase +public struct Slice : ISliceBase, IEquatable { /// /// The length of this slice. @@ -87,6 +87,49 @@ public struct Slice : ISliceBase Mem = mem; Len = len; } + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => Length.GetHashCode() ^ Mem.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is Slice)) ? false : Equals((Slice)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(Slice other) + => (Length == other.Length) ^ (Mem == other.Mem); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24 + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(Slice lhs, Slice rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(Slice lhs, Slice rhs) => !(lhs == rhs); } /// Pointer to a slice of native memory. @@ -94,7 +137,7 @@ public struct Slice : ISliceBase /// Since EFL 1.23. /// [StructLayout(LayoutKind.Sequential)] -public struct RwSlice : ISliceBase +public struct RwSlice : ISliceBase, IEquatable { /// /// The length of this slice. @@ -141,6 +184,49 @@ public struct RwSlice : ISliceBase r.Len = Len; return r; } + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => Mem.GetHashCode() ^ Length.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is RwSlice)) ? false : Equals((RwSlice)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(RwSlice other) + => (Length == other.Length) && (Mem == other.Mem); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(RwSlice lhs, RwSlice rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(RwSlice lhs, RwSlice rhs) => !(lhs == rhs); } } diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs index 12d43fd990..2a2508e08b 100644 --- a/src/bindings/mono/eina_mono/eina_value.cs +++ b/src/bindings/mono/eina_mono/eina_value.cs @@ -563,7 +563,7 @@ static internal class UnsafeNativeMethods /// [StructLayout(LayoutKind.Sequential)] [EditorBrowsable(EditorBrowsableState.Never)] -public struct ValueNative +public struct ValueNative : IEquatable { public IntPtr Type; public IntPtr Value; // Actually an Eina_Value_Union, but it is padded to 8 bytes. @@ -572,6 +572,49 @@ public struct ValueNative { return $"ValueNative"; } + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => Type.GetHashCode() ^ Value.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is ValueNative)) ? false : Equals((ValueNative)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(ValueNative other) + => (Type == other.Type) ^ (Value == other.Value); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(ValueNative lhs, ValueNative rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(ValueNative lhs, ValueNative rhs) => !(lhs == rhs); } /// Exception for failures when setting an container item. diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs index ed32cbbc5c..b6306953a1 100644 --- a/src/bindings/mono/eldbus_mono/eldbus_common.cs +++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs @@ -41,7 +41,7 @@ public static class Timeout /// Since EFL 1.23. /// [StructLayout(LayoutKind.Sequential)] -public struct ObjectPath +public struct ObjectPath : IEquatable { /// /// The string of the path. @@ -86,6 +86,48 @@ public struct ObjectPath /// /// The ObjectPath to be converted. public static string ToString(ObjectPath path) => path.value; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => value.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is ObjectPath)) ? false : Equals((ObjectPath)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(ObjectPath other) => value == other.value; + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(ObjectPath lhs, ObjectPath rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(ObjectPath lhs, ObjectPath rhs) => !(lhs == rhs); } @@ -94,7 +136,7 @@ public struct ObjectPath /// Since EFL 1.23. /// [StructLayout(LayoutKind.Sequential)] -public struct SignatureString +public struct SignatureString : IEquatable { /// /// The string of the signature. @@ -137,6 +179,48 @@ public struct SignatureString => ToString(sig); public static string ToString(SignatureString sig) => sig.value; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => value.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is SignatureString)) ? false : Equals((SignatureString)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(SignatureString other) => value == other.value; + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(SignatureString lhs, SignatureString rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(SignatureString lhs, SignatureString rhs) => !(lhs == rhs); } /// @@ -144,7 +228,7 @@ public struct SignatureString /// Since EFL 1.23. /// [StructLayout(LayoutKind.Sequential)] -public struct UnixFd +public struct UnixFd : IEquatable { /// /// The value of the file descriptor. @@ -189,6 +273,48 @@ public struct UnixFd /// /// The to be converted. public static Int32 ToInt32(UnixFd unix_fd) => unix_fd.value; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => value.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is UnixFd)) ? false : Equals((UnixFd)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(UnixFd other) => value == other.value; + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(UnixFd lhs, UnixFd rhs) => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(UnixFd lhs, UnixFd rhs) => !(lhs == rhs); } /// /// Arguments of EldBus. diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs index 0ab80e503a..554f4ec9bd 100644 --- a/src/bindings/mono/eo_mono/EoWrapper.cs +++ b/src/bindings/mono/eo_mono/EoWrapper.cs @@ -404,7 +404,7 @@ public abstract class EoWrapper : IWrapper, IDisposable /// Wraps the pointer handle to the native object instance. /// Since EFL 1.23. /// - protected struct ConstructingHandle + protected struct ConstructingHandle : IEquatable { /// Constructor for wrapping the native handle. /// Since EFL 1.23. @@ -418,6 +418,52 @@ public abstract class EoWrapper : IWrapper, IDisposable /// Since EFL 1.23. /// public IntPtr NativeHandle { get; private set; } + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() => NativeHandle.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is ConstructingHandle)) + ? false : Equals((ConstructingHandle)other); + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(ConstructingHandle other) + => NativeHandle == other.NativeHandle; + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(ConstructingHandle lhs, ConstructingHandle rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(ConstructingHandle lhs, ConstructingHandle rhs) + => !(lhs == rhs); } /// diff --git a/src/bindings/mono/eo_mono/workaround.cs b/src/bindings/mono/eo_mono/workaround.cs index b946a06d44..107a7cd237 100644 --- a/src/bindings/mono/eo_mono/workaround.cs +++ b/src/bindings/mono/eo_mono/workaround.cs @@ -21,7 +21,7 @@ using System.Collections.Generic; ///Eo class description, passed to efl_class_new. [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)] -internal struct ClassDescription +internal struct ClassDescription : IEquatable { ///Current Eo version. internal uint version; @@ -37,6 +37,55 @@ internal struct ClassDescription internal IntPtr class_constructor; ///Destructor of the class. internal IntPtr class_destructor; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => version.GetHashCode() ^ name.GetHashCode() + ^ class_type ^ data_size.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is ClassDescription)) ? false + : Equals((ClassDescription)other); + + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(ClassDescription other) + => (name == other.name) && (class_type == other.class_type); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(ClassDescription lhs, ClassDescription rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(ClassDescription lhs, ClassDescription rhs) + => !(lhs == rhs); } ///Description of an Eo API operation. @@ -198,33 +247,185 @@ internal delegate void EventCb(System.IntPtr data, ref Event.NativeStruct evt); internal delegate void FreeWrapperSupervisorCb(System.IntPtr obj); [StructLayout(LayoutKind.Sequential)] -public struct TextCursorCursor +public struct TextCursorCursor : IEquatable { IntPtr obj; UIntPtr pos; // UIntPtr to automatically change size_t between 32/64 IntPtr node; [MarshalAsAttribute(UnmanagedType.U1)]bool changed; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => obj.GetHashCode() ^ pos.GetHashCode() + ^ node.GetHashCode() ^ changed.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is TextCursorCursor)) ? false + : Equals((TextAnnotateAnnotation)other); + + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(TextCursorCursor other) + => (obj == other.obj) && (pos == other.pos) + && (node == other.node) && (changed == other.changed); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(TextCursorCursor lhs, TextCursorCursor rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(TextCursorCursor lhs, TextCursorCursor rhs) + => !(lhs == rhs); } [StructLayout(LayoutKind.Sequential)] -public struct TextAnnotateAnnotation +public struct TextAnnotateAnnotation : IEquatable { IntPtr list; IntPtr obj; IntPtr start_node; IntPtr end_node; [MarshalAsAttribute(UnmanagedType.U1)]bool is_item; + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => list.GetHashCode() ^ obj.GetHashCode() + ^ start_node.GetHashCode() ^ end_node.GetHashCode() + ^ is_item.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is TextAnnotateAnnotation)) ? false + : Equals((TextAnnotateAnnotation)other); + + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(TextAnnotateAnnotation other) + => (list == other.list) && (obj == other.obj) + && (start_node == other.start_node) && (is_item == other.is_item); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(TextAnnotateAnnotation lhs, TextAnnotateAnnotation rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(TextAnnotateAnnotation lhs, TextAnnotateAnnotation rhs) + => !(lhs == rhs); } namespace Access { -public struct ActionData +public struct ActionData : IEquatable { public IntPtr name; public IntPtr action; public IntPtr param; public IntPtr func; + + + /// + /// Gets a hash for . + /// Since EFL 1.24. + /// + /// A hash code. + public override int GetHashCode() + => name.GetHashCode() ^ action.GetHashCode() + ^ param.GetHashCode() ^ func.GetHashCode(); + + /// Returns whether this + /// is equal to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public override bool Equals(object other) + => (!(other is ActionData)) ? false + : Equals((ActionData)other); + + + /// Returns whether this is equal + /// to the given . + /// Since EFL 1.24. + /// + /// The to be compared to. + /// true if is equal to other. + public bool Equals(ActionData other) + => (name == other.name) && (action == other.action) + && (param == other.param) && (func == other.func); + + /// Returns whether lhs is equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is equal + /// to rhs. + public static bool operator==(ActionData lhs, ActionData rhs) + => lhs.Equals(rhs); + + /// Returns whether lhs is not equal to rhs. + /// Since EFL 1.24. + /// + /// The left hand side of the operator. + /// The right hand side of the operator. + /// true if lhs is not equal + /// to rhs. + public static bool operator!=(ActionData lhs, ActionData rhs) + => !(lhs == rhs); } } // namespace Access