Esempio n. 1
0
        public static string FixType(string type)
        {
            if (type.Contains("_") && !IsFunctionPointer(type) && !type.EndsWith("_t") && !type.EndsWith("_t*"))
            {
                return(FixTemplate(type));
            }

            var fixedType = type;

            fixedType = fixedType.Replace("const ", "");
            fixedType = fixedType.Replace(" const", "");
            fixedType = fixedType.Replace("unsigned ", "u");
            fixedType = fixedType.Replace("signed ", "");
            fixedType = fixedType.Replace("_t", "");
            fixedType = RemovePrefix(fixedType);

            if (fixedType.EndsWith("int"))
            {
                fixedType += "32";
            }
            else if (fixedType.EndsWith("int*"))
            {
                fixedType = $"{fixedType.Remove(fixedType.Length - 4, 4)}int32*";
            }

            if (IsFunctionPointer(fixedType))
            {
                var returnType = fixedType.Substring(0, fixedType.IndexOf('('));
                var args       = ImGuiMethodParameter.From(fixedType.Substring(fixedType.IndexOf(')') + 1));
                fixedType = $"function {returnType}({args.ToLinkableDefinitionArg()})";
            }

            return(fixedType);
        }
 public ImGuiMethodDefinition(string name, string linkName, List <object> argsT, Dictionary <string, object> defaults)
 {
     Name     = name.ToPascalCase();
     LinkName = linkName;
     Args     = ImGuiMethodParameter.From(argsT.ConvertAll(a => (Dictionary <string, object>)a), defaults);
 }