Page MenuHomePhabricator

csharp: Add comparables operators to eina_value.
ClosedPublic

Authored by brunobelo on Oct 18 2019, 4:42 PM.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
brunobelo created this revision.Oct 18 2019, 4:42 PM
brunobelo requested review of this revision.Oct 18 2019, 4:42 PM
bu5hm4n requested changes to this revision.Oct 23 2019, 10:18 PM
bu5hm4n added a subscriber: bu5hm4n.

Test

This revision now requires changes to proceed.Oct 23 2019, 10:18 PM
bu5hm4n resigned from this revision.Oct 23 2019, 10:18 PM

Seems to work :)

YOhoho requested changes to this revision.Oct 24 2019, 12:49 AM
YOhoho added inline comments.
src/bindings/mono/eina_mono/eina_value.cs
2928

Is this method necessary?
Value class does not implement IComparable interface.

2940

"Eina.Value />. --> "Eina.Value" />.

It will fix compiler error.

../src/bindings/mono/eina_mono/eina_value.cs(3003,16): error CS1570: Warning as Error: XML documentation comment on `Eina.Value.CompareTo(Eina.Value)' is not well-formed XML markup ('<', hexadecimal value 0x3C, is an invalid attribute character. Line 2, position 2.)
2946

I'm not sure that static Compare method is needed.

You can use CompareTo in operator-overloading. check the comment below.

3021

You can use CompareTo
for example,
lhs.CompareTo(rhs) < 0;

brunobelo added inline comments.Oct 24 2019, 3:15 PM
src/bindings/mono/eina_mono/eina_value.cs
2928

on line 1079, Value implements IComparable.

2940

yeah, dotnet build was supressing doc errors.

2946
3021

If remove Compare is not needed , it provides early stop for lhs == rhs and ref(lhs) == null.
I tried to use microsoft example by standard.

brunobelo updated this revision to Diff 26363.Oct 24 2019, 3:42 PM

fixing doc.

brunobelo added inline comments.Oct 24 2019, 4:24 PM
src/bindings/mono/eina_mono/eina_value.cs
3021

with lhs == null, lhs < rhs should work, but using lhs.CompareTo(rhs) < 0 raise NullReferenceException

YOhoho added inline comments.Oct 24 2019, 7:08 PM
src/bindings/mono/eina_mono/eina_value.cs
2928

That is IComparable<T>.

public interface IComparable<in T>
{
    int CompareTo(T other);
}
2946

Ah, Ignore my comment.

3021

Ah, Ignore my comment.

YOhoho accepted this revision.Oct 27 2019, 3:35 PM
This revision is now accepted and ready to land.Oct 27 2019, 3:35 PM
This revision was automatically updated to reflect the committed changes.