private string ConvertFundamentalType()

in SharpGen.Platform/CppParser.cs [1104:1155]


        private string ConvertFundamentalType(string typeName)
        {
            var types = typeName.Split(' ');

            var isUnsigned = false;
            var outputType = "";
            var shortCount = 0;
            var longCount = 0;

            foreach (var type in types)
            {
                switch (type)
                {
                    case "unsigned":
                        isUnsigned = true;
                        break;
                    case "signed":
                        outputType = "int";
                        break;
                    case "long":
                        longCount++;
                        break;
                    case "short":
                        shortCount++;
                        break;
                    case "bool":
                    case "void":
                    case "char":
                    case "double":
                    case "int":
                    case "float":
                    case "wchar_t":
                        outputType = type;
                        break;
                    default:
                        Logger.Error(LoggingCodes.UnknownFundamentalType, "Unhandled partial type [{0}] from Fundamental type [{1}]", type, typeName);
                        break;
                }
            }

            if (longCount == 1)
                outputType = "long";
            if (longCount == 1 && outputType == "double")
                outputType = "long double";     // 96 bytes, unhandled
            if (longCount == 2)
                outputType = "long long";
            if (shortCount == 1)
                outputType = "short";
            if (isUnsigned)
                outputType = "unsigned " + outputType;
            return outputType;
        }