当前位置: 首页>>代码示例>>C#>>正文


C# G25类代码示例

本文整理汇总了C#中G25的典型用法代码示例。如果您正苦于以下问题:C# G25类的具体用法?C# G25怎么用?C# G25使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


G25类属于命名空间,在下文中一共展示了G25类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateBasicInfo

        public static void GenerateBasicInfo(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd)
        {
            string accessModifier = Keywords.ConstAccessModifier(S);
            string accessModifierArr = Keywords.ConstArrayAccessModifier(S);
            string stringType = Keywords.StringType(S);
            string boolType = G25.CG.Shared.CodeUtil.GetBoolType(S);

            // dimension of space
            new G25.CG.Shared.Comment("The dimension of the space").Write(SB, S, 1);
            SB.AppendLine("\tpublic " + accessModifier + " int SpaceDim = " + S.m_dimension + ";");

            // number of groups in general multivector
            new G25.CG.Shared.Comment("Number of groups/grades of coordinates in a multivector").Write(SB, S, 1);
            SB.AppendLine("\tpublic " + accessModifier + " int NbGroups = " + S.m_GMV.NbGroups + ";");

            // Euclidean metric?
            new G25.CG.Shared.Comment("Is the metric of the space Euclidean? (false or true)").Write(SB, S, 1);
            SB.AppendLine("\tpublic " + accessModifier + " " + boolType + " MetricEuclidean = " +
                (S.GetMetric("default").m_metric.IsEuclidean() ? "true" : "false") + ";");

            // basis vector names
            new G25.CG.Shared.Comment("Names of the basis vectors.").Write(SB, S, 1);
            SB.AppendLine("\tpublic " + accessModifierArr + " " + stringType + "[] BasisVectorNames = new " + stringType + "[] {");
            SB.Append("\t\t");
            for (int i = 0; i < S.m_dimension; i++)
            {
                if (i > 0) SB.Append(", ");
                SB.Append("\"" + S.m_basisVectorNames[i] + "\"");
            }
            SB.AppendLine("");
            SB.AppendLine("\t};");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:32,代码来源:source.cs

示例2: WriteFunctionShortcut

        /// <summary>
        /// Writes a shortcut for 'type', 'fgs'.
        /// </summary>
        /// <param name="SB">Where the code goes.</param>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Not used yet.</param>
        /// <param name="FT">Float point type of 'type'.</param>
        /// <param name="type">The type for which shortcuts should be written.</param>
        /// <param name="fgs"></param>
        /// <param name="FAI"></param>
        public static void WriteFunctionShortcut(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.VariableType type,
            G25.fgs fgs, FuncArgInfo[] FAI)
        {
            int nbTabs = 1;

            FuncArgInfo[] tailFAI = getTail(FAI);

            string shortcutCall = getShortcutCall(S, fgs, tailFAI);

            SB.AppendLine("");

            // output comment
            new Comment("shortcut to " + shortcutCall).Write(SB, S, nbTabs);

            bool inline = false;
            bool staticFunc = false;
            string returnType = FT.GetMangledName(S, fgs.ReturnTypeName);
            FuncArgInfo returnArgument = null;

            SB.Append('\t', nbTabs);
            Functions.WriteDeclaration(SB, S, cgd,
                inline, staticFunc, returnType, fgs.OutputName,
                returnArgument, tailFAI);
            SB.AppendLine(" {");

            SB.Append('\t', nbTabs+1);
            SB.Append("return ");
            SB.Append(shortcutCall);
            SB.AppendLine(";");

            SB.Append('\t', nbTabs);
            SB.AppendLine("}");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:43,代码来源:shortcut.cs

示例3: CanImplement

 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return (((F.Name == "hp") || (F.Name == "ihp")) && (F.MatchNbArguments(NB_ARGS)) &&
         G25.CG.Shared.Functions.NotMixScalarGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotMixSmvGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotUseOm(S, F, NB_ARGS, S.m_GMV.Name));
 }
开发者ID:Sciumo,项目名称:gaigen,代码行数:13,代码来源:hp.cs

示例4: GetConverterDependency

        /// <summary>
        /// Resolves a converter (underscore constructor) dependency.
        /// Searches for a converter from 'fromType' to 'toType'.
        /// 
        /// If the function is not found, this is also enlisted in cgd.m_missingDependencies.
        /// Call cgd.PrintMissingDependencies() should be called to report the missing dependencies
        /// to the end-user.
        /// </summary>
        /// <param name="S">The spec.</param>
        /// <param name="cgd">Missing dependencies go into cgd.m_missingDependencies.</param>
        /// <param name="fromType"></param>
        /// <param name="toType"></param>
        /// <param name="FT"></param>
        /// <returns></returns>
        public static string GetConverterDependency(Specification S, CGdata cgd, string fromType, string toType, G25.FloatType FT)
        {
            // look for 'funcName' in all G25.fgs in the spec
            //                    string funcName = "_" + FT.GetMangledName(S, toType);
            string funcName = "_" + toType;
            foreach (G25.fgs F in S.m_functions)
            {
                if (F.IsConverter(S)) // is 'F' a converter (underscore constructor)?
                {
                    if ((F.Name == funcName) &&
                        (F.ArgumentTypeNames[0] == fromType))
                    {
                        return G25.CG.Shared.Converter.GetConverterName(S, F, FT.GetMangledName(S, fromType), FT.GetMangledName(S, toType));
                    }
                }
            }

            // converter not found: add it to missing deps:
            {
                // add dependency to list of missing deps:
                string outputName = null;
                string[] argumentTypes = new string[] { fromType };
                string[] argVarNames = null;
                string returnTypeName = null;
                string metricName = null;
                string comment = null;
                Dictionary<string, string> options = null;
                G25.fgs F = new G25.fgs(funcName, outputName, returnTypeName, argumentTypes, argVarNames, new string[] { FT.type }, metricName, comment, options);
                cgd.AddMissingDependency(S, F);
            }

            // return fictional name:
            G25.fgs tmpF = null;
            return "missingFunction_" + G25.CG.Shared.Converter.GetConverterName(S, tmpF, FT.GetMangledName(S, fromType), FT.GetMangledName(S, toType));
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:49,代码来源:dependencies.cs

示例5: CanImplement

        protected G25.SMV m_smv2 = null; ///< if function over SMV, type goes here

        #endregion Fields

        #region Methods

        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            //String type F.GetArgumentTypeName(0, S.m_GMV.Name);
            return ((F.Name == "equals") && (F.MatchNbArguments(NB_ARGS)) &&
                G25.CG.Shared.Functions.NotMixSmvGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
                G25.CG.Shared.Functions.NotUseOm(S, F, NB_ARGS, S.m_GMV.Name));
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:19,代码来源:equals.cs

示例6: GenerateCode

        /// <summary>
        /// Generates a source file with the GOM class definition.
        /// </summary>
        /// <param name="S"></param>
        /// <param name="cgd"></param>
        /// <param name="FT"></param>
        /// <returns></returns>
        public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT)
        {
            G25.GOM gom = S.m_GOM;
            string className = FT.GetMangledName(S, gom.Name);

            // get range vector type
            G25.SMV rangeVectorType = G25.CG.Shared.OMinit.GetRangeVectorType(S, FT, cgd, gom);
            string rangeVectorSMVname = FT.GetMangledName(S, rangeVectorType.Name);

            // get filename, list of generated filenames
            List<string> generatedFiles = new List<string>();
            string sourceFilename = MainGenerator.GetClassOutputPath(S, className);
            generatedFiles.Add(sourceFilename);

            // get StringBuilder where all generated code goes
            StringBuilder SB = new StringBuilder();

            // get a new 'cgd' where all ouput goes to the one StringBuilder SB
            cgd = new G25.CG.Shared.CGdata(cgd, SB, SB, SB);

            // output license, copyright
            G25.CG.Shared.Util.WriteCopyright(SB, S);
            G25.CG.Shared.Util.WriteLicense(SB, S);

            // open namespace
            G25.CG.Shared.Util.WriteOpenNamespace(SB, S);

            // write class comment
            G25.CG.CSJ.GOM.WriteComment(SB, S, cgd, FT, gom);

            // open class
            G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, null);

            // write member variables
            G25.CG.CSJ.GOM.WriteMemberVariables(SB, S, cgd, FT, gom);

            // write constructors
            G25.CG.CSJ.GOM.WriteConstructors(SB, S, cgd, FT, gom, className, rangeVectorSMVname);

            // write set functions
            G25.CG.CSJ.GOM.WriteSetIdentity(SB, S, cgd, FT);
            G25.CG.CSJ.GOM.WriteSetCopy(SB, S, cgd, FT);
            G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, false, false); // false, false = matrixMode, transpose
            G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, true, false); // true, false = matrixMode, transpose
            G25.CG.CSJ.GOM.WriteSOMtoGOMcopy(S, cgd, FT);

            // write shortcuts for functions
            G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, gom);

            // close class
            G25.CG.Shared.Util.WriteCloseClass(SB, S, className);

            // close namespace
            G25.CG.Shared.Util.WriteCloseNamespace(SB, S);

            // write all to file
            G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString());

            return sourceFilename;
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:67,代码来源:gom.cs

