示例#1
0
 /// <summary>
 /// Sets up the matrix of possible conversions to all basic datatypes to the mode supplied.
 /// </summary>
 /// <param name="typeConversionMode">See TypeConversionMode</param>
 public static void SetDefaultConversionMatrix(LObjectType type, int typeConversionMode)
 {
     AddConversionTo(type, TypeConstants.Array, typeConversionMode);
     AddConversionTo(type, TypeConstants.Bool, typeConversionMode);
     AddConversionTo(type, TypeConstants.Date, typeConversionMode);
     AddConversionTo(type, TypeConstants.Map, typeConversionMode);
     AddConversionTo(type, TypeConstants.Number, typeConversionMode);
     AddConversionTo(type, TypeConstants.Null, typeConversionMode);
     AddConversionTo(type, TypeConstants.String, typeConversionMode);
     AddConversionTo(type, TypeConstants.Time, typeConversionMode);
 }
示例#2
0
        /// <summary>
        /// Adds a conversion flag that indicates if converting from this type to the supplied type is possible
        /// </summary>
        /// <param name="typeVal">See TypeConstants : The type value of the destination basic type to convert to</param>
        /// <param name="mode">See TypeConversionMode: Flag indicating mode of conversion</param>
        /// <returns></returns>
        public static void AddConversionTo(LObjectType type, int typeVal, int mode)
        {
            Dictionary <int, int> conversionMap = null;

            if (_basicConversions.ContainsKey(type.TypeVal))
            {
                conversionMap = _basicConversions[type.TypeVal];
            }
            else
            {
                conversionMap = new Dictionary <int, int>();
                _basicConversions[type.TypeVal] = conversionMap;
            }
            conversionMap[typeVal] = mode;
        }
示例#3
0
 /// <summary>
 /// Converts to host language type to a fluentscript type.
 /// </summary>
 /// <param name="hostLangType"></param>
 /// <returns></returns>
 public static LType ConvertToLangTypeClass(Type hostLangType)
 {
     var type = new LObjectType();
     type.Name = hostLangType.Name;
     type.FullName = hostLangType.FullName;
     type.TypeVal = TypeConstants.LClass;
     return type;
 }
示例#4
0
 /// <summary>
 /// Sets up the matrix of possible conversions to all basic datatypes to the mode supplied.
 /// </summary>
 /// <param name="typeConversionMode">See TypeConversionMode</param>
 public static void SetDefaultConversionMatrix(LObjectType type, int typeConversionMode)
 {
     AddConversionTo(type, TypeConstants.Array, typeConversionMode);
     AddConversionTo(type, TypeConstants.Bool, typeConversionMode);
     AddConversionTo(type, TypeConstants.Date, typeConversionMode);
     AddConversionTo(type, TypeConstants.Map, typeConversionMode);
     AddConversionTo(type, TypeConstants.Number, typeConversionMode);
     AddConversionTo(type, TypeConstants.Null, typeConversionMode);
     AddConversionTo(type, TypeConstants.String, typeConversionMode);
     AddConversionTo(type, TypeConstants.Time, typeConversionMode);
 }
示例#5
0
 /// <summary>
 /// Adds a conversion flag that indicates if converting from this type to the supplied type is possible
 /// </summary>
 /// <param name="typeVal">See TypeConstants : The type value of the destination basic type to convert to</param>
 /// <param name="mode">See TypeConversionMode: Flag indicating mode of conversion</param>
 /// <returns></returns>
 public static void AddConversionTo(LObjectType type, int typeVal, int mode)
 {
     Dictionary<int, int> conversionMap = null;
     if (_basicConversions.ContainsKey(type.TypeVal))
         conversionMap = _basicConversions[type.TypeVal];
     else
     {
         conversionMap = new Dictionary<int, int>();
         _basicConversions[type.TypeVal] = conversionMap;
     }
     conversionMap[typeVal] = mode;
 }