MetaValue

References
Represents a meta data value. This is really just a wrapper class around all the supported meta data value types so we don't have to use 'object' to store meta data.

Fields

AssistantPrefix

#
public const string AssistantPrefix = "A:"
String prefix for values serialised via their ITypeAssistant.

JsonPrefix

#
public const string JsonPrefix = "J:"
String prefix for values serialised using Json (de)serialisation.

StorablePrefix

#
public const string StorablePrefix = "S:"
String prefix for values serialised using the IStorable approach.

Properties

Assistant

#
public ITypeAssistant Assistant { get; }
Gets the type assistant for the data inside this value.

IntendedData

#
public object IntendedData { get; }
Gets the intended value. This may return null as well as an IPear instance if the internal data can be successfully deserialised.

InternalData

#
public object InternalData { get; }
Gets the internal instance of the data. Typically you know what data type you're looking for and you don't have to rawdog the value directly.

IsSerialisedData

#
public bool IsSerialisedData { get; }
Gets whether this value contains serialised data. For this to be true, the value must be of type string and start with one of the format identifiers.

Null

#
public static MetaValue Null { get; }
Gets a null meta value.

Type

#
public MetaType Type { get; }
Gets the type of meta data.

Methods

CompareTo

#
public static int CompareTo(MetaValue a, MetaValue b)
a (MetaValue)
b (MetaValue)

CompareTo

#
public int CompareTo(MetaValue other)
other (MetaValue)

Equals

#
public static bool Equals(MetaValue a, MetaValue b)
a (MetaValue)
b (MetaValue)

Equals

#
public bool Equals(MetaValue other)
other (MetaValue)

FormatValue

#
public static string FormatValue(object value)
value (object)

Get

#
public bool Get(out Angle value)
Gets the value as an angle.
value (out Angle)

Get

#
public bool Get(out BigInteger value)
Gets the value as an integer.
value (out BigInteger)

Get

#
public bool Get(out bool value)
Gets the value as a boolean.
value (out bool)

Get

#
public bool Get(out byte[] value)
Gets the value as an array of bytes.
value (out byte[])

Get

#
public bool Get(out Color value)
Gets the value as an Eto color.
value (out Color)

Get

#
public bool Get(out Colour value)
Gets the value as a Grasshopper colour.
value (out Colour)

Get

#
public bool Get(out DateTime value)
Gets the value as a date.
value (out DateTime)

Get

#
public bool Get(out double value)
Gets the value as a number.
value (out double)

Get

#
public bool Get(out Function value)
Gets the value as a univariate function.
value (out Function)

Get

#
public bool Get(out Gradient value)
Gets the value as a colour gradient.
value (out Gradient)

Get

#
public bool Get(out Guid value)
Gets the value as an id.
value (out Guid)

Get

#
public bool Get(out int value)
Gets the value as an integer.
value (out int)

Get

#
public bool Get(out Interval value)
Gets the value as an interval.
value (out Interval)

Get

#
public bool Get(out Plane value)
Gets the value as a plane.
value (out Plane)

Get

#
public bool Get(out Point3d value)
Gets the value as a point.
value (out Point3d)

Get

#
public bool Get(out string value)
Gets the value as a string.
value (out string)

Get

#
public bool Get(out TimeSpan value)
Gets the value as a time.
value (out TimeSpan)

Get

#
public bool Get(out Transform value)
Gets the value as a transformation.
value (out Transform)

Get

#
public bool Get(out Vector3d value)
Gets the value as a vector.
value (out Vector3d)

GetHashCode

#
public override int GetHashCode()

IsSupportedType

#
public static bool IsSupportedType(object value)
Tests whether a value could be used inside meta data.
value (object)

Parse

#
public static MetaValue Parse(string text, MetaValue hint)
Try and parse a string. This always works since STRING is a valid meta type, but you may not get the conversion you were expecting.
text (string)Text to parse.
hint (MetaValue)Optional original data. This is required for data which is partially formatted or ambiguous.
Meta value. May be Null.

Restore

#
public static MetaValue Restore(IReader reader)
reader (IReader)

Store

#
public void Store(IWriter writer)
Serialiser. This class does not implement IStorable because that would break file IO with early versions. Instead, the data is written directly into the supplied writer object, so it's the responsibility of the caller to make sure multiple meta values do not collide within the same writer.
writer (IWriter)

ToString

#
public override string ToString()
Object.ToString

TryCreate

#
public static bool TryCreate(object value, out MetaValue meta, out string failure)
Try and create a meta value from any value. If the value is of a supported type, this method will succeed.
value (object)
meta (out MetaValue)
failure (out string)

TryDeserialise

#
public static bool TryDeserialise(string text, out IPear pear, out Message failure)
Try and deserialise a value from a string for the purposes of meta-data storage.
text (string)
pear (out IPear)
failure (out Message)

TrySerialise

#
public static bool TrySerialise(IPear pear, out string text, out Message failure)
Try and serialise a value to a string for the purposes of meta-data storage.
pear (IPear)
text (out string)
failure (out Message)

Convertors