public StructABI[] BuildStructsFromTuple(IDictionary <string, object> item) { var structs = new List <StructABI>(); var structitem = new StructABI(GetStructTypeOrNameAsType(item)); var parameters = new List <ParameterABI>(); var parameterOrder = 0; var components = (List <object>)item["components"]; foreach (IDictionary <string, object> component in components) { parameterOrder = parameterOrder + 1; if (component["type"].ToString().StartsWith("tuple")) { var structType = GetStructTypeOrNameAsType(component); var parameter = new ParameterABI((string)component["type"], (string)component["name"], parameterOrder, structType); structs.AddRange(BuildStructsFromTuple(component)); parameters.Add(parameter); } else { var parameter = new ParameterABI((string)component["type"], (string)component["name"], parameterOrder); parameters.Add(parameter); } } structitem.InputParameters = parameters.ToArray(); structs.Add(structitem); return(structs.ToArray()); }
public StructTypeGenerator(StructABI structTypeABI, string @namespace, CodeGenLanguage codeGenLanguage) { ClassModel = new StructTypeModel(structTypeABI, @namespace) { CodeGenLanguage = codeGenLanguage }; InitialiseTemplate(codeGenLanguage); }
public StructTypeModel(StructABI structTypeABI, string @namespace) : base(@namespace, structTypeABI.Name, "") { StructTypeABI = structTypeABI; InitisialiseNamespaceDependencies(); }