forked from enlightenment/efl
Merge branch 'master' into devs/hermet/lottie
This commit is contained in:
commit
8e0b46975d
|
@ -0,0 +1 @@
|
|||
cp $@
|
|
@ -104,6 +104,7 @@ widget_preview_eps = custom_target('widget_preview_prefs_epc',
|
|||
|
||||
shot_sh = find_program('shot.sh')
|
||||
tar = find_program('tar')
|
||||
efl_copy = find_program('efl_copy.sh')
|
||||
|
||||
foreach text_filter_property : text_filter_properties
|
||||
text = text_filter_property[0]
|
||||
|
@ -181,10 +182,17 @@ doc_target += custom_target('doxygen',
|
|||
build_by_default: false
|
||||
)
|
||||
|
||||
# This is not pretty but meson does not seem to allow wildcards in plain cp commands
|
||||
copy_images = custom_target('documentation images',
|
||||
command: [efl_copy, '-rf', join_paths(meson.current_source_dir(), 'img', '*.png'), 'html'],
|
||||
output: ['empty_img_copy'],
|
||||
build_by_default: false
|
||||
)
|
||||
|
||||
compress_target = custom_target('package_doc_tar',
|
||||
command: [tar, '-C', meson.build_root(), '--xz', '-cf', 'efl-'+meson.project_version()+'-doc.tar.xz', 'html', 'man'],
|
||||
output: 'efl-'+meson.project_version()+'-doc.tar.xz',
|
||||
depends: doc_target,
|
||||
depends: [doc_target, copy_images],
|
||||
build_by_default: false
|
||||
)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ struct alias_definition_generator
|
|||
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
|
||||
if (!as_generator(
|
||||
documentation
|
||||
<< "public struct " << alias_name << "\n"
|
||||
<< "public struct " << alias_name << " : IEquatable<" << alias_name << ">\n"
|
||||
<< "{\n"
|
||||
<< scope_tab << "private " << alias_type << " payload;\n\n"
|
||||
|
||||
|
@ -93,7 +93,64 @@ struct alias_definition_generator
|
|||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << "return this;\n"
|
||||
<< scope_tab << "}\n"
|
||||
<< "}\n"
|
||||
).generate(sink, alias, context))
|
||||
return false;
|
||||
|
||||
std::string since_line;
|
||||
if (!alias.documentation.since.empty())
|
||||
if (!as_generator(scope_tab << "/// <para>Since EFL " + alias.documentation.since + ".</para>\n"
|
||||
).generate(std::back_inserter(since_line), attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// GetHashCode (needed by the equality comparisons)
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Get a hash code for this item.\n"
|
||||
<< since_line
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "public override int GetHashCode() => payload.GetHashCode();\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// IEquatble<T> Equals
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "public bool Equals(" << alias_name << " other) => payload == other.payload;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// ValueType.Equals
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "public override bool Equals(object other)\n"
|
||||
<< scope_tab << scope_tab << "=> ((other is " << alias_name << ") ? Equals((" << alias_name << ")other) : false);\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// Equality operators
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "public static bool operator ==(" << alias_name << " lhs, " << alias_name << " rhs)\n"
|
||||
<< scope_tab << scope_tab << "=> lhs.payload == rhs.payload;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "public static bool operator !=(" << alias_name << " lhs, " << alias_name << " rhs)\n"
|
||||
<< scope_tab << scope_tab << "=> lhs.payload != rhs.payload;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
if (!as_generator(
|
||||
"}\n"
|
||||
).generate(sink, alias, context))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -563,6 +563,17 @@ std::string translate_value_type(std::string const& name)
|
|||
return name;
|
||||
}
|
||||
|
||||
|
||||
// Field names //
|
||||
struct struct_field_name_generator
|
||||
{
|
||||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||
{
|
||||
return as_generator(string).generate(sink, name_helpers::to_field_name(field.name), context);
|
||||
}
|
||||
} const struct_field_name {};
|
||||
|
||||
} // namespace name_helpers
|
||||
|
||||
} // namespace eolian_mono
|
||||
|
@ -590,9 +601,18 @@ struct is_eager_generator<eolian_mono::name_helpers::klass_full_concrete_name_ge
|
|||
template <>
|
||||
struct is_generator<eolian_mono::name_helpers::klass_full_concrete_name_generator> : std::true_type {};
|
||||
|
||||
template <>
|
||||
struct is_eager_generator<eolian_mono::name_helpers::struct_field_name_generator> : std::true_type {};
|
||||
template <>
|
||||
struct is_generator< ::eolian_mono::name_helpers::struct_field_name_generator> : std::true_type {};
|
||||
|
||||
namespace type_traits {
|
||||
template <>
|
||||
struct attributes_needed<struct ::eolian_mono::name_helpers::klass_full_concrete_or_interface_name_generator> : std::integral_constant<int, 1> {};
|
||||
|
||||
template <>
|
||||
struct attributes_needed< ::eolian_mono::name_helpers::struct_field_name_generator> : std::integral_constant<int, 1> {};
|
||||
|
||||
}
|
||||
|
||||
} } }
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "grammar/indentation.hpp"
|
||||
#include "grammar/list.hpp"
|
||||
#include "grammar/alternative.hpp"
|
||||
#include "grammar/attribute_reorder.hpp"
|
||||
#include "name_helpers.hh"
|
||||
#include "helpers.hh"
|
||||
#include "type.hh"
|
||||
|
@ -408,14 +409,15 @@ struct struct_definition_generator
|
|||
auto const& indent = current_indentation(context);
|
||||
if(!as_generator(documentation).generate(sink, struct_, context))
|
||||
return false;
|
||||
auto struct_managed_name = binding_struct_name(struct_);
|
||||
if(!as_generator
|
||||
(
|
||||
indent << "[StructLayout(LayoutKind.Sequential)]\n"
|
||||
<< indent << "[Efl.Eo.BindingEntity]\n"
|
||||
<< indent << "public struct " << string << "\n"
|
||||
<< indent << "public struct " << struct_managed_name << " : IEquatable<" << struct_managed_name << ">\n"
|
||||
<< indent << "{\n"
|
||||
)
|
||||
.generate(sink, binding_struct_name(struct_), context))
|
||||
.generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// iterate struct fields
|
||||
|
@ -472,6 +474,114 @@ struct struct_definition_generator
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string since_line;
|
||||
if (!struct_.documentation.since.empty())
|
||||
if (!as_generator(indent << scope_tab << "/// <para>Since EFL " + struct_.documentation.since + ".</para>\n"
|
||||
).generate(std::back_inserter(since_line), attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// GetHashCode (needed by the equality comparisons)
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "/// <summary>Get a hash code for this item.\n"
|
||||
<< since_line
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "public override int GetHashCode()\n"
|
||||
<< indent << scope_tab << "{\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
if (struct_.fields.size() != 0 )
|
||||
{
|
||||
// int hash = 17;
|
||||
// hash = 23 * fieldA.GetHashCode();
|
||||
// hash = 23 * fieldB.GetHashCode();
|
||||
// hash = 23 * fieldC.GetHashCode();
|
||||
// return hash
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "int hash = 17;\n"
|
||||
<< *(indent << scope_tab << scope_tab << "hash = hash * 23 + " << name_helpers::struct_field_name << ".GetHashCode();\n")
|
||||
<< indent << scope_tab << scope_tab << "return hash;\n"
|
||||
).generate(sink, struct_.fields, context))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just compare the place holder pointers
|
||||
if (!as_generator(
|
||||
"return field.GetHashCode();\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "}\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// IEquatable<T> Equals
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "public bool Equals(" << struct_managed_name << " other)\n"
|
||||
<< indent << scope_tab << "{\n"
|
||||
<< indent << scope_tab << scope_tab << "return "
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
if (struct_.fields.size() != 0 )
|
||||
{
|
||||
if (!as_generator(
|
||||
grammar::attribute_reorder<-1, -1>((name_helpers::struct_field_name << " == other." << name_helpers::struct_field_name)) % " && "
|
||||
).generate(sink, struct_.fields, context))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just compare the place holder pointers
|
||||
if (!as_generator(
|
||||
"field.Equals(other.field)"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << ";\n"
|
||||
<< indent << scope_tab << "}\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// ValueType.Equals
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "public override bool Equals(object other)\n"
|
||||
<< indent << scope_tab << scope_tab << "=> ((other is " << struct_managed_name << ") ? Equals((" << struct_managed_name << ")other) : false);\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// Equality operators
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "public static bool operator ==(" << struct_managed_name << " lhs, " << struct_managed_name << " rhs)\n"
|
||||
<< indent << scope_tab << scope_tab << "=> lhs.Equals(rhs);"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
if (!as_generator(
|
||||
indent << scope_tab << "/// <summary>Equality comparison.\n"
|
||||
<< since_line
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "public static bool operator !=(" << struct_managed_name << " lhs, " << struct_managed_name << " rhs)\n"
|
||||
<< indent << scope_tab << scope_tab << "=> !lhs.Equals(rhs);"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// Conversions from/to internal struct and IntPtrs
|
||||
if(!as_generator(
|
||||
indent << scope_tab << "/// <summary>Implicit conversion to the managed representation from a native pointer.\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
|
|
|
@ -43,19 +43,111 @@ public enum ElementType
|
|||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct InlistMem
|
||||
public struct InlistMem : IEquatable<InlistMem>
|
||||
{
|
||||
public IntPtr next {get;set;}
|
||||
public IntPtr prev {get;set;}
|
||||
public IntPtr last {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="InlistMem" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> next.GetHashCode() ^ prev.GetHashCode() ^ last.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="InlistMem" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is InlistMem)) ? false : Equals((InlistMem)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="InlistMem" /> is equal
|
||||
/// to the given <see cref="InlistMem" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="InlistMem" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(InlistMem other)
|
||||
=> (next == other.next) && (prev == other.prev)
|
||||
&& (last == other.last);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(InlistMem lhs, InlistMem rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(InlistMem lhs, InlistMem rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct InlistNode<T>
|
||||
public struct InlistNode<T> : IEquatable<InlistNode<T>>
|
||||
{
|
||||
public InlistMem __in_list {get;set;}
|
||||
public T Val {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="InlistNode{T}" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> __in_list.GetHashCode() ^ Val.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="InlistNode{T}" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is InlistNode<T>)) ? false : Equals((InlistNode<T>)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="InlistNode{T}" /> is equal
|
||||
/// to the given <see cref="InlistNode{T}" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="InlistNode{T}" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(InlistNode<T> other)
|
||||
=> (__in_list == other.__in_list) && (Val.Equals(other.Val));
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(InlistNode<T> lhs, InlistNode<T> rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(InlistNode<T> lhs, InlistNode<T> rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
|
|
|
@ -30,11 +30,57 @@ namespace Eina
|
|||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public struct HashTupleNative
|
||||
public struct HashTupleNative : IEquatable<HashTupleNative>
|
||||
{
|
||||
public IntPtr key;
|
||||
public IntPtr data;
|
||||
public uint key_length;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="HashTupleNative" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> key.GetHashCode() ^ data.GetHashCode() ^ key_length.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="HashTupleNative" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is HashTupleNative)) ? false : Equals((HashTupleNative)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="HashTupleNative" /> is equal
|
||||
/// to the given <see cref="HashTupleNative" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="HashTupleNative" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(HashTupleNative other)
|
||||
=> (key == other.key) && (data == other.data)
|
||||
&& (key_length == other.key_length);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(HashTupleNative lhs, HashTupleNative rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(HashTupleNative lhs, HashTupleNative rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
|
|
|
@ -52,7 +52,7 @@ public interface ISliceBase
|
|||
/// Since EFL 1.23.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Slice : ISliceBase
|
||||
public struct Slice : ISliceBase, IEquatable<Slice>
|
||||
{
|
||||
/// <summary>
|
||||
/// The length of this slice.
|
||||
|
@ -87,6 +87,49 @@ public struct Slice : ISliceBase
|
|||
Mem = mem;
|
||||
Len = len;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="Slice" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => Length.GetHashCode() ^ Mem.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="Slice" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is Slice)) ? false : Equals((Slice)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="Slice" /> is equal
|
||||
/// to the given <see cref="Slice" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Slice" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(Slice other)
|
||||
=> (Length == other.Length) ^ (Mem == other.Mem);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(Slice lhs, Slice rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(Slice lhs, Slice rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>Pointer to a slice of native memory.
|
||||
|
@ -94,7 +137,7 @@ public struct Slice : ISliceBase
|
|||
/// Since EFL 1.23.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RwSlice : ISliceBase
|
||||
public struct RwSlice : ISliceBase, IEquatable<RwSlice>
|
||||
{
|
||||
/// <summary>
|
||||
/// The length of this slice.
|
||||
|
@ -141,6 +184,49 @@ public struct RwSlice : ISliceBase
|
|||
r.Len = Len;
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="RwSlice" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => Mem.GetHashCode() ^ Length.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="RwSlice" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is RwSlice)) ? false : Equals((RwSlice)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="RwSlice" /> is equal
|
||||
/// to the given <see cref="RwSlice" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="RwSlice" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(RwSlice other)
|
||||
=> (Length == other.Length) && (Mem == other.Mem);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(RwSlice lhs, RwSlice rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(RwSlice lhs, RwSlice rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ static internal class UnsafeNativeMethods
|
|||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public struct ValueNative
|
||||
public struct ValueNative : IEquatable<ValueNative>
|
||||
{
|
||||
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<Type:0x{Type.ToInt64():x}, Value:0x{Value.ToInt64():x}>";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="ValueNative" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => Type.GetHashCode() ^ Value.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="ValueNative" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is ValueNative)) ? false : Equals((ValueNative)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="ValueNative" /> is equal
|
||||
/// to the given <see cref="ValueNative" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ValueNative" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(ValueNative other)
|
||||
=> (Type == other.Type) ^ (Value == other.Value);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(ValueNative lhs, ValueNative rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(ValueNative lhs, ValueNative rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>Exception for failures when setting an container item.
|
||||
|
|
|
@ -41,7 +41,7 @@ public static class Timeout
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ObjectPath
|
||||
public struct ObjectPath : IEquatable<ObjectPath>
|
||||
{
|
||||
/// <summary>
|
||||
/// The string of the path.
|
||||
|
@ -87,6 +87,48 @@ public struct ObjectPath
|
|||
/// <param name="path">The ObjectPath to be converted.</param>
|
||||
public static string ToString(ObjectPath path) => path.value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="ObjectPath" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => value.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="ObjectPath" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is ObjectPath)) ? false : Equals((ObjectPath)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="ObjectPath" /> is equal
|
||||
/// to the given <see cref="ObjectPath" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ObjectPath" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(ObjectPath other) => value == other.value;
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(ObjectPath lhs, ObjectPath rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(ObjectPath lhs, ObjectPath rhs) => !(lhs == rhs);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -94,7 +136,7 @@ public struct ObjectPath
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SignatureString
|
||||
public struct SignatureString : IEquatable<SignatureString>
|
||||
{
|
||||
/// <summary>
|
||||
/// The string of the signature.
|
||||
|
@ -137,6 +179,48 @@ public struct SignatureString
|
|||
=> ToString(sig);
|
||||
|
||||
public static string ToString(SignatureString sig) => sig.value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="SignatureString" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => value.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="SignatureString" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is SignatureString)) ? false : Equals((SignatureString)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="SignatureString" /> is equal
|
||||
/// to the given <see cref="SignatureString" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="SignatureString" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(SignatureString other) => value == other.value;
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(SignatureString lhs, SignatureString rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(SignatureString lhs, SignatureString rhs) => !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -144,7 +228,7 @@ public struct SignatureString
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct UnixFd
|
||||
public struct UnixFd : IEquatable<UnixFd>
|
||||
{
|
||||
/// <summary>
|
||||
/// The value of the file descriptor.
|
||||
|
@ -189,6 +273,48 @@ public struct UnixFd
|
|||
/// </summary>
|
||||
/// <param name="unix_fd">The <see cref="UnixFd" /> to be converted.</param>
|
||||
public static Int32 ToInt32(UnixFd unix_fd) => unix_fd.value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="UnixFd" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => value.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="UnixFd" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is UnixFd)) ? false : Equals((UnixFd)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="UnixFd" /> is equal
|
||||
/// to the given <see cref="UnixFd" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="UnixFd" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(UnixFd other) => value == other.value;
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(UnixFd lhs, UnixFd rhs) => lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(UnixFd lhs, UnixFd rhs) => !(lhs == rhs);
|
||||
}
|
||||
/// <summary>
|
||||
/// Arguments of EldBus.
|
||||
|
|
|
@ -404,7 +404,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
|
|||
/// <para>Wraps the pointer handle to the native object instance.</para>
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
protected struct ConstructingHandle
|
||||
protected struct ConstructingHandle : IEquatable<ConstructingHandle>
|
||||
{
|
||||
/// <summary>Constructor for wrapping the native handle.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
|
@ -418,6 +418,52 @@ public abstract class EoWrapper : IWrapper, IDisposable
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public IntPtr NativeHandle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="ConstructingHandle" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode() => NativeHandle.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="ConstructingHandle" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is ConstructingHandle))
|
||||
? false : Equals((ConstructingHandle)other);
|
||||
|
||||
/// <summary>Returns whether this <see cref="ConstructingHandle" /> is equal
|
||||
/// to the given <see cref="ConstructingHandle" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ConstructingHandle" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(ConstructingHandle other)
|
||||
=> NativeHandle == other.NativeHandle;
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(ConstructingHandle lhs, ConstructingHandle rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(ConstructingHandle lhs, ConstructingHandle rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
|
||||
///<summary>Eo class description, passed to efl_class_new.</summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
|
||||
internal struct ClassDescription
|
||||
internal struct ClassDescription : IEquatable<ClassDescription>
|
||||
{
|
||||
///<summary>Current Eo version.</summary>
|
||||
internal uint version;
|
||||
|
@ -37,6 +37,55 @@ internal struct ClassDescription
|
|||
internal IntPtr class_constructor;
|
||||
///<summary>Destructor of the class.</summary>
|
||||
internal IntPtr class_destructor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="ClassDescription" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> version.GetHashCode() ^ name.GetHashCode()
|
||||
^ class_type ^ data_size.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="ClassDescription" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is ClassDescription)) ? false
|
||||
: Equals((ClassDescription)other);
|
||||
|
||||
|
||||
/// <summary>Returns whether this <see cref="ClassDescription" /> is equal
|
||||
/// to the given <see cref="ClassDescription" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ClassDescription" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(ClassDescription other)
|
||||
=> (name == other.name) && (class_type == other.class_type);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(ClassDescription lhs, ClassDescription rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(ClassDescription lhs, ClassDescription rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
///<summary>Description of an Eo API operation.</summary>
|
||||
|
@ -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<TextCursorCursor>
|
||||
{
|
||||
IntPtr obj;
|
||||
UIntPtr pos; // UIntPtr to automatically change size_t between 32/64
|
||||
IntPtr node;
|
||||
[MarshalAsAttribute(UnmanagedType.U1)]bool changed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="TextCursorCursor" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> obj.GetHashCode() ^ pos.GetHashCode()
|
||||
^ node.GetHashCode() ^ changed.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="TextCursorCursor" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is TextCursorCursor)) ? false
|
||||
: Equals((TextAnnotateAnnotation)other);
|
||||
|
||||
|
||||
/// <summary>Returns whether this <see cref="TextCursorCursor" /> is equal
|
||||
/// to the given <see cref="TextCursorCursor" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="TextCursorCursor" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(TextCursorCursor other)
|
||||
=> (obj == other.obj) && (pos == other.pos)
|
||||
&& (node == other.node) && (changed == other.changed);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(TextCursorCursor lhs, TextCursorCursor rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(TextCursorCursor lhs, TextCursorCursor rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct TextAnnotateAnnotation
|
||||
public struct TextAnnotateAnnotation : IEquatable<TextAnnotateAnnotation>
|
||||
{
|
||||
IntPtr list;
|
||||
IntPtr obj;
|
||||
IntPtr start_node;
|
||||
IntPtr end_node;
|
||||
[MarshalAsAttribute(UnmanagedType.U1)]bool is_item;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="TextAnnotateAnnotation" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> list.GetHashCode() ^ obj.GetHashCode()
|
||||
^ start_node.GetHashCode() ^ end_node.GetHashCode()
|
||||
^ is_item.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="TextAnnotateAnnotation" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is TextAnnotateAnnotation)) ? false
|
||||
: Equals((TextAnnotateAnnotation)other);
|
||||
|
||||
|
||||
/// <summary>Returns whether this <see cref="TextAnnotateAnnotation" /> is equal
|
||||
/// to the given <see cref="TextAnnotateAnnotation" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="TextAnnotateAnnotation" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(TextAnnotateAnnotation other)
|
||||
=> (list == other.list) && (obj == other.obj)
|
||||
&& (start_node == other.start_node) && (is_item == other.is_item);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(TextAnnotateAnnotation lhs, TextAnnotateAnnotation rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(TextAnnotateAnnotation lhs, TextAnnotateAnnotation rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
namespace Access
|
||||
{
|
||||
|
||||
public struct ActionData
|
||||
public struct ActionData : IEquatable<ActionData>
|
||||
{
|
||||
public IntPtr name;
|
||||
public IntPtr action;
|
||||
public IntPtr param;
|
||||
public IntPtr func;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash for <see cref="ActionData" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <returns>A hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
=> name.GetHashCode() ^ action.GetHashCode()
|
||||
^ param.GetHashCode() ^ func.GetHashCode();
|
||||
|
||||
/// <summary>Returns whether this <see cref="ActionData" />
|
||||
/// is equal to the given <see cref="object" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
=> (!(other is ActionData)) ? false
|
||||
: Equals((ActionData)other);
|
||||
|
||||
|
||||
/// <summary>Returns whether this <see cref="ActionData" /> is equal
|
||||
/// to the given <see cref="ActionData" />.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="ActionData" /> to be compared to.</param>
|
||||
/// <returns><c>true</c> if is equal to <c>other</c>.</returns>
|
||||
public bool Equals(ActionData other)
|
||||
=> (name == other.name) && (action == other.action)
|
||||
&& (param == other.param) && (func == other.func);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator==(ActionData lhs, ActionData rhs)
|
||||
=> lhs.Equals(rhs);
|
||||
|
||||
/// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
|
||||
/// <para>Since EFL 1.24.</para>
|
||||
/// </summary>
|
||||
/// <param name="lhs">The left hand side of the operator.</param>
|
||||
/// <param name="rhs">The right hand side of the operator.</param>
|
||||
/// <returns><c>true</c> if <c>lhs</c> is not equal
|
||||
/// to <c>rhs</c>.</returns>
|
||||
public static bool operator!=(ActionData lhs, ActionData rhs)
|
||||
=> !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace Access
|
||||
|
|
|
@ -713,6 +713,47 @@ EAPI Eina_Bool ecore_wl2_display_sync_is_done(const Ecore_Wl2_Display *display);
|
|||
*/
|
||||
EAPI const char *ecore_wl2_display_name_get(const Ecore_Wl2_Display *display);
|
||||
|
||||
/**
|
||||
* Finds an Ecore_Wl2_Window based on wl_surface
|
||||
*
|
||||
* @param display The display to search for the window
|
||||
* @param surface The wl_surface of the window to find
|
||||
*
|
||||
* @return The Ecore_Wl2_Window if found, or NULL if no such window exists
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Display_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI Ecore_Wl2_Window *ecore_wl2_display_window_find_by_surface(Ecore_Wl2_Display *display, struct wl_surface *surface);
|
||||
|
||||
/**
|
||||
* Gets the connected display object
|
||||
*
|
||||
* @brief This function is typically used by clients to get an
|
||||
* existing Wayland display.
|
||||
*
|
||||
* @param name The display target name. If @c NULL, the default
|
||||
* display is assumed.
|
||||
*
|
||||
* @return The Ecore_Wl2_Display which was connected to
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Display_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI Ecore_Wl2_Display *ecore_wl2_connected_display_get(const char *name);
|
||||
|
||||
/**
|
||||
* Gets the wl_compositor which belongs to this display
|
||||
*
|
||||
* @param display The Ecore_Wl2_Display to get the compositor of
|
||||
*
|
||||
* @return The wl_compositor associated with this display
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Display_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI struct wl_compositor *ecore_wl2_display_compositor_get(Ecore_Wl2_Display *display);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Wl2_Window_Group Wayland Library Window Functions
|
||||
* @ingroup Ecore_Wl2_Group
|
||||
|
@ -1036,6 +1077,16 @@ EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool ico
|
|||
*/
|
||||
EAPI void ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type);
|
||||
|
||||
/**
|
||||
* Get the type of a given window
|
||||
*
|
||||
* @see Ecore_Wl2_Window_Type
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Window_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI Ecore_Wl2_Window_Type ecore_wl2_window_type_get(Ecore_Wl2_Window *window);
|
||||
|
||||
/**
|
||||
* Find the output that a given window is on
|
||||
*
|
||||
|
@ -1309,6 +1360,16 @@ EAPI void ecore_wl2_window_floating_mode_set(Ecore_Wl2_Window *window, Eina_Bool
|
|||
*/
|
||||
EAPI Eina_Bool ecore_wl2_window_floating_mode_get(Ecore_Wl2_Window *window);
|
||||
|
||||
/**
|
||||
* Finds a window by surface
|
||||
*
|
||||
* @param surface The surface to find the window of
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Window_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI Ecore_Wl2_Window *ecore_wl2_window_surface_find(struct wl_surface *surface);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Wl2_Input_Group Wayland Library Input Functions
|
||||
* @ingroup Ecore_Wl2_Group
|
||||
|
|
|
@ -1163,3 +1163,47 @@ ecore_wl2_display_flush(Ecore_Wl2_Display *display)
|
|||
|
||||
_begin_recovery_maybe(display, code);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window *
|
||||
ecore_wl2_display_window_find_by_surface(Ecore_Wl2_Display *display, struct wl_surface *surface)
|
||||
{
|
||||
return _ecore_wl2_display_window_surface_find(display, surface);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Display *
|
||||
ecore_wl2_connected_display_get(const char *name)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(_client_displays, NULL);
|
||||
|
||||
if (!name)
|
||||
{
|
||||
const char *n;
|
||||
|
||||
/* client wants to connected to default display */
|
||||
n = getenv("WAYLAND_DISPLAY");
|
||||
if (!n) n = "wayland-0";
|
||||
|
||||
/* we have a default wayland display */
|
||||
|
||||
/* check hash of cached client displays for this name */
|
||||
ewd = eina_hash_find(_client_displays, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* client wants to connect to specific display */
|
||||
|
||||
/* check hash of cached client displays for this name */
|
||||
ewd = eina_hash_find(_client_displays, name);
|
||||
}
|
||||
|
||||
return ewd;
|
||||
}
|
||||
|
||||
EAPI struct wl_compositor *
|
||||
ecore_wl2_display_compositor_get(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
return display->wl.compositor;
|
||||
}
|
||||
|
|
|
@ -1741,3 +1741,25 @@ ecore_wl2_window_surface_flush(Ecore_Wl2_Window *window, Eina_Bool purge)
|
|||
if (!window->wl2_surface) return;
|
||||
ecore_wl2_surface_flush(window->wl2_surface, purge);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window_Type
|
||||
ecore_wl2_window_type_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, ECORE_WL2_WINDOW_TYPE_NONE);
|
||||
return window->type;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window *
|
||||
ecore_wl2_window_surface_find(struct wl_surface *surface)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
Ecore_Wl2_Window *win;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
|
||||
|
||||
ewd = ecore_wl2_connected_display_get(NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ewd, NULL);
|
||||
|
||||
win = ecore_wl2_display_window_find_by_surface(ewd, surface);
|
||||
return win;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,21 @@ _is_horizontal(Efl_Ui_Layout_Orientation dir)
|
|||
return efl_ui_layout_orientation_is_horizontal(dir, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_is_inverted(Eo *obj, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
Eina_Bool mirrored, inverted;
|
||||
|
||||
mirrored = efl_ui_mirrored_get(obj);
|
||||
inverted = efl_ui_layout_orientation_is_inverted(sd->dir);
|
||||
|
||||
if ((_is_horizontal(sd->dir) && (mirrored ^ inverted)) ||
|
||||
(!_is_horizontal(sd->dir) && inverted))
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_emit_events(Eo *obj, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
|
@ -84,7 +99,7 @@ _step_value_update(Evas_Object *obj, double step)
|
|||
|
||||
EFL_UI_SLIDER_DATA_GET(obj, sd);
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
if (_is_inverted(obj, sd))
|
||||
step *= -1.0;
|
||||
|
||||
value = CLAMP(sd->val + step, sd->val_min, sd->val_max);
|
||||
|
@ -105,10 +120,8 @@ _drag_value_fetch(Evas_Object *obj)
|
|||
if (_is_horizontal(sd->dir)) pos = posx;
|
||||
else pos = posy;
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
{
|
||||
if (_is_inverted(obj, sd))
|
||||
pos = 1.0 - pos;
|
||||
}
|
||||
|
||||
val = (pos * (sd->val_max - sd->val_min)) + sd->val_min;
|
||||
|
||||
|
@ -139,10 +152,8 @@ _drag_value_update(Evas_Object *obj)
|
|||
|
||||
pos = (sd->val - sd->val_min) / (sd->val_max - sd->val_min);
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
{
|
||||
if (_is_inverted(obj, sd))
|
||||
pos = 1.0 - pos;
|
||||
}
|
||||
|
||||
efl_ui_drag_value_set(efl_part(wd->resize_obj, "efl.draggable.slider"),
|
||||
pos, pos);
|
||||
|
|
|
@ -78,6 +78,21 @@ _is_horizontal(Efl_Ui_Layout_Orientation dir)
|
|||
return efl_ui_layout_orientation_is_horizontal(dir, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_is_inverted(Eo *obj, Elm_Slider_Data *sd)
|
||||
{
|
||||
Eina_Bool mirrored, inverted;
|
||||
|
||||
mirrored = efl_ui_mirrored_get(obj);
|
||||
inverted = efl_ui_layout_orientation_is_inverted(sd->dir);
|
||||
|
||||
if ((_is_horizontal(sd->dir) && (mirrored ^ inverted)) ||
|
||||
(!_is_horizontal(sd->dir) && inverted))
|
||||
return EINA_TRUE;
|
||||
else
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_units_set(Evas_Object *obj)
|
||||
{
|
||||
|
@ -315,7 +330,7 @@ _val_set(Evas_Object *obj)
|
|||
else if (pos2 > 1.0)
|
||||
pos2 = 1.0;
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
if (_is_inverted(obj, sd))
|
||||
{
|
||||
pos = 1.0 - pos;
|
||||
pos2 = 1.0 - pos2;
|
||||
|
@ -360,7 +375,7 @@ _step_value_update(Evas_Object *obj, double step)
|
|||
|
||||
ELM_SLIDER_DATA_GET(obj, sd);
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
if (_is_inverted(obj, sd))
|
||||
step *= -1.0;
|
||||
|
||||
absolute_step = step * (sd->val_max - sd->val_min);
|
||||
|
@ -392,7 +407,7 @@ _val_fetch(Evas_Object *obj, Eina_Bool user_event)
|
|||
else pos2 = posy2;
|
||||
}
|
||||
|
||||
if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
|
||||
if (_is_inverted(obj, sd))
|
||||
{
|
||||
pos = 1.0 - pos;
|
||||
pos2 = 1.0 - pos2;
|
||||
|
|
|
@ -287,6 +287,48 @@ EFL_START_TEST(wl2_wm_window_rotation_app)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(wl2_window_geometry)
|
||||
{
|
||||
Ecore_Wl2_Display *disp;
|
||||
Ecore_Wl2_Window *win;
|
||||
int x, y, w, h;
|
||||
|
||||
disp = _display_connect();
|
||||
ck_assert(disp != NULL);
|
||||
|
||||
win = _window_create(disp);
|
||||
ck_assert(win != NULL);
|
||||
|
||||
ecore_wl2_window_geometry_set(win, 10, 10, 100, 100);
|
||||
|
||||
ecore_wl2_window_geometry_get(win, &x, &y, &w, &h);
|
||||
|
||||
fail_if(x != 10);
|
||||
fail_if(y != 10);
|
||||
fail_if(w != 100);
|
||||
fail_if(h != 100);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(wl2_window_type)
|
||||
{
|
||||
Ecore_Wl2_Display *disp;
|
||||
Ecore_Wl2_Window *win;
|
||||
Ecore_Wl2_Window_Type type = ECORE_WL2_WINDOW_TYPE_NONE;
|
||||
|
||||
disp = _display_connect();
|
||||
ck_assert(disp != NULL);
|
||||
|
||||
win = _window_create(disp);
|
||||
ck_assert(win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
type = ecore_wl2_window_type_get(win);
|
||||
fail_if(type != ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void
|
||||
ecore_wl2_test_window(TCase *tc)
|
||||
{
|
||||
|
@ -308,5 +350,7 @@ ecore_wl2_test_window(TCase *tc)
|
|||
tcase_add_test(tc, wl2_window_preferred_rot);
|
||||
tcase_add_test(tc, wl2_window_rotation_app);
|
||||
tcase_add_test(tc, wl2_wm_window_rotation_app);
|
||||
tcase_add_test(tc, wl2_window_geometry);
|
||||
tcase_add_test(tc, wl2_window_type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,4 +675,40 @@ class TestHiddenClasses
|
|||
}
|
||||
}
|
||||
|
||||
class TestAliasEquality
|
||||
{
|
||||
static Dummy.MyInt a = 4;
|
||||
static Dummy.MyInt b = 4;
|
||||
static Dummy.MyInt c = 5;
|
||||
|
||||
public static void test_equals()
|
||||
{
|
||||
Test.AssertEquals(a, b);
|
||||
Test.AssertNotEquals(a, c);
|
||||
}
|
||||
|
||||
public static void test_equals_different_types()
|
||||
{
|
||||
Test.Assert(!(a.Equals(new Object())));
|
||||
}
|
||||
|
||||
public static void test_equatable()
|
||||
{
|
||||
Test.Assert(((IEquatable<Dummy.MyInt>)a).Equals(b));
|
||||
Test.Assert(!((IEquatable<Dummy.MyInt>)a).Equals(c));
|
||||
}
|
||||
|
||||
public static void test_equality_operators()
|
||||
{
|
||||
Test.Assert(a == b);
|
||||
Test.Assert(a != c);
|
||||
}
|
||||
|
||||
public static void test_hash_code()
|
||||
{
|
||||
Test.AssertEquals(a.GetHashCode(), b.GetHashCode());
|
||||
Test.AssertNotEquals(a.GetHashCode(), c.GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -377,4 +377,48 @@ internal class TestStructs
|
|||
// }
|
||||
}
|
||||
|
||||
internal class TestStructEquality
|
||||
{
|
||||
static Dummy.StructSimple a = new Dummy.StructSimple(1, 2, (char)3, 4, Fstring: "", Fmstring: "", Fstringshare: "");
|
||||
static Dummy.StructSimple b = new Dummy.StructSimple(1, 2, (char)3, 4, Fstring: "", Fmstring: "", Fstringshare: "");
|
||||
|
||||
static Dummy.StructSimple c = new Dummy.StructSimple(4, 3, (char)2, 1, Fstring: "", Fmstring: "", Fstringshare: "");
|
||||
|
||||
// to check if we differ on a single struct field
|
||||
static Dummy.StructSimple singleDifferentField = new Dummy.StructSimple(1, 2, (char)3, 5, Fstring: "", Fmstring: "", Fstringshare: "");
|
||||
|
||||
public static void test_equals()
|
||||
{
|
||||
Test.AssertEquals(a, b);
|
||||
Test.AssertNotEquals(a, c);
|
||||
Test.AssertNotEquals(a, singleDifferentField);
|
||||
}
|
||||
|
||||
public static void test_equals_different_types()
|
||||
{
|
||||
Test.Assert(!(a.Equals(new Object())));
|
||||
}
|
||||
|
||||
public static void test_equatable()
|
||||
{
|
||||
Test.Assert(((IEquatable<Dummy.StructSimple>)a).Equals(b));
|
||||
Test.Assert(!((IEquatable<Dummy.StructSimple>)a).Equals(c));
|
||||
Test.Assert(!((IEquatable<Dummy.StructSimple>)a).Equals(singleDifferentField));
|
||||
}
|
||||
|
||||
public static void test_equality_operators()
|
||||
{
|
||||
Test.Assert(a == b);
|
||||
Test.Assert(a != c);
|
||||
Test.Assert(a != singleDifferentField);
|
||||
}
|
||||
|
||||
public static void test_hash_code()
|
||||
{
|
||||
Test.AssertEquals(a.GetHashCode(), b.GetHashCode());
|
||||
Test.AssertNotEquals(a.GetHashCode(), c.GetHashCode());
|
||||
Test.AssertNotEquals(a.GetHashCode(), singleDifferentField.GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue