コード例 #1
0
ファイル: Utilities.cs プロジェクト: wangzhefeng2000/opentk
        public static IEnumerable <string> GetNameVariations([NotNull] FunctionOverride functionOverride)
        {
            if (functionOverride.NameType == OverrideNameType.EntryPoint)
            {
                return(new[] { functionOverride.BaseName });
            }

            var extensionTrimmer = new OpenGLFunctionExtensionTrimmer();
            var dataTypeTrimmer  = new OpenGLFunctionDataTypeTrimmer();

            var variations       = new List <string>();
            var currentVariation = functionOverride.BaseName;

            variations.Add(currentVariation);

            if (OpenGLFunctionExtensionTrimmer.IsRelevant(functionOverride))
            {
                currentVariation = extensionTrimmer.Trim(functionOverride);
                variations.Add(currentVariation);
            }

            if (dataTypeTrimmer.IsRelevant(currentVariation))
            {
                variations.Add(dataTypeTrimmer.Trim(currentVariation));
            }

            return(variations.Distinct().OrderByDescending(v => v.Length));
        }
        /// <inheritdoc/>
        public ApiProfile Translate(ApiProfile profile)
        {
            var extensionTrimmer = new OpenGLFunctionExtensionTrimmer();
            var dataTypeTrimmer  = new OpenGLFunctionDataTypeTrimmer();

            var newFunctions = new List <FunctionSignature>();

            foreach (var function in profile.NativeSignatures)
            {
                var processingFunction = function;
                if (extensionTrimmer.IsRelevant(processingFunction))
                {
                    processingFunction = extensionTrimmer.Trim(processingFunction);
                }

                if (dataTypeTrimmer.IsRelevant(processingFunction))
                {
                    processingFunction = dataTypeTrimmer.Trim(processingFunction);
                }

                newFunctions.Add(processingFunction);
            }

            return(new ApiProfileBuilder(profile)
                   .WithNativeSignatures(newFunctions)
                   .Build());
        }
コード例 #3
0
ファイル: Utilities.cs プロジェクト: wangzhefeng2000/opentk
        public static IEnumerable <string> GetNameVariations(string functionEntrypoint)
        {
            var extensionTrimmer = new OpenGLFunctionExtensionTrimmer();
            var dataTypeTrimmer  = new OpenGLFunctionDataTypeTrimmer();

            var variations       = new List <string>();
            var currentVariation = functionEntrypoint;

            variations.Add(currentVariation);

            if (extensionTrimmer.IsRelevant(currentVariation))
            {
                currentVariation = extensionTrimmer.Trim(currentVariation);
                variations.Add(currentVariation);
            }

            if (dataTypeTrimmer.IsRelevant(currentVariation))
            {
                variations.Add(dataTypeTrimmer.Trim(currentVariation));
            }

            return(variations.Distinct().OrderByDescending(v => v.Length));
        }