示例#1
0
 public CustomMethodAPI(
     bool isPublic,
     APILine api,
     string defaultFallback = null)
 {
     Public          = isPublic;
     API             = api;
     DefaultFallback = new APIResult(api, defaultFallback);
 }
示例#2
0
 public static CustomMethodAPI FactoryPublic(
     APILine api)
 {
     return(new CustomMethodAPI()
     {
         Public = true,
         API = api,
         DefaultFallback = null
     });
 }
示例#3
0
 public static CustomMethodAPI FactoryPrivate(
     APILine api,
     string defaultFallback)
 {
     return(new CustomMethodAPI()
     {
         Public = false,
         API = api,
         DefaultFallback = new APIResult(api, defaultFallback)
     });
 }
示例#4
0
    public XmlTranslationModule(LoquiGenerator gen)
        : base(gen)
    {
        _typeGenerations[typeof(LoquiType)]           = new LoquiXmlTranslationGeneration();
        _typeGenerations[typeof(BoolNullType)]        = new PrimitiveXmlTranslationGeneration <bool?>();
        _typeGenerations[typeof(BoolType)]            = new PrimitiveXmlTranslationGeneration <bool>();
        _typeGenerations[typeof(CharNullType)]        = new PrimitiveXmlTranslationGeneration <char?>();
        _typeGenerations[typeof(CharType)]            = new PrimitiveXmlTranslationGeneration <char>();
        _typeGenerations[typeof(DateTimeNullType)]    = new PrimitiveXmlTranslationGeneration <DateTime?>();
        _typeGenerations[typeof(DateTimeType)]        = new PrimitiveXmlTranslationGeneration <DateTime>();
        _typeGenerations[typeof(DoubleNullType)]      = new PrimitiveXmlTranslationGeneration <double?>();
        _typeGenerations[typeof(DoubleType)]          = new PrimitiveXmlTranslationGeneration <double>();
        _typeGenerations[typeof(EnumType)]            = new EnumXmlTranslationGeneration();
        _typeGenerations[typeof(EnumNullType)]        = new EnumXmlTranslationGeneration();
        _typeGenerations[typeof(FloatNullType)]       = new PrimitiveXmlTranslationGeneration <float?>("Float");
        _typeGenerations[typeof(FloatType)]           = new PrimitiveXmlTranslationGeneration <float>("Float");
        _typeGenerations[typeof(Int8NullType)]        = new PrimitiveXmlTranslationGeneration <sbyte?>("Int8");
        _typeGenerations[typeof(Int8Type)]            = new PrimitiveXmlTranslationGeneration <sbyte>("Int8");
        _typeGenerations[typeof(Int16NullType)]       = new PrimitiveXmlTranslationGeneration <short?>();
        _typeGenerations[typeof(Int16Type)]           = new PrimitiveXmlTranslationGeneration <short>();
        _typeGenerations[typeof(Int32NullType)]       = new PrimitiveXmlTranslationGeneration <int?>();
        _typeGenerations[typeof(Int32Type)]           = new PrimitiveXmlTranslationGeneration <int>();
        _typeGenerations[typeof(Int64NullType)]       = new PrimitiveXmlTranslationGeneration <long?>();
        _typeGenerations[typeof(Int64Type)]           = new PrimitiveXmlTranslationGeneration <long>();
        _typeGenerations[typeof(P2Int32NullType)]     = new PrimitiveXmlTranslationGeneration <P2Int?>();
        _typeGenerations[typeof(P2Int32Type)]         = new PrimitiveXmlTranslationGeneration <P2Int>();
        _typeGenerations[typeof(P2Int16NullType)]     = new PrimitiveXmlTranslationGeneration <P2Int16?>();
        _typeGenerations[typeof(P2Int16Type)]         = new PrimitiveXmlTranslationGeneration <P2Int16>();
        _typeGenerations[typeof(P2FloatNullType)]     = new PrimitiveXmlTranslationGeneration <P2Float?>();
        _typeGenerations[typeof(P2FloatType)]         = new PrimitiveXmlTranslationGeneration <P2Float>();
        _typeGenerations[typeof(P3FloatNullType)]     = new PrimitiveXmlTranslationGeneration <P3Float?>();
        _typeGenerations[typeof(P3FloatType)]         = new PrimitiveXmlTranslationGeneration <P3Float>();
        _typeGenerations[typeof(P3IntNullType)]       = new PrimitiveXmlTranslationGeneration <P3Int?>();
        _typeGenerations[typeof(P3IntType)]           = new PrimitiveXmlTranslationGeneration <P3Int>();
        _typeGenerations[typeof(P3UInt8NullType)]     = new PrimitiveXmlTranslationGeneration <P3UInt8?>();
        _typeGenerations[typeof(P3UInt8Type)]         = new PrimitiveXmlTranslationGeneration <P3UInt8>();
        _typeGenerations[typeof(P3UInt16NullType)]    = new PrimitiveXmlTranslationGeneration <P3UInt16?>();
        _typeGenerations[typeof(P3UInt16Type)]        = new PrimitiveXmlTranslationGeneration <P3UInt16>();
        _typeGenerations[typeof(P3Int16NullType)]     = new PrimitiveXmlTranslationGeneration <P3Int16?>();
        _typeGenerations[typeof(P3Int16Type)]         = new PrimitiveXmlTranslationGeneration <P3Int16>();
        _typeGenerations[typeof(P3DoubleNullType)]    = new PrimitiveXmlTranslationGeneration <P3Double?>();
        _typeGenerations[typeof(P3DoubleType)]        = new PrimitiveXmlTranslationGeneration <P3Double>();
        _typeGenerations[typeof(PercentNullType)]     = new PrimitiveXmlTranslationGeneration <Percent?>();
        _typeGenerations[typeof(PercentType)]         = new PercentXmlTranslationGeneration();
        _typeGenerations[typeof(RangeDoubleNullType)] = new PrimitiveXmlTranslationGeneration <RangeDouble?>();
        _typeGenerations[typeof(RangeDoubleType)]     = new PrimitiveXmlTranslationGeneration <RangeDouble>();
        _typeGenerations[typeof(StringType)]          = new PrimitiveXmlTranslationGeneration <string>(nullable: true)
        {
            CanBeNotNullable = false
        };
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt8?>)]   = new PrimitiveXmlTranslationGeneration <RangeInt8?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt8>)]    = new PrimitiveXmlTranslationGeneration <RangeInt8>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt16?>)]  = new PrimitiveXmlTranslationGeneration <RangeInt16?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt16>)]   = new PrimitiveXmlTranslationGeneration <RangeInt16>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt32?>)]  = new PrimitiveXmlTranslationGeneration <RangeInt32?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt32>)]   = new PrimitiveXmlTranslationGeneration <RangeInt32>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt64?>)]  = new PrimitiveXmlTranslationGeneration <RangeInt64?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeInt64>)]   = new PrimitiveXmlTranslationGeneration <RangeInt64>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt8?>)]  = new PrimitiveXmlTranslationGeneration <RangeUInt8?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt8>)]   = new PrimitiveXmlTranslationGeneration <RangeUInt8>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt16?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt16?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt16>)]  = new PrimitiveXmlTranslationGeneration <RangeUInt16>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt32?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt32?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt32>)]  = new PrimitiveXmlTranslationGeneration <RangeUInt32>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt64?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt64?>();
        _typeGenerations[typeof(TypicalRangedIntType <RangeUInt64>)]  = new PrimitiveXmlTranslationGeneration <RangeUInt64>();
        _typeGenerations[typeof(UDoubleNullType)]       = new PrimitiveXmlTranslationGeneration <UDouble?>();
        _typeGenerations[typeof(UDoubleType)]           = new PrimitiveXmlTranslationGeneration <UDouble>();
        _typeGenerations[typeof(UInt8NullType)]         = new PrimitiveXmlTranslationGeneration <byte?>();
        _typeGenerations[typeof(UInt8Type)]             = new PrimitiveXmlTranslationGeneration <byte>();
        _typeGenerations[typeof(UInt16NullType)]        = new PrimitiveXmlTranslationGeneration <ushort?>();
        _typeGenerations[typeof(UInt16Type)]            = new PrimitiveXmlTranslationGeneration <ushort>();
        _typeGenerations[typeof(UInt32NullType)]        = new PrimitiveXmlTranslationGeneration <uint?>();
        _typeGenerations[typeof(UInt32Type)]            = new PrimitiveXmlTranslationGeneration <uint>();
        _typeGenerations[typeof(UInt64NullType)]        = new PrimitiveXmlTranslationGeneration <ulong?>();
        _typeGenerations[typeof(UInt64Type)]            = new PrimitiveXmlTranslationGeneration <ulong>();
        _typeGenerations[typeof(FilePathType)]          = new PrimitiveXmlTranslationGeneration <FilePath>();
        _typeGenerations[typeof(FilePathNullType)]      = new PrimitiveXmlTranslationGeneration <FilePath?>();
        _typeGenerations[typeof(DirectoryPathType)]     = new PrimitiveXmlTranslationGeneration <DirectoryPath>();
        _typeGenerations[typeof(DirectoryPathNullType)] = new PrimitiveXmlTranslationGeneration <DirectoryPath?>();
        _typeGenerations[typeof(ListType)]      = new ListXmlTranslationGeneration();
        _typeGenerations[typeof(DictType)]      = new DictXmlTranslationGeneration();
        _typeGenerations[typeof(ByteArrayType)] = new ByteArrayXmlTranslationGeneration();
        _typeGenerations[typeof(NothingType)]   = new NothingXmlTranslationGeneration();
        _typeGenerations[typeof(ColorType)]     = new PrimitiveXmlTranslationGeneration <Color>();
        MainAPI = new TranslationModuleAPI(
            writerAPI: new MethodAPI(
                majorAPI: new APILine[] { XElementLine },
                customAPI: null,
                optionalAPI: new APILine[] { NameLine }),
            readerAPI: new MethodAPI(
                majorAPI: new APILine[] { XElementLine },
                customAPI: null,
                optionalAPI: null));
        MinorAPIs.Add(
            new TranslationModuleAPI(
                writerAPI: new MethodAPI(
                    majorAPI: new APILine[] { PathLine },
                    customAPI: null,
                    optionalAPI: new APILine[] { NameLine }),
                readerAPI: new MethodAPI(
                    majorAPI: new APILine[] { PathLine },
                    customAPI: null,
                    optionalAPI: null))
        {
            Funnel = new TranslationFunnel(
                MainAPI,
                ConvertFromPathOut,
                ConvertFromPathIn)
        });
        var stream = new APILine("Stream", "Stream stream");

        MinorAPIs.Add(
            new TranslationModuleAPI(
                writerAPI: new MethodAPI(
                    majorAPI: new APILine[] { stream },
                    customAPI: null,
                    optionalAPI: new APILine[] { NameLine }),
                readerAPI: new MethodAPI(
                    majorAPI: new APILine[] { stream },
                    customAPI: null,
                    optionalAPI: null))
        {
            Funnel = new TranslationFunnel(
                MainAPI,
                ConvertFromStreamOut,
                ConvertFromStreamIn)
        });
    }