public bool CanConvert(RSTypeInfo inTarget) { if ((Flags & TypeFlags.SkipConversionCheck) != 0) { return(true); } if (inTarget == this || inTarget == m_BaseType) { return(true); } if (inTarget == RSBuiltInTypes.String || inTarget == RSBuiltInTypes.Any) { return(true); } if ((inTarget.Flags & TypeFlags.IsEnum) != 0 && (Flags & TypeFlags.IsEnum) != 0) { return(true); } if (m_Conversions != null && m_Conversions.Contains(inTarget)) { return(true); } if (m_BaseType != null) { return(m_BaseType.CanConvert(inTarget)); } return(false); }
internal override void Link(RSTypeAssembly inAssembly) { m_MethodSettings.Configure(m_MethodInfo, m_Parameters, true); OwnerType = m_MethodSettings.BoundType; ReturnType = RSInterop.RSTypeFor(m_MethodInfo.ReturnType, inAssembly); m_DefaultValue = m_DefaultSystemValue != null?RSInterop.ToRSValue(m_DefaultSystemValue) : ReturnType.DefaultValue; GenerateParameters(inAssembly); }
private bool TryCreateMeta(Type inType, out RSTypeInfo outMetadata) { if (inType.IsEnum) { Enum defaultVal = (Enum)Enum.ToObject(inType, 0); outMetadata = new RSTypeInfo(inType, null, RSValue.FromEnum(defaultVal)); outMetadata.InitializeEnum(); return(true); } outMetadata = null; return(false); }
static private bool MatchTriggerParameter(RSTriggerInfo inInfo, RSTypeInfo inTypeInfo) { if (inTypeInfo == null) { return(true); } if (inInfo.ParameterType == null) { return(inTypeInfo == RSBuiltInTypes.Void); } return(inTypeInfo.CanConvert(inInfo.ParameterType.Type)); }
/// <summary> /// Outputs to a collection of all trigger metadatas. /// </summary> public void GetAllTriggers(ICollection <RSTriggerInfo> outTriggers, RSTypeInfo inParameterType = null) { Assert.True(outTriggers != null, "Cannot output triggers to null collection"); foreach (var triggerMeta in m_Triggers.Values) { if (!MatchTriggerParameter(triggerMeta, inParameterType)) { continue; } outTriggers.Add(triggerMeta); } }
private bool TryGetMeta(Type inType, out RSTypeInfo outMetadata) { if (m_Types.TryGetValue(inType, out outMetadata)) { return(true); } foreach (var assembly in m_Dependencies) { if (assembly.TryGetMeta(inType, out outMetadata)) { return(true); } } return(false); }
/// <summary> /// Outputs to a collection of all query metadatas. /// </summary> public void GetAllQueries(ICollection <RSQueryInfo> outQueries, RSTypeInfo inReturnType = null, bool inbNoParams = false) { Assert.True(outQueries != null, "Cannot output queries to null collection"); foreach (var queryMeta in m_Queries.Values) { if (inReturnType != null && !queryMeta.ReturnType.CanConvert(inReturnType)) { continue; } if (inbNoParams && queryMeta.Parameters != null && queryMeta.Parameters.Length > 0) { continue; } outQueries.Add(queryMeta); } }
internal void SetBase(RSTypeInfo inBase) { m_BaseType = inBase; AddConversions(m_BaseType); }
public void AddTypeMeta(RSTypeInfo inType) { m_Types.Add(inType.SystemType, inType); }
/// <summary> /// Outputs to a collection of queries directly associated with the given entity. /// </summary> public void GetAllQueriesForEntity(IRSEntity inEntity, ICollection <RSQueryInfo> outQueries, RSTypeInfo inReturnType = null, bool inbNoParams = false) { Assert.True(outQueries != null, "Cannot output queries to null collection"); Assert.True(inEntity != null, "Cannot get queries for null entity"); GetAllQueriesForType(m_EntityType, outQueries, inReturnType, inbNoParams); foreach (var component in inEntity.GetRSComponentTypes(this)) { Assert.True(component != null, "Null component"); GetAllQueriesForType(component, outQueries, inReturnType, inbNoParams); } }
/// <summary> /// Outputs to a collection of queries associated with the given type. /// </summary> public void GetAllQueriesForType(Type inType, ICollection <RSQueryInfo> outQueries, RSTypeInfo inReturnType = null, bool inbNoParams = false) { Assert.True(outQueries != null, "Cannot output queries to null collection"); Assert.True(inType != null, "Cannot get queries for null type"); foreach (var queryMeta in m_Queries.Values) { Type type = queryMeta.OwnerType; if (type != null && type.IsAssignableFrom(inType)) { if (inReturnType != null && !queryMeta.ReturnType.CanConvert(inReturnType)) { continue; } if (inbNoParams && queryMeta.Parameters != null && queryMeta.Parameters.Length > 0) { continue; } outQueries.Add(queryMeta); } } }
/// <summary> /// Outputs to a collection of triggers directly associated with the given entity. /// </summary> public void GetAllTriggersForEntity(IRSEntity inEntity, ICollection <RSTriggerInfo> outTriggers, RSTypeInfo inParameterType = null) { Assert.True(outTriggers != null, "Cannot output triggers to null collection"); Assert.True(inEntity != null, "Cannot get triggers for null entity data"); GetAllTriggersForType(m_EntityType, outTriggers, inParameterType); foreach (var componentType in inEntity.GetRSComponentTypes(this)) { Assert.True(componentType != null, "Null component data"); GetAllTriggersForType(componentType, outTriggers, inParameterType); } }
/// <summary> /// Outputs to a collection of triggers associated with the given type. /// </summary> public void GetAllTriggersForType(Type inType, ICollection <RSTriggerInfo> outTriggers, RSTypeInfo inParameterType = null) { Assert.True(outTriggers != null, "Cannot output triggers to null collection"); Assert.True(inType != null, "Cannot get triggers for null type"); foreach (var triggerMeta in m_Triggers.Values) { Type type = triggerMeta.OwnerType; if (type != null && type.IsAssignableFrom(inType)) { if (!MatchTriggerParameter(triggerMeta, inParameterType)) { continue; } outTriggers.Add(triggerMeta); } } }
internal void Link(RSTypeAssembly inAssembly) { Type = RSInterop.RSTypeFor(m_FieldType, inAssembly); }