Example #1
0
        /// <summary>
        /// Adds prefix and suffix to type according to the floating point type used, unless the
        /// String already has the prefix or suffix.
        /// 
        /// Also detects 'boolean' type and adjusts it to output language.
        /// </summary>
        /// <returns>'typeName' mangled according to floating point type 'floatTypeIndex'.</returns>
        public string GetMangledName(Specification S, string typeName)
        {
            if (typeName.Contains(G25.Specification.DONT_MANGLE) ||
                typeName.Contains(type))
                return typeName;

            // This change (for example) "double" -> "float"
            if (S.IsFloatType(typeName))
                return type;

            if (typeName.Equals(BooleanType.BOOLEAN))
            {
                return S.OutputJava() ? typeName : "bool";
            }
            else if (typeName.Equals(IntegerType.INTEGER)) {
                return typeName;
            }
            else if (typeName.Equals(GroupBitmapType.GROUP_BITMAP))
            {
                return S.OutputCSharp() ? typeName : IntegerType.INTEGER;
            }

            if ((prefix.Length > 0) && (!typeName.StartsWith(prefix)))
                typeName = prefix + typeName;
            if ((suffix.Length > 0) && (!typeName.EndsWith(suffix)))
                typeName = typeName + suffix;

            return typeName;
        }