Beispiel #1
0
        ITypeDescriber[] _BuildDescribers(params Type[] types)
        {
            int id         = 0;
            var describers = new List <ITypeDescriber>();

            foreach (var type in types)
            {
                var identifier = new TypeIdentifier(type, ++id);
                describers.Add(identifier.Describer);
            }

            return(describers.ToArray());
        }
Beispiel #2
0
 public TypeIdentifier(Type type, int id)
 {
     if (TypeIdentifier._IsEnum(type))
     {
         Describer = new EnumDescriber(id, type);
     }
     else if (TypeIdentifier._IsNumber(type))
     {
         Describer = new NumberDescriber(id, type);
     }
     else if (TypeIdentifier._IsByteArray(type))
     {
         Describer = new ByteArrayDescriber(id);
     }
     else if (TypeIdentifier._IsBuffer(type))
     {
         Describer = new BufferDescriber(id, type);
     }
     else if (TypeIdentifier._IsBittable(type))
     {
         Describer = new BlittableDescriber(id, type);
     }
     else if (TypeIdentifier._IsString(type))
     {
         Describer = new StringDescriber(id);
     }
     else if (_IsArray(type))
     {
         Describer = new ArrayDescriber(id, type);
     }
     else if (TypeIdentifier._IsClass(type))
     {
         Describer = new ClassDescriber(id, type);
     }
     else
     {
         throw new Exception("Unrecognized type " + type.FullName);
     }
 }
Beispiel #3
0
 public static bool IsString(Type type)
 {
     return(TypeIdentifier._IsString(type));
 }
Beispiel #4
0
 public static bool IsAtom(Type type)
 {
     return(TypeIdentifier._IsNumber(type) || TypeIdentifier._IsBittable(type) || TypeIdentifier._IsBuffer(type) || TypeIdentifier._IsByteArray(type) || TypeIdentifier._IsEnum(type));
 }
Beispiel #5
0
 public static bool IsClass(Type type)
 {
     return(TypeIdentifier._IsClass(type));
 }