forked from enlightenment/efl
csharp: Add To and From methods for implicit conversion.
Summary: ref T8430 Reviewers: lauromoura, felipealmeida, segfaultxavi, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8430 Differential Revision: https://phab.enlightenment.org/D10616
This commit is contained in:
parent
5b588c3c39
commit
fee55857e4
|
@ -79,20 +79,28 @@ public struct Error : IComparable<Error>, IEquatable<Error>
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="val">Value to be converted to Error</param>
|
||||
static public implicit operator Error(int val)
|
||||
{
|
||||
return new Error(val);
|
||||
}
|
||||
public static implicit operator Error(int val) => FromInt32(val);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="int" /> to a <see cref="Error" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="val">The <see cref="int" /> to be converted.</param>
|
||||
public static Error FromInt32(int val) => new Error(val);
|
||||
|
||||
/// <summary>
|
||||
/// Int conversion from Error.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="error">Error identifier to be converted to int</param>
|
||||
static public implicit operator int(Error error)
|
||||
{
|
||||
return error.code;
|
||||
}
|
||||
public static implicit operator int(Error error) => ToInt32(error);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Error" /> to a <see cref="int" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="error">The <see cref="Error" /> to be converted.</param>
|
||||
public static int ToInt32(Error error) => error.code;
|
||||
|
||||
/// <summary>
|
||||
/// Transform the object to a string representing the object.
|
||||
|
@ -213,7 +221,7 @@ public struct Error : IComparable<Error>, IEquatable<Error>
|
|||
{
|
||||
if (object.ReferenceEquals(obj, null))
|
||||
return false;
|
||||
|
||||
|
||||
return this.Equals((Error)obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Value>, IEquatable<Value>
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
[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();
|
||||
|
||||
/// <summary>Implicit conversion from native struct representation to managed wrapper.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
[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);
|
||||
|
||||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(byte x)
|
||||
public static implicit operator Value(byte x) => FromByte(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="byte" />
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="byte" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator byte(Value v)
|
||||
public static implicit operator byte(Value v) => ToByte(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="byte" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static byte ToByte(Value v)
|
||||
{
|
||||
byte b;
|
||||
v.Get(out b);
|
||||
|
@ -1604,7 +1621,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(sbyte x)
|
||||
public static implicit operator Value(sbyte x) => FromSByte(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="sbyte" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="sbyte" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator sbyte(Value v)
|
||||
public static implicit operator sbyte(Value v) => ToSByte(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="sbyte" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static sbyte ToSByte(Value v)
|
||||
{
|
||||
sbyte b;
|
||||
v.Get(out b);
|
||||
|
@ -1626,7 +1657,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(short x)
|
||||
public static implicit operator Value(short x) => FromShort(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="short" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="short" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator short(Value v)
|
||||
public static implicit operator short(Value v) => ToInt16(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="short" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static short ToInt16(Value v)
|
||||
{
|
||||
short b;
|
||||
v.Get(out b);
|
||||
|
@ -1648,7 +1693,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(ushort x)
|
||||
public static implicit operator Value(ushort x) => FromUInt16(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="ushort" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="ushort" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator ushort(Value v)
|
||||
public static implicit operator ushort(Value v) => ToUInt16(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="ushort" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static ushort ToUInt16(Value v)
|
||||
{
|
||||
ushort b;
|
||||
v.Get(out b);
|
||||
|
@ -1670,18 +1729,33 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(int x)
|
||||
public static implicit operator Value(int x) => FromInt32(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="int" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="int" /> to be converted.</param>
|
||||
public static Value FromInt32(int x)
|
||||
{
|
||||
var v = new Eina.Value(ValueType.Int32);
|
||||
v.Set(x);
|
||||
|
||||
return v;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator int(Value v)
|
||||
public static implicit operator int(Value v) => ToInt32(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="int" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static int ToInt32(Value v)
|
||||
{
|
||||
int b;
|
||||
v.Get(out b);
|
||||
|
@ -1692,7 +1766,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(uint x)
|
||||
public static implicit operator Value(uint x) => FromUInt32(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="uint" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="uint" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator uint(Value v)
|
||||
public static implicit operator uint(Value v) => ToUInt32(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="uint" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static uint ToUInt32(Value v)
|
||||
{
|
||||
uint b;
|
||||
v.Get(out b);
|
||||
|
@ -1714,7 +1802,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(long x)
|
||||
public static implicit operator Value(long x) => FromInt64(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="long" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="long" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator long(Value v)
|
||||
public static implicit operator long(Value v) => ToInt64(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="long" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static long ToInt64(Value v)
|
||||
{
|
||||
long b;
|
||||
v.Get(out b);
|
||||
|
@ -1736,7 +1838,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(ulong x)
|
||||
public static implicit operator Value(ulong x) => FromUInt64(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="ulong" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="ulong" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator ulong(Value v)
|
||||
public static implicit operator ulong(Value v) => ToUInt64(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="ulong" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static ulong ToUInt64(Value v)
|
||||
{
|
||||
ulong b;
|
||||
v.Get(out b);
|
||||
|
@ -1758,7 +1874,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(float x)
|
||||
public static implicit operator Value(float x) => FromSingle(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="float" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="float" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator float(Value v)
|
||||
public static implicit operator float(Value v) => ToSingle(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="float" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static float ToSingle(Value v)
|
||||
{
|
||||
float b;
|
||||
v.Get(out b);
|
||||
|
@ -1780,7 +1910,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(double x)
|
||||
public static implicit operator Value(double x) => FromDouble(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="double" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="double" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator double(Value v)
|
||||
public static implicit operator double(Value v) => ToDouble(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="double" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static double ToDouble(Value v)
|
||||
{
|
||||
double b;
|
||||
v.Get(out b);
|
||||
|
@ -1802,7 +1946,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator Value(string x)
|
||||
public static implicit operator Value(string x) => FromString(x);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="Value" /> from a <see cref="string" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="string" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Implicit conversion.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static implicit operator string(Value v)
|
||||
public static implicit operator string(Value v) => ToString(v);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion to a <see cref="string" /> from a <see cref="Value" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static string ToString(Value v)
|
||||
{
|
||||
string b;
|
||||
v.Get(out b);
|
||||
|
@ -1944,7 +2102,14 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
|
|||
/// <summary>Explicit conversion from EFL objects.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static explicit operator Value(Efl.Object obj)
|
||||
public static explicit operator Value(Efl.Object obj) => FromObject(obj);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Efl.Object" /> to a <see cref="Value" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="obj">The <see cref="Efl.Object" /> to be converted.</param>
|
||||
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<Value>, IEquatable<Value>
|
|||
/// <summary>Explicit conversion from Value to Efl.Objects.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
public static explicit operator Efl.Object(Value v)
|
||||
public static explicit operator Efl.Object(Value v) => ToObject(v);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Value" /> to a <see cref="Object" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="v">The <see cref="Value" /> to be converted.</param>
|
||||
public static Efl.Object ToObject(Value v)
|
||||
{
|
||||
Efl.Object obj;
|
||||
v.Get(out obj);
|
||||
|
|
|
@ -64,20 +64,29 @@ public struct ObjectPath
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="str">The string of the path.</param>
|
||||
public static implicit operator ObjectPath(string str)
|
||||
{
|
||||
return new ObjectPath(str);
|
||||
}
|
||||
public static implicit operator ObjectPath(string str) => FromString(str);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="string" /> to a <see cref="ObjectPath" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="str">The <see cref="string" /> of the path.</param>
|
||||
public static ObjectPath FromString(string str) => new ObjectPath(str);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of string from ObjectPath.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="path">The ObjectPath to be converted.</param>
|
||||
public static implicit operator string(ObjectPath path)
|
||||
{
|
||||
return path.value;
|
||||
}
|
||||
public static implicit operator string(ObjectPath path) => ToString(path);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="ObjectPath" /> to a <see cref="string" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="path">The ObjectPath to be converted.</param>
|
||||
public static string ToString(ObjectPath path) => path.value;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -109,9 +118,15 @@ public struct SignatureString
|
|||
/// </summary>
|
||||
/// <param name="str">The string of the signature.</param>
|
||||
public static implicit operator SignatureString(string str)
|
||||
{
|
||||
return new SignatureString(str);
|
||||
}
|
||||
=> FromString(str);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="string" /> to a <see cref="SignatureString" />
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="str">The string of the signature.</param>
|
||||
public static SignatureString FromString(string str)
|
||||
=> new SignatureString(str);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of string from SignatureString.
|
||||
|
@ -119,9 +134,9 @@ public struct SignatureString
|
|||
/// </summary>
|
||||
/// <param name="sig">The SignatureString to be conversion.</param>
|
||||
public static implicit operator string(SignatureString sig)
|
||||
{
|
||||
return sig.value;
|
||||
}
|
||||
=> ToString(sig);
|
||||
|
||||
public static string ToString(SignatureString sig) => sig.value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,22 +167,29 @@ public struct UnixFd
|
|||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="fd">The file descriptor.</param>
|
||||
public static implicit operator UnixFd(Int32 fd)
|
||||
{
|
||||
return new UnixFd(fd);
|
||||
}
|
||||
public static implicit operator UnixFd(Int32 fd) => FromInt32(fd);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Int32" /> to a <see cref="UnixFd" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="fd">The file descriptor.</param>
|
||||
public static UnixFd FromInt32(Int32 fd) => new UnixFd(fd);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of Int32 from UnixFd.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="unix_fd">The UnixFd to be converted.</param>
|
||||
public static implicit operator Int32(UnixFd unix_fd)
|
||||
{
|
||||
return unix_fd.value;
|
||||
}
|
||||
}
|
||||
public static implicit operator Int32(UnixFd unix_fd) => ToInt32(unix_fd);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="UnixFd" /> to a <see cref="Int32" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="unix_fd">The <see cref="UnixFd" /> to be converted.</param>
|
||||
public static Int32 ToInt32(UnixFd unix_fd) => unix_fd.value;
|
||||
}
|
||||
/// <summary>
|
||||
/// Arguments of EldBus.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
|
@ -573,9 +595,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The byte to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(byte arg)
|
||||
{
|
||||
return new ByteMessageArgument(arg);
|
||||
}
|
||||
=> FromByte(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="byte" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="byte" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromByte(byte arg)
|
||||
=> new ByteMessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from bool.
|
||||
|
@ -583,9 +611,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The bool to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(bool arg)
|
||||
{
|
||||
return new BoolMessageArgument(arg);
|
||||
}
|
||||
=> FromBoolean(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="bool" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="bool" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromBoolean(bool arg)
|
||||
=> new BoolMessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from Int16.
|
||||
|
@ -593,9 +627,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The int16 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(Int16 arg)
|
||||
{
|
||||
return new Int16MessageArgument(arg);
|
||||
}
|
||||
=> FromInt16(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Int16" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="Int16" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromInt16(Int16 arg)
|
||||
=> new Int16MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from unsigned int16.
|
||||
|
@ -603,9 +643,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The unsigned int16 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(UInt16 arg)
|
||||
{
|
||||
return new UInt16MessageArgument(arg);
|
||||
}
|
||||
=> FromUInt16(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="UInt16" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="UInt16" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromUInt16(UInt16 arg)
|
||||
=> new UInt16MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from int32.
|
||||
|
@ -613,9 +659,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The int32 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(Int32 arg)
|
||||
{
|
||||
return new Int32MessageArgument(arg);
|
||||
}
|
||||
=> FromInt32(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Int32" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="Int32" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromInt32(Int32 arg)
|
||||
=> new Int32MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from unsigned int32.
|
||||
|
@ -623,9 +675,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The unsigned int32 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(UInt32 arg)
|
||||
{
|
||||
return new UInt32MessageArgument(arg);
|
||||
}
|
||||
=> FromUInt32(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="UInt32" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="UInt32" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromUInt32(UInt32 arg)
|
||||
=> new UInt32MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from int64.
|
||||
|
@ -633,9 +691,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The int64 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(Int64 arg)
|
||||
{
|
||||
return new Int64MessageArgument(arg);
|
||||
}
|
||||
=> FromInt64(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Int64" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="Int64" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromInt64(Int64 arg)
|
||||
=> new Int64MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from unsigned int64.
|
||||
|
@ -643,9 +707,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The unsigned int64 to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(UInt64 arg)
|
||||
{
|
||||
return new UInt64MessageArgument(arg);
|
||||
}
|
||||
=> FromUInt64(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="UInt64" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="UInt64" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromUInt64(UInt64 arg)
|
||||
=> new UInt64MessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from string.
|
||||
|
@ -653,9 +723,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">the string to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(string arg)
|
||||
{
|
||||
return new StringMessageArgument(arg);
|
||||
}
|
||||
=> FromString(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="string" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="string" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromString(string arg)
|
||||
=> new StringMessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from signature.
|
||||
|
@ -663,9 +739,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The signature to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(SignatureString arg)
|
||||
{
|
||||
return new SignatureMessageArgument(arg);
|
||||
}
|
||||
=> FromSignatureString(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SignatureString" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="SignatureString" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromSignatureString(SignatureString arg)
|
||||
=> new SignatureMessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from object path.
|
||||
|
@ -673,9 +755,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The object path to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(ObjectPath arg)
|
||||
{
|
||||
return new ObjectPathMessageArgument(arg);
|
||||
}
|
||||
=> FromObjectPath(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="ObjectPath" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="ObjectPath" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromObjectPath(ObjectPath arg)
|
||||
=> new ObjectPathMessageArgument(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Conversion operator of BasicMessageArgument from unix fd.
|
||||
|
@ -683,9 +771,15 @@ public abstract class BasicMessageArgument
|
|||
/// </summary>
|
||||
/// <param name="arg">The unix fd to be converted.</param>
|
||||
public static implicit operator BasicMessageArgument(UnixFd arg)
|
||||
{
|
||||
return new UnixFdMessageArgument(arg);
|
||||
}
|
||||
=> FromUnixFd(arg);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="UnixFd" /> to a <see cref="BasicMessageArgument" />.
|
||||
/// <para>Since EFL 1.23.</para>
|
||||
/// </summary>
|
||||
/// <param name="arg">The <see cref="UnixFd" /> to be converted.</param>
|
||||
public static BasicMessageArgument FromUnixFd(UnixFd arg)
|
||||
=> new UnixFdMessageArgument(arg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue