コード例 #1
0
    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};");
        }
    }
コード例 #2
0
    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));");
        }
    }
コード例 #3
0
    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};");
        }
    }
コード例 #4
0
    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};");
        }
    }
コード例 #5
0
    public override string GetErrorMaskTypeStr(TypeGeneration field)
    {
        LoquiType loqui = field as LoquiType;

        return($"MaskItem<Exception, {loqui.Mask(MaskType.Error)}?>");
    }
コード例 #6
0
    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;");
    }
コード例 #7
0
 public static string GetObjectErrorMask(LoquiType loqui, string accessor)
 {
     return($"new MaskItem<Exception, {loqui.Mask(MaskType.Error)}>(null, {accessor})");
 }
コード例 #8
0
    public override string GetTranslationMaskTypeStr(TypeGeneration field)
    {
        LoquiType loqui = field as LoquiType;

        return($"MaskItem<bool, {loqui.Mask(MaskType.Translation)}?>");
    }