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); }
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))); }
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(); } }
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); } }
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; } }
public bool Contains(LoquiInterfaceType interfaceType, CommonGenerics commonGen, params MaskType[] maskTypes) { MaskTypeSet set = new MaskTypeSet(interfaceType, maskTypes, acceptAll: false, commonGen: commonGen); return(sets.Contains(set)); }
public Task GenerateInField(ObjectGeneration obj, TypeGeneration typeGeneration, StructuredStringBuilder sb, LoquiInterfaceType type) { return(Task.WhenAll( subModules.Select( (subGen) => { return subGen.GenerateInField(obj, typeGeneration, sb, type); }))); }