summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono/eina_hash.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/eina_mono/eina_hash.cs')
-rw-r--r--src/bindings/mono/eina_mono/eina_hash.cs63
1 files changed, 62 insertions, 1 deletions
diff --git a/src/bindings/mono/eina_mono/eina_hash.cs b/src/bindings/mono/eina_mono/eina_hash.cs
index 54fd343..c254d58 100644
--- a/src/bindings/mono/eina_mono/eina_hash.cs
+++ b/src/bindings/mono/eina_mono/eina_hash.cs
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#pragma warning disable 1591 16#pragma warning disable 1591
2 17
3using System; 18using System;
@@ -15,11 +30,57 @@ namespace Eina
15 30
16[StructLayout(LayoutKind.Sequential)] 31[StructLayout(LayoutKind.Sequential)]
17[EditorBrowsable(EditorBrowsableState.Never)] 32[EditorBrowsable(EditorBrowsableState.Never)]
18public struct HashTupleNative 33public struct HashTupleNative : IEquatable<HashTupleNative>
19{ 34{
20 public IntPtr key; 35 public IntPtr key;
21 public IntPtr data; 36 public IntPtr data;
22 public uint key_length; 37 public uint key_length;
38
39 /// <summary>
40 /// Gets a hash for <see cref="HashTupleNative" />.
41 /// <para>Since EFL 1.24.</para>
42 /// </summary>
43 /// <returns>A hash code.</returns>
44 public override int GetHashCode()
45 => key.GetHashCode() ^ data.GetHashCode() ^ key_length.GetHashCode();
46
47 /// <summary>Returns whether this <see cref="HashTupleNative" />
48 /// is equal to the given <see cref="object" />.
49 /// <para>Since EFL 1.24.</para>
50 /// </summary>
51 /// <param name="other">The <see cref="object" /> to be compared to.</param>
52 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
53 public override bool Equals(object other)
54 => (!(other is HashTupleNative)) ? false : Equals((HashTupleNative)other);
55
56 /// <summary>Returns whether this <see cref="HashTupleNative" /> is equal
57 /// to the given <see cref="HashTupleNative" />.
58 /// <para>Since EFL 1.24.</para>
59 /// </summary>
60 /// <param name="other">The <see cref="HashTupleNative" /> to be compared to.</param>
61 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
62 public bool Equals(HashTupleNative other)
63 => (key == other.key) && (data == other.data)
64 && (key_length == other.key_length);
65
66 /// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
67 /// <para>Since EFL 1.24.</para>
68 /// </summary>
69 /// <param name="lhs">The left hand side of the operator.</param>
70 /// <param name="rhs">The right hand side of the operator.</param>
71 /// <returns><c>true</c> if <c>lhs</c> is equal
72 /// to <c>rhs</c>.</returns>
73 public static bool operator==(HashTupleNative lhs, HashTupleNative rhs)
74 => lhs.Equals(rhs);
75
76 /// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
77 /// <para>Since EFL 1.24.</para>
78 /// </summary>
79 /// <param name="lhs">The left hand side of the operator.</param>
80 /// <param name="rhs">The right hand side of the operator.</param>
81 /// <returns><c>true</c> if <c>lhs</c> is not equal
82 /// to <c>rhs</c>.</returns>
83 public static bool operator!=(HashTupleNative lhs, HashTupleNative rhs) => !(lhs == rhs);
23} 84}
24 85
25[EditorBrowsable(EditorBrowsableState.Never)] 86[EditorBrowsable(EditorBrowsableState.Never)]