diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs index c936b88179..6774545603 100644 --- a/src/bindings/mono/eina_mono/eina_error.cs +++ b/src/bindings/mono/eina_mono/eina_error.cs @@ -79,20 +79,28 @@ public struct Error : IComparable, IEquatable /// Since EFL 1.23. /// /// Value to be converted to Error - static public implicit operator Error(int val) - { - return new Error(val); - } + public static implicit operator Error(int val) => FromInt32(val); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static Error FromInt32(int val) => new Error(val); /// /// Int conversion from Error. /// Since EFL 1.23. /// /// Error identifier to be converted to int - static public implicit operator int(Error error) - { - return error.code; - } + public static implicit operator int(Error error) => ToInt32(error); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static int ToInt32(Error error) => error.code; /// /// Transform the object to a string representing the object. @@ -213,7 +221,7 @@ public struct Error : IComparable, IEquatable { if (object.ReferenceEquals(obj, null)) return false; - + return this.Equals((Error)obj); } diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs index 365d60bed3..f8bfc08d3f 100644 --- a/src/bindings/mono/eina_mono/eina_value.cs +++ b/src/bindings/mono/eina_mono/eina_value.cs @@ -897,11 +897,15 @@ public class ValueTypeBox } public static implicit operator ValueTypeBox(ValueType v) - { - return new ValueTypeBox(v); - } + => FromValueType(v); + + public static ValueTypeBox FromValueType(ValueType v) + => new ValueTypeBox(v); public static implicit operator ValueType(ValueTypeBox box) + => ToValueType(box); + + public static ValueType ToValueType(ValueTypeBox box) { if (box == null) { @@ -1565,24 +1569,30 @@ public class Value : IDisposable, IComparable, IEquatable /// Since EFL 1.23. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static implicit operator ValueNative(Value v) - { - return v.GetNative(); - } + public static implicit operator ValueNative(Value v) => ToValueNative(v); + + [EditorBrowsable(EditorBrowsableState.Never)] + public static ValueNative ToValueNative(Value v) => v.GetNative(); /// Implicit conversion from native struct representation to managed wrapper. /// Since EFL 1.23. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static implicit operator Value(ValueNative v) - { - return new Value(v); - } + public static implicit operator Value(ValueNative v) => FromValueNative(v); + + [EditorBrowsable(EditorBrowsableState.Never)] + public static Value FromValueNative(ValueNative v) => new Value(v); /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(byte x) + public static implicit operator Value(byte x) => FromByte(x); + + /// + /// Conversion to a from a + /// + /// The to be converted. + public static Value FromByte(byte x) { var v = new Eina.Value(ValueType.Byte); v.Set(x); @@ -1593,7 +1603,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator byte(Value v) + public static implicit operator byte(Value v) => ToByte(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static byte ToByte(Value v) { byte b; v.Get(out b); @@ -1604,7 +1621,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(sbyte x) + public static implicit operator Value(sbyte x) => FromSByte(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromSByte(sbyte x) { var v = new Eina.Value(ValueType.SByte); v.Set(x); @@ -1615,7 +1639,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator sbyte(Value v) + public static implicit operator sbyte(Value v) => ToSByte(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static sbyte ToSByte(Value v) { sbyte b; v.Get(out b); @@ -1626,7 +1657,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(short x) + public static implicit operator Value(short x) => FromShort(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromShort(short x) { var v = new Eina.Value(ValueType.Short); v.Set(x); @@ -1637,7 +1675,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator short(Value v) + public static implicit operator short(Value v) => ToInt16(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static short ToInt16(Value v) { short b; v.Get(out b); @@ -1648,7 +1693,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(ushort x) + public static implicit operator Value(ushort x) => FromUInt16(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromUInt16(ushort x) { var v = new Eina.Value(ValueType.UShort); v.Set(x); @@ -1659,7 +1711,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator ushort(Value v) + public static implicit operator ushort(Value v) => ToUInt16(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static ushort ToUInt16(Value v) { ushort b; v.Get(out b); @@ -1670,18 +1729,33 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(int x) + public static implicit operator Value(int x) => FromInt32(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromInt32(int x) { var v = new Eina.Value(ValueType.Int32); v.Set(x); return v; + } /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator int(Value v) + public static implicit operator int(Value v) => ToInt32(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static int ToInt32(Value v) { int b; v.Get(out b); @@ -1692,7 +1766,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(uint x) + public static implicit operator Value(uint x) => FromUInt32(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromUInt32(uint x) { var v = new Eina.Value(ValueType.UInt32); v.Set(x); @@ -1703,7 +1784,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator uint(Value v) + public static implicit operator uint(Value v) => ToUInt32(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static uint ToUInt32(Value v) { uint b; v.Get(out b); @@ -1714,7 +1802,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(long x) + public static implicit operator Value(long x) => FromInt64(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromInt64(long x) { var v = new Eina.Value(ValueType.Long); v.Set(x); @@ -1725,7 +1820,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator long(Value v) + public static implicit operator long(Value v) => ToInt64(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static long ToInt64(Value v) { long b; v.Get(out b); @@ -1736,7 +1838,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(ulong x) + public static implicit operator Value(ulong x) => FromUInt64(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromUInt64(ulong x) { var v = new Eina.Value(ValueType.ULong); v.Set(x); @@ -1747,7 +1856,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator ulong(Value v) + public static implicit operator ulong(Value v) => ToUInt64(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static ulong ToUInt64(Value v) { ulong b; v.Get(out b); @@ -1758,7 +1874,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(float x) + public static implicit operator Value(float x) => FromSingle(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromSingle(float x) { var v = new Eina.Value(ValueType.Float); v.Set(x); @@ -1769,7 +1892,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator float(Value v) + public static implicit operator float(Value v) => ToSingle(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static float ToSingle(Value v) { float b; v.Get(out b); @@ -1780,7 +1910,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(double x) + public static implicit operator Value(double x) => FromDouble(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromDouble(double x) { var v = new Eina.Value(ValueType.Double); v.Set(x); @@ -1791,7 +1928,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator double(Value v) + public static implicit operator double(Value v) => ToDouble(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static double ToDouble(Value v) { double b; v.Get(out b); @@ -1802,7 +1946,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator Value(string x) + public static implicit operator Value(string x) => FromString(x); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromString(string x) { var v = new Eina.Value(ValueType.String); v.Set(x); @@ -1813,7 +1964,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Implicit conversion. /// Since EFL 1.23. /// - public static implicit operator string(Value v) + public static implicit operator string(Value v) => ToString(v); + + /// + /// Conversion to a from a + /// Since EFL 1.23. + /// + /// The to be converted. + public static string ToString(Value v) { string b; v.Get(out b); @@ -1944,7 +2102,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Explicit conversion from EFL objects. /// Since EFL 1.23. /// - public static explicit operator Value(Efl.Object obj) + public static explicit operator Value(Efl.Object obj) => FromObject(obj); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static Value FromObject(Efl.Object obj) { var v = new Eina.Value(ValueType.Object); v.Set(obj); @@ -1954,7 +2119,14 @@ public class Value : IDisposable, IComparable, IEquatable /// Explicit conversion from Value to Efl.Objects. /// Since EFL 1.23. /// - public static explicit operator Efl.Object(Value v) + public static explicit operator Efl.Object(Value v) => ToObject(v); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static Efl.Object ToObject(Value v) { Efl.Object obj; v.Get(out obj); diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs index 562f61a4e3..1db6fe486b 100644 --- a/src/bindings/mono/eldbus_mono/eldbus_common.cs +++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs @@ -64,20 +64,29 @@ public struct ObjectPath /// Since EFL 1.23. /// /// The string of the path. - public static implicit operator ObjectPath(string str) - { - return new ObjectPath(str); - } + public static implicit operator ObjectPath(string str) => FromString(str); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The of the path. + public static ObjectPath FromString(string str) => new ObjectPath(str); /// /// Conversion operator of string from ObjectPath. /// Since EFL 1.23. /// /// The ObjectPath to be converted. - public static implicit operator string(ObjectPath path) - { - return path.value; - } + public static implicit operator string(ObjectPath path) => ToString(path); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The ObjectPath to be converted. + public static string ToString(ObjectPath path) => path.value; + } /// @@ -109,9 +118,15 @@ public struct SignatureString /// /// The string of the signature. public static implicit operator SignatureString(string str) - { - return new SignatureString(str); - } + => FromString(str); + + /// + /// Converts a to a + /// Since EFL 1.23. + /// + /// The string of the signature. + public static SignatureString FromString(string str) + => new SignatureString(str); /// /// Conversion operator of string from SignatureString. @@ -119,9 +134,9 @@ public struct SignatureString /// /// The SignatureString to be conversion. public static implicit operator string(SignatureString sig) - { - return sig.value; - } + => ToString(sig); + + public static string ToString(SignatureString sig) => sig.value; } /// @@ -152,22 +167,29 @@ public struct UnixFd /// Since EFL 1.23. /// /// The file descriptor. - public static implicit operator UnixFd(Int32 fd) - { - return new UnixFd(fd); - } + public static implicit operator UnixFd(Int32 fd) => FromInt32(fd); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The file descriptor. + public static UnixFd FromInt32(Int32 fd) => new UnixFd(fd); /// /// Conversion operator of Int32 from UnixFd. /// Since EFL 1.23. /// /// The UnixFd to be converted. - public static implicit operator Int32(UnixFd unix_fd) - { - return unix_fd.value; - } -} + public static implicit operator Int32(UnixFd unix_fd) => ToInt32(unix_fd); + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static Int32 ToInt32(UnixFd unix_fd) => unix_fd.value; +} /// /// Arguments of EldBus. /// Since EFL 1.23. @@ -573,9 +595,15 @@ public abstract class BasicMessageArgument /// /// The byte to be converted. public static implicit operator BasicMessageArgument(byte arg) - { - return new ByteMessageArgument(arg); - } + => FromByte(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromByte(byte arg) + => new ByteMessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from bool. @@ -583,9 +611,15 @@ public abstract class BasicMessageArgument /// /// The bool to be converted. public static implicit operator BasicMessageArgument(bool arg) - { - return new BoolMessageArgument(arg); - } + => FromBoolean(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromBoolean(bool arg) + => new BoolMessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from Int16. @@ -593,9 +627,15 @@ public abstract class BasicMessageArgument /// /// The int16 to be converted. public static implicit operator BasicMessageArgument(Int16 arg) - { - return new Int16MessageArgument(arg); - } + => FromInt16(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromInt16(Int16 arg) + => new Int16MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from unsigned int16. @@ -603,9 +643,15 @@ public abstract class BasicMessageArgument /// /// The unsigned int16 to be converted. public static implicit operator BasicMessageArgument(UInt16 arg) - { - return new UInt16MessageArgument(arg); - } + => FromUInt16(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromUInt16(UInt16 arg) + => new UInt16MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from int32. @@ -613,9 +659,15 @@ public abstract class BasicMessageArgument /// /// The int32 to be converted. public static implicit operator BasicMessageArgument(Int32 arg) - { - return new Int32MessageArgument(arg); - } + => FromInt32(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromInt32(Int32 arg) + => new Int32MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from unsigned int32. @@ -623,9 +675,15 @@ public abstract class BasicMessageArgument /// /// The unsigned int32 to be converted. public static implicit operator BasicMessageArgument(UInt32 arg) - { - return new UInt32MessageArgument(arg); - } + => FromUInt32(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromUInt32(UInt32 arg) + => new UInt32MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from int64. @@ -633,9 +691,15 @@ public abstract class BasicMessageArgument /// /// The int64 to be converted. public static implicit operator BasicMessageArgument(Int64 arg) - { - return new Int64MessageArgument(arg); - } + => FromInt64(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromInt64(Int64 arg) + => new Int64MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from unsigned int64. @@ -643,9 +707,15 @@ public abstract class BasicMessageArgument /// /// The unsigned int64 to be converted. public static implicit operator BasicMessageArgument(UInt64 arg) - { - return new UInt64MessageArgument(arg); - } + => FromUInt64(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromUInt64(UInt64 arg) + => new UInt64MessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from string. @@ -653,9 +723,15 @@ public abstract class BasicMessageArgument /// /// the string to be converted. public static implicit operator BasicMessageArgument(string arg) - { - return new StringMessageArgument(arg); - } + => FromString(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromString(string arg) + => new StringMessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from signature. @@ -663,9 +739,15 @@ public abstract class BasicMessageArgument /// /// The signature to be converted. public static implicit operator BasicMessageArgument(SignatureString arg) - { - return new SignatureMessageArgument(arg); - } + => FromSignatureString(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromSignatureString(SignatureString arg) + => new SignatureMessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from object path. @@ -673,9 +755,15 @@ public abstract class BasicMessageArgument /// /// The object path to be converted. public static implicit operator BasicMessageArgument(ObjectPath arg) - { - return new ObjectPathMessageArgument(arg); - } + => FromObjectPath(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromObjectPath(ObjectPath arg) + => new ObjectPathMessageArgument(arg); /// /// Conversion operator of BasicMessageArgument from unix fd. @@ -683,9 +771,15 @@ public abstract class BasicMessageArgument /// /// The unix fd to be converted. public static implicit operator BasicMessageArgument(UnixFd arg) - { - return new UnixFdMessageArgument(arg); - } + => FromUnixFd(arg); + + /// + /// Converts a to a . + /// Since EFL 1.23. + /// + /// The to be converted. + public static BasicMessageArgument FromUnixFd(UnixFd arg) + => new UnixFdMessageArgument(arg); } ///