* Added implicit typecasts from bool/int/uint/short/ushort/sbyte/byte/long/ulong/double/float/string/UUID/DateTime/Uri/byte[]/Vector2/Vector3/Vector3d/Vector4/Quaternion/Color4 to OSD. You can now write code like "OSDArray array = new OSDArray { true, 42, Vector3.UnitX, 1.5 };"
git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3425 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -121,8 +121,6 @@ namespace OpenMetaverse.StructuredData
|
||||
public static OSD FromDate(DateTime value) { return new OSDDate(value); }
|
||||
public static OSD FromUri(Uri value) { return new OSDUri(value); }
|
||||
public static OSD FromBinary(byte[] value) { return new OSDBinary(value); }
|
||||
public static OSD FromBinary(long value) { return new OSDBinary(value); }
|
||||
public static OSD FromBinary(ulong value) { return new OSDBinary(value); }
|
||||
|
||||
public static OSD FromVector2(Vector2 value)
|
||||
{
|
||||
@@ -297,6 +295,33 @@ namespace OpenMetaverse.StructuredData
|
||||
}
|
||||
}
|
||||
|
||||
#region Implicit Conversions
|
||||
|
||||
public static implicit operator OSD(bool value) { return new OSDBoolean(value); }
|
||||
public static implicit operator OSD(int value) { return new OSDInteger(value); }
|
||||
public static implicit operator OSD(uint value) { return new OSDInteger((int)value); }
|
||||
public static implicit operator OSD(short value) { return new OSDInteger((int)value); }
|
||||
public static implicit operator OSD(ushort value) { return new OSDInteger((int)value); }
|
||||
public static implicit operator OSD(sbyte value) { return new OSDInteger((int)value); }
|
||||
public static implicit operator OSD(byte value) { return new OSDInteger((int)value); }
|
||||
public static implicit operator OSD(long value) { return new OSDBinary(value); }
|
||||
public static implicit operator OSD(ulong value) { return new OSDBinary(value); }
|
||||
public static implicit operator OSD(double value) { return new OSDReal(value); }
|
||||
public static implicit operator OSD(float value) { return new OSDReal(value); }
|
||||
public static implicit operator OSD(string value) { return new OSDString(value); }
|
||||
public static implicit operator OSD(UUID value) { return new OSDUUID(value); }
|
||||
public static implicit operator OSD(DateTime value) { return new OSDDate(value); }
|
||||
public static implicit operator OSD(Uri value) { return new OSDUri(value); }
|
||||
public static implicit operator OSD(byte[] value) { return new OSDBinary(value); }
|
||||
public static implicit operator OSD(Vector2 value) { return OSD.FromVector2(value); }
|
||||
public static implicit operator OSD(Vector3 value) { return OSD.FromVector3(value); }
|
||||
public static implicit operator OSD(Vector3d value) { return OSD.FromVector3d(value); }
|
||||
public static implicit operator OSD(Vector4 value) { return OSD.FromVector4(value); }
|
||||
public static implicit operator OSD(Quaternion value) { return OSD.FromQuaternion(value); }
|
||||
public static implicit operator OSD(Color4 value) { return OSD.FromColor4(value); }
|
||||
|
||||
#endregion Implicit Conversions
|
||||
|
||||
/// <summary>
|
||||
/// Uses reflection to create an SDMap from all of the SD
|
||||
/// serializable types in an object
|
||||
|
||||
Reference in New Issue
Block a user