public override SourceCode GenerateHandler(CodeContext context) { var code = new SourceCode(); var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append(CodeUtil.ForEachCode(TypeName, listAccessor, iteratorName, true)); code.IndentRight(); code.Append("{0}::handle(session, *{1});", CanonicalTarget, iteratorName); code.BracketEnd(); context.EndIterator(); return code; }
public override SourceCode GenerateWriter(CodeContext context) { var code = new SourceCode(); var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append("(*this) << static_cast<uint32_t>({0}size());", listAccessor); code.Append(CodeUtil.ForEachCode(CanonicalType, listAccessor, iteratorName, true)); code.IndentRight(); code.Append("(*this) << (*{0});", iteratorName); code.BracketEnd(); context.EndIterator(); return code; }
public override SourceCode GenerateHandler(CodeContext context) { var code = new SourceCode(); var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append(CodeUtil.ForEachCode(TypeName, listAccessor, iteratorName, true)); code.IndentRight(); code.Append("{0}::handle(session, *{1});", CanonicalTarget, iteratorName); code.BracketEnd(); context.EndIterator(); return(code); }
public override SourceCode GenerateWriter(CodeContext context) { var code = new SourceCode(); var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append("(*this) << static_cast<uint32_t>({0}size());", listAccessor); code.Append(CodeUtil.ForEachCode(CanonicalType, listAccessor, iteratorName, true)); code.IndentRight(); code.Append("(*this) << (*{0});", iteratorName); code.BracketEnd(); context.EndIterator(); return(code); }
public override SourceCode GenerateHandler(CodeContext context) { var code = new SourceCode(); if (Fields.Count(field => field is RefField) == 0) return code; var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append(CodeUtil.ForEachCode(TypeName, listAccessor, iteratorName, true)); code.IndentRight(); Fields.ForEach(field => code.Append(field.GenerateHandler(context))); code.BracketEnd(); context.EndIterator(); return code; }
public override SourceCode GenerateHandler(CodeContext context) { var code = new SourceCode(); if (Fields.Count(field => field is RefField) == 0) { return(code); } var listAccessor = GetVarAccessor(context); var iteratorName = context.StartIterator(); code.Append(CodeUtil.ForEachCode(TypeName, listAccessor, iteratorName, true)); code.IndentRight(); Fields.ForEach(field => code.Append(field.GenerateHandler(context))); code.BracketEnd(); context.EndIterator(); return(code); }