示例7: GetComment

        private static string GetComment(Specification S, bool declOnly, G25.fgs FGS, G25.Operator op, G25.FloatType FT, bool assign)
        {
            StringBuilder SB = new StringBuilder();

            if ((S.OutputCpp()) && op.IsUnaryInPlace())
            {
                if (op.IsPrefix)
                {
                    SB.Append("returns (" + FGS.ArgumentVariableNames[0] + " = " + FGS.OutputName + "(" + FGS.ArgumentVariableNames[0] + "))");
                }
                else
                {
                    SB.Append("returns input value of " + FGS.ArgumentVariableNames[0] + ", but sets " + FGS.ArgumentVariableNames[0] + " to " + FGS.OutputName + "(" + FGS.ArgumentVariableNames[0] + ")");
                }
            }
            else if (assign)
            {
                SB.Append("returns (" + FGS.ArgumentVariableNames[0] + " = " + FGS.OutputName + "(" + FGS.ArgumentVariableNames[0]);
                SB.Append(", " + FGS.ArgumentVariableNames[1]);
                SB.Append("))");
            }
            else {
                SB.Append("returns " + FGS.OutputName + "(" + FGS.ArgumentVariableNames[0]);
                if (op.IsBinary())
                    SB.Append(", " + FGS.ArgumentVariableNames[1]);
                SB.Append(")");
            }

            return SB.ToString();
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:30,代码来源:operators.cs

示例8: GetDualCode

 /// <summary>
 /// Returns the code for dualization wrt to whole space using metric <c>M</c>.
 /// The code is composed of calls to functions generated by <c>WriteGmvDualParts()</c>.
 /// 
 /// This function uses <c>cdg.m_gmvDualPartFuncNames</c>, but only to check whether a
 /// geometric product of some group with the pseudoscalar will get non-zero results in some
 /// other group.
 /// 
 /// The returned code is only the body. The function declaration is not included.
 /// </summary>
 /// <param name="S">Specification of algebra (used for general multivector type, output language).</param>
 /// <param name="cgd">Used for <c>m_gmvDualPartFuncNames</c>.</param>
 /// <param name="FT">Floating point type.</param>
 /// <param name="M">The metric of the dual.</param>
 /// <param name="FAI">Info about function arguments</param>
 /// <param name="resultName">Name of variable where the result goes (in the generated code).</param>
 /// <param name="dual">When true, 'dual' is generated, otherwise, 'undual' is generated.</param>
 /// <returns>code for the requested product type.</returns>
 public static string GetDualCode(Specification S, G25.CG.Shared.CGdata cgd, G25.FloatType FT, 
     G25.Metric M, G25.CG.Shared.FuncArgInfo[] FAI, string resultName, bool dual)
 {
     if (S.OutputCppOrC())
         return GetDualCodeCppOrC(S, cgd, FT, M, FAI, resultName, dual);
     else return GetDualCodeCSharpOrJava(S, cgd, FT, M, FAI, resultName, dual);
 }
开发者ID:Sciumo,项目名称:gaigen,代码行数:25,代码来源:dual_parts.cs

示例9: Converter

 public Converter(Specification S, G25.CG.Shared.CGdata cgd, G25.fgs F)
 {
     m_specification = S;
     m_cgd = cgd;
     m_fgs = F;
     m_fgs.InitArgumentPtrFromTypeNames(S);
 }
开发者ID:Sciumo,项目名称:gaigen,代码行数:7,代码来源:converter.cs

示例10: WriteAddSubHpFunction

        /// <summary>
        /// Writes any addition or subtraction function for general multivectors,
        /// based on CASN parts code.
        /// </summary>
        /// <param name="S"></param>
        /// <param name="cgd"></param>
        /// <param name="FT"></param>
        /// <param name="FAI"></param>
        /// <param name="F"></param>
        /// <param name="comment"></param>
        /// <param name="funcType">ADD, SUB or HP</param>
        /// <returns>Full name of generated function.</returns>
        public static string WriteAddSubHpFunction(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT,
            G25.CG.Shared.FuncArgInfo[] FAI, G25.fgs F,
            Comment comment, G25.CG.Shared.CANSparts.ADD_SUB_HP_TYPE funcType)
        {
            // setup instructions
            System.Collections.Generic.List<G25.CG.Shared.Instruction> I = new System.Collections.Generic.List<G25.CG.Shared.Instruction>();
            int nbTabs = 1;

            // write this function:
            string code = G25.CG.Shared.CANSparts.GetAddSubtractHpCode(S, cgd, FT, funcType, FAI, fgs.RETURN_ARG_NAME);

            // add one instruction (verbatim code)
            I.Add(new G25.CG.Shared.VerbatimCodeInstruction(nbTabs, code));

            // because of lack of overloading, function names include names of argument types
            G25.fgs CF = G25.CG.Shared.Util.AppendTypenameToFuncName(S, FT, F, FAI);

            // setup return type and argument:
            string returnTypeName = FT.GetMangledName(S, S.m_GMV.Name);
            G25.CG.Shared.FuncArgInfo returnArgument = null;
            if (S.OutputC())
                returnArgument = new G25.CG.Shared.FuncArgInfo(S, CF, -1, FT, S.m_GMV.Name, false); // false = compute value

            string funcName = CF.OutputName;
            //if (S.OutputC())
              //  funcName = FT.GetMangledName(S, funcName);

            // write function
            bool inline = false; // never inline GMV functions
            bool staticFunc = Functions.OutputStaticFunctions(S);
            G25.CG.Shared.Functions.WriteFunction(S, cgd, F, inline, staticFunc, returnTypeName, funcName, returnArgument, FAI, I, comment);

            return funcName;
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:46,代码来源:gmv_casn_parts.cs

示例11: WriteCopy

        /// <summary>
        /// Writes a function to copy an GOM struct
        /// </summary>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Results go here. Also intermediate data for code generation. Also contains plugins and cog.</param>
        public static void WriteCopy(Specification S, G25.CG.Shared.CGdata cgd)
        {
            StringBuilder declSB = cgd.m_declSB;
            StringBuilder defSB = (S.m_inlineSet) ? cgd.m_inlineDefSB : cgd.m_defSB;
            declSB.AppendLine("");
            defSB.AppendLine("");

            string dstName = "dst";
            string srcName = "src";
            string matrixName = "m";

            foreach (G25.FloatType FT in S.m_floatTypes)
            {
                String typeName = FT.GetMangledName(S, S.m_GOM.Name);
                String funcName = typeName + "_copy";
                //string comment = "/** Copies " + typeName + " */";
                declSB.AppendLine("void " + funcName + "(" + typeName + "*" + dstName + ", const " + typeName + "*" + srcName + ");");
                defSB.AppendLine("void " + funcName + "(" + typeName + "*" + dstName + ", const " + typeName + "*" + srcName + ") {");
                for (int g = 1; g < S.m_GOM.Domain.Length; g++)
                {
                    int s = S.m_GOM.Domain[g].Length * S.m_GOM.Range[g].Length;
                    defSB.AppendLine("\t" + G25.CG.Shared.Util.GetCopyCode(S, FT, srcName + "->" + matrixName + g, dstName + "->" + matrixName + g, s));
                } // end of loop over all grades of the OM
                defSB.AppendLine("}");
            }
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:31,代码来源:gom.cs

示例12: WriteCopy

        /// <summary>
        /// Writes a function to copy the value of one SMV struct to another, for all floating point types.
        /// </summary>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Intermediate data for code generation. Also contains plugins and cog.</param>
        public static void WriteCopy(Specification S, G25.CG.Shared.CGdata cgd)
        {
            StringBuilder declSB = cgd.m_declSB;
            StringBuilder defSB = (S.m_inlineSet) ? cgd.m_inlineDefSB : cgd.m_defSB;
            declSB.AppendLine("");
            defSB.AppendLine("");

            foreach (G25.FloatType FT in S.m_floatTypes)
            {
                foreach (G25.SMV smv in S.m_SMV)
                {
                    if (smv.NbNonConstBasisBlade == 0) continue;

                    String typeName = FT.GetMangledName(S, smv.Name);
                    String funcName = typeName + "_copy";
                    bool mustCast = false;

                    G25.fgs F = new G25.fgs(funcName, funcName, "", new String[] { smv.Name }, null, new String[] { FT.type }, null, null, null); // null, null, null = metricName, comment, options
                    F.InitArgumentPtrFromTypeNames(S);
                    bool computeMultivectorValue = false;
                    G25.CG.Shared.FuncArgInfo returnArgument = new G25.CG.Shared.FuncArgInfo(S, F, -1, FT, smv.Name, computeMultivectorValue);
                    int nbArgs = 1;
                    G25.CG.Shared.FuncArgInfo[] FAI = G25.CG.Shared.FuncArgInfo.GetAllFuncArgInfo(S, F, nbArgs, FT, null, computeMultivectorValue);

                    declSB.AppendLine("/** Copies " + typeName + ": " + FAI[0].Name + " = " + returnArgument.Name + " */");

                    RefGA.Multivector value = G25.CG.Shared.Symbolic.SMVtoSymbolicMultivector(S, smv, FAI[0].Name, FAI[0].Pointer);

                    bool staticFunc = false;
                    G25.CG.Shared.Functions.WriteAssignmentFunction(S, cgd,
                        S.m_inlineSet, staticFunc, "void", null, funcName, returnArgument, FAI, FT, mustCast, smv, returnArgument.Name, returnArgument.Pointer, value);
                }
            }
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:39,代码来源:smv.cs

示例13: BinaryScalarOpToLangString

        /// <summary>
        /// Converts a <c>RefGA.Symbolic.BinaryScalarOpToLangString</c> to code.
        /// 
        /// Handles special cases (such as inversion) and understands floating point
        /// types (e.g., <c>fabsf()</c> is used for floats and <c>fabs()</c> is used for doubles in C.
        /// </summary>
        /// <param name="S">Used for output language.</param>
        /// <param name="FT">Floating point type used.</param>
        /// <param name="Op">The operation to convert to code.</param>
        /// <returns>Code for implementing <c>Op</c>c>.</returns>
        public static string BinaryScalarOpToLangString(G25.Specification S, G25.FloatType FT, RefGA.Symbolic.BinaryScalarOp Op)
        {
            string value1Str = ScalarOpValueToLangString(S, FT, Op.value1);
            string value2Str = ScalarOpValueToLangString(S, FT, Op.value2);

            return OpNameToLangString(S, FT, Op.opName) + "(" + value1Str + ", " + value2Str + ")";
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:17,代码来源:codeutil.cs

示例14: WriteDefinition

        private static void WriteDefinition(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
        {
            // assume only SMV constants for now
            G25.SMV smv = C.Type as G25.SMV;
            ConstantSMV Csmv = C as ConstantSMV;

            string className = FT.GetMangledName(S, smv.Name);

            // MANGLED_TYPENAME MANGLED_CONSTANT_NAME = {...}
            SB.Append(className);
            SB.Append(" ");
            SB.Append(FT.GetMangledName(S, C.Name));

            if (smv.NbNonConstBasisBlade > 0) {
                // MANGLED_TYPENAME MANGLED_CONSTANT_NAME(...)
                SB.Append("(" + className + "::" + G25.CG.Shared.SmvUtil.GetCoordinateOrderConstant(S, smv));

                for (int c = 0; c < smv.NbNonConstBasisBlade; c++)
                {
                    SB.Append(", ");
                    SB.Append(FT.DoubleToString(S, Csmv.Value[c]));
                }

                SB.Append(")");
            }

            SB.AppendLine(";");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:28,代码来源:constants.cs

示例15: GenerateCode

        public static List<string> GenerateCode(Specification S, G25.CG.Shared.CGdata cgd)
        {
            // get filename, list of generated filenames
            List<string> generatedFiles = new List<string>();

            if (!S.m_reportUsage) return generatedFiles;

            string sourceFilename = S.GetOutputPath(GetRawSourceFilename(S));
            generatedFiles.Add(sourceFilename);

            // get StringBuilder where all generated code goes
            StringBuilder SB = new StringBuilder();

            // output license, copyright
            G25.CG.Shared.Util.WriteCopyright(SB, S);
            G25.CG.Shared.Util.WriteLicense(SB, S);

            // using ...
            Util.WriteGenericUsing(SB, S);
            SB.AppendLine("using System.Collections.Generic;");
            SB.AppendLine("using System.Text;");

            // open namespace
            G25.CG.Shared.Util.WriteOpenNamespace(SB, S);

            cgd.m_cog.EmitTemplate(SB, "reportUsage");

            // close namespace
            G25.CG.Shared.Util.WriteCloseNamespace(SB, S);

            // write all to file
            G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString());

            return generatedFiles;
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:35,代码来源:reportusage.cs


注:本文中的G25类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。