Exemplo n.º 1
0
 public bool Applicable(LoquiInterfaceType interfaceType, CommonGenerics commonGen, params MaskType[] maskTypes)
 {
     if (AcceptingAll)
     {
         return(true);
     }
     if (commonGen != CommonGen)
     {
         return(false);
     }
     if (interfaceType != _loquiInterface)
     {
         return(false);
     }
     if (maskTypes?.Length == 0)
     {
         return(_maskTypeSet.Count == 1 && _maskTypeSet.Contains(MaskType.Normal));
     }
     if (maskTypes.Length != _maskTypeSet.Count)
     {
         return(false);
     }
     foreach (var maskType in maskTypes)
     {
         if (!_maskTypeSet.Contains(maskType))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
 public MaskTypeSet(LoquiInterfaceType interfaceType, IEnumerable <MaskType> types, bool acceptAll, CommonGenerics commonGen)
 {
     CommonGen       = commonGen;
     _maskTypeSet    = new HashSet <MaskType>(types);
     AcceptingAll    = acceptAll;
     _loquiInterface = interfaceType;
     IsMainSet       = interfaceType == LoquiInterfaceType.IGetter && (_maskTypeSet.Count == 0 || (_maskTypeSet.Count == 1 && _maskTypeSet.Contains(MaskType.Normal)));
 }
Exemplo n.º 3
0
    public string TypeName(LoquiInterfaceType interfaceType)
    {
        switch (RefType)
        {
        case LoquiRefType.Direct:
            switch (interfaceType)
            {
            case LoquiInterfaceType.Direct:
                break;

            case LoquiInterfaceType.ISetter:
                interfaceType = SetterInterfaceType;
                break;

            case LoquiInterfaceType.IGetter:
                interfaceType = GetterInterfaceType;
                break;

            default:
                throw new NotImplementedException();
            }
            switch (interfaceType)
            {
            case LoquiInterfaceType.Direct:
                return(DirectTypeName);

            case LoquiInterfaceType.IGetter:
                return($"{Interface(getter: true, internalInterface: InternalGetInterface)}");

            case LoquiInterfaceType.ISetter:
                return($"{Interface(getter: false, internalInterface: InternalSetInterface)}");

            default:
                throw new NotImplementedException();
            }

        case LoquiRefType.Generic:
            return(_generic);

        case LoquiRefType.Interface:
            switch (interfaceType)
            {
            case LoquiInterfaceType.Direct:
            case LoquiInterfaceType.ISetter:
                return(SetterInterface);

            case LoquiInterfaceType.IGetter:
                return(GetterInterface);

            default:
                throw new NotImplementedException();
            }

        default:
            throw new NotImplementedException();
        }
    }
Exemplo n.º 4
0
 public IEnumerable <string> GetWheres(LoquiInterfaceType type)
 {
     if (BaseObjectGeneration != null)
     {
         yield return(BaseObjectGeneration.GetTypeName(type));
     }
     foreach (var item in _whereList.Skip(BaseObjectGeneration == null ? 0 : 1))
     {
         yield return(item);
     }
 }
Exemplo n.º 5
0
    public void Apply(StructuredStringBuilder sb, LoquiInterfaceType type)
    {
        switch (type)
        {
        case LoquiInterfaceType.Direct:
            Comments.Apply(sb);
            break;

        case LoquiInterfaceType.ISetter:
            (SetterInterface ?? Comments).Apply(sb);
            break;

        case LoquiInterfaceType.IGetter:
            (GetterInterface ?? Comments).Apply(sb);
            break;

        default:
            break;
        }
    }
Exemplo n.º 6
0
    public bool Contains(LoquiInterfaceType interfaceType, CommonGenerics commonGen, params MaskType[] maskTypes)
    {
        MaskTypeSet set = new MaskTypeSet(interfaceType, maskTypes, acceptAll: false, commonGen: commonGen);

        return(sets.Contains(set));
    }
Exemplo n.º 7
0
 public Task GenerateInField(ObjectGeneration obj, TypeGeneration typeGeneration, StructuredStringBuilder sb, LoquiInterfaceType type)
 {
     return(Task.WhenAll(
                subModules.Select(
                    (subGen) =>
     {
         return subGen.GenerateInField(obj, typeGeneration, sb, type);
     })));
 }