public override void GenerateForTranslationMask(StructuredStringBuilder sb, TypeGeneration field) { LoquiType loqui = field as LoquiType; if (loqui.RefType == LoquiRefType.Direct) { sb.AppendLine($"public {loqui.Mask(MaskType.Translation)}? {field.Name};"); } else { sb.AppendLine($"public bool {field.Name};"); } }
public override void GenerateForErrorMaskCombine(StructuredStringBuilder sb, TypeGeneration field, string accessor, string retAccessor, string rhsAccessor) { LoquiType loqui = field as LoquiType; if (!IsUnknownGeneric(loqui)) { sb.AppendLine($"{retAccessor} = {accessor}.Combine({rhsAccessor}, (l, r) => l.Combine(r));"); } else { sb.AppendLine($"{retAccessor} = new MaskItem<Exception?, {loqui.Mask(MaskType.Error)}?>(ExceptionExt.Combine({accessor}.Overall, {rhsAccessor}.Overall), Loqui.Internal.LoquiHelper.Combine({accessor}.Specific, {rhsAccessor}.Specific));"); } }
public override void GenerateForCopyMask(StructuredStringBuilder sb, TypeGeneration field) { LoquiType loqui = field as LoquiType; if (loqui.RefType == LoquiRefType.Direct) { if (loqui.Singleton) { if (loqui.SetterInterfaceType == LoquiInterfaceType.IGetter) { return; } sb.AppendLine($"public MaskItem<bool, {loqui.Mask(MaskType.Copy)}> {field.Name};"); } else { sb.AppendLine($"public MaskItem<{nameof(CopyOption)}, {loqui.Mask(MaskType.Copy)}> {field.Name};"); } } else { sb.AppendLine($"public {nameof(CopyOption)} {field.Name};"); } }
public override void GenerateForCopyMaskCtor(StructuredStringBuilder sb, TypeGeneration field, string basicValueStr, string deepCopyStr) { LoquiType loqui = field as LoquiType; if (loqui.RefType == LoquiRefType.Direct) { if (loqui.Singleton) { if (loqui.SetterInterfaceType == LoquiInterfaceType.IGetter) { return; } sb.AppendLine($"this.{field.Name} = new MaskItem<bool, {loqui.Mask(MaskType.Copy)}>({basicValueStr}, default);"); } else { sb.AppendLine($"this.{field.Name} = new MaskItem<{nameof(CopyOption)}, {loqui.Mask(MaskType.Copy)}>({deepCopyStr}, default);"); } } else { sb.AppendLine($"this.{field.Name} = {deepCopyStr};"); } }
public override string GetErrorMaskTypeStr(TypeGeneration field) { LoquiType loqui = field as LoquiType; return($"MaskItem<Exception, {loqui.Mask(MaskType.Error)}?>"); }
public override void GenerateSetMask(StructuredStringBuilder sb, TypeGeneration field) { LoquiType loqui = field as LoquiType; sb.AppendLine($"this.{field.Name} = (MaskItem<Exception?, {loqui.Mask(MaskType.Error)}?>?)obj;"); }
public static string GetObjectErrorMask(LoquiType loqui, string accessor) { return($"new MaskItem<Exception, {loqui.Mask(MaskType.Error)}>(null, {accessor})"); }
public override string GetTranslationMaskTypeStr(TypeGeneration field) { LoquiType loqui = field as LoquiType; return($"MaskItem<bool, {loqui.Mask(MaskType.Translation)}?>"); }