public override void VisitFieldCPPModel(FieldCPPModel model) { if (model.FieldType.IsArray) { AppendLine($"{CPPModelTools.Modifiers(model.Modifiers)} {TypeLookup.LookupCPPTypeName(model.FieldType.GetElementType())} {model.Name}[];"); } else { AppendLine($"{CPPModelTools.Modifiers(model.Modifiers)} {TypeLookup.LookupCPPTypeName(model.FieldType)} {model.Name};"); } }
public override void VisitClassCPPModel(ClassCPPModel model) { var delcarationParts = new[] { CPPModelTools.Modifiers(model.Modifiers, ModifersFlag.AccessTypeCPPModel), "class", model.Name }; var declarationLine = string.Join(" ", delcarationParts.Where(p => !string.IsNullOrWhiteSpace(p))); AppendLine($"{declarationLine}"); OpenBlock(); Invoke <ClassMembersCPPModelVisitor>(model.Members); CloseBlockWithSemicolon(); }
public override void VisitMethodCPPModel(MethodCPPModel model) { var pars = string.Join(", ", model.Parameters.Select(arg => { var pass = ""; switch (arg.Pass) { case ArgumentPassCPPModel.Ref: pass = "******"; break; case ArgumentPassCPPModel.Pointer: pass = "******"; break; case ArgumentPassCPPModel.Raw: pass = "******"; break; } return($"{TypeLookup.LookupCPPTypeName(arg.ParameterType)}{pass}{arg.Name}"); })); AppendLine($"{CPPModelTools.Modifiers(model.Modifiers)} {TypeLookup.LookupCPPTypeName(model.ReturnType)} {model.Name}({pars});"); }