Lines Matching defs:ctx

222             return new FieldCodec<string>((ref ParseContext ctx) => ctx.ReadString(), (ref WriteContext ctx, string value) => ctx.WriteString(value), CodedOutputStream.ComputeStringSize, tag, defaultValue);
233 return new FieldCodec<ByteString>((ref ParseContext ctx) => ctx.ReadBytes(), (ref WriteContext ctx, ByteString value) => ctx.WriteBytes(value), CodedOutputStream.ComputeBytesSize, tag, defaultValue);
244 return new FieldCodec<bool>((ref ParseContext ctx) => ctx.ReadBool(), (ref WriteContext ctx, bool value) => ctx.WriteBool(value), CodedOutputStream.BoolSize, tag, defaultValue);
255 return new FieldCodec<int>((ref ParseContext ctx) => ctx.ReadInt32(), (ref WriteContext output, int value) => output.WriteInt32(value), CodedOutputStream.ComputeInt32Size, tag, defaultValue);
266 return new FieldCodec<int>((ref ParseContext ctx) => ctx.ReadSInt32(), (ref WriteContext output, int value) => output.WriteSInt32(value), CodedOutputStream.ComputeSInt32Size, tag, defaultValue);
277 return new FieldCodec<uint>((ref ParseContext ctx) => ctx.ReadFixed32(), (ref WriteContext output, uint value) => output.WriteFixed32(value), 4, tag, defaultValue);
288 return new FieldCodec<int>((ref ParseContext ctx) => ctx.ReadSFixed32(), (ref WriteContext output, int value) => output.WriteSFixed32(value), 4, tag, defaultValue);
299 return new FieldCodec<uint>((ref ParseContext ctx) => ctx.ReadUInt32(), (ref WriteContext output, uint value) => output.WriteUInt32(value), CodedOutputStream.ComputeUInt32Size, tag, defaultValue);
310 return new FieldCodec<long>((ref ParseContext ctx) => ctx.ReadInt64(), (ref WriteContext output, long value) => output.WriteInt64(value), CodedOutputStream.ComputeInt64Size, tag, defaultValue);
321 return new FieldCodec<long>((ref ParseContext ctx) => ctx.ReadSInt64(), (ref WriteContext output, long value) => output.WriteSInt64(value), CodedOutputStream.ComputeSInt64Size, tag, defaultValue);
332 return new FieldCodec<ulong>((ref ParseContext ctx) => ctx.ReadFixed64(), (ref WriteContext output, ulong value) => output.WriteFixed64(value), 8, tag, defaultValue);
343 return new FieldCodec<long>((ref ParseContext ctx) => ctx.ReadSFixed64(), (ref WriteContext output, long value) => output.WriteSFixed64(value), 8, tag, defaultValue);
354 return new FieldCodec<ulong>((ref ParseContext ctx) => ctx.ReadUInt64(), (ref WriteContext output, ulong value) => output.WriteUInt64(value), CodedOutputStream.ComputeUInt64Size, tag, defaultValue);
365 return new FieldCodec<float>((ref ParseContext ctx) => ctx.ReadFloat(), (ref WriteContext output, float value) => output.WriteFloat(value), CodedOutputStream.FloatSize, tag, defaultValue);
376 return new FieldCodec<double>((ref ParseContext ctx) => ctx.ReadDouble(), (ref WriteContext output, double value) => output.WriteDouble(value), CodedOutputStream.DoubleSize, tag, defaultValue);
392 return new FieldCodec<T>((ref ParseContext ctx) => fromInt32(
393 ctx.ReadEnum()),
407 (ref ParseContext ctx) =>
410 ctx.ReadMessage(message);
414 (ref ParseContext ctx, ref T v) =>
421 ctx.ReadMessage(v);
452 (ref ParseContext ctx) =>
455 ctx.ReadGroup(message);
459 (ref ParseContext ctx, ref T v) =>
466 ctx.ReadGroup(v);
494 (ref ParseContext ctx) => WrapperCodecs.Read<T>(ref ctx, nestedCodec),
496 (ref ParseContext ctx, ref T v) => v = WrapperCodecs.Read<T>(ref ctx, nestedCodec),
513 (ref ParseContext ctx, ref T? v) => v = WrapperCodecs.Read<T>(ref ctx, nestedCodec),
587 return (ref ParseContext ctx) => Read<T>(ref ctx, nestedCoded);
594 internal static T Read<T>(ref ParseContext ctx, FieldCodec<T> codec)
596 int length = ctx.ReadLength();
597 int oldLimit = SegmentedBufferHelper.PushLimit(ref ctx.state, length);
601 while ((tag = ctx.ReadTag()) != 0)
605 value = codec.Read(ref ctx);
609 ParsingPrimitivesMessages.SkipLastField(ref ctx.buffer, ref ctx.state);
613 ParsingPrimitivesMessages.CheckReadEndOfStreamTag(ref ctx.state);
614 SegmentedBufferHelper.PopLimit(ref ctx.state, oldLimit);
619 internal static void Write<T>(ref WriteContext ctx, T value, FieldCodec<T> codec)
621 ctx.WriteLength(codec.CalculateSizeWithTag(value));
622 codec.WriteTagAndValue(ref ctx, value);
633 internal delegate TValue ValueReader<out TValue>(ref ParseContext ctx);
634 internal delegate void ValueWriter<T>(ref WriteContext ctx, T value);
661 internal delegate void InputMerger(ref ParseContext ctx, ref T value);
761 T defaultValue) : this(reader, writer, (ref ParseContext ctx, ref T v) => v = reader(ref ctx), (ref T v, T v2) => { v = v2; return true; }, sizeCalculator, tag, 0, defaultValue)
807 WriteContext.Initialize(output, out WriteContext ctx);
810 WriteTagAndValue(ref ctx, value);
814 ctx.CopyStateTo(output);
832 public void WriteTagAndValue(ref WriteContext ctx, T value)
836 ctx.WriteTag(Tag);
837 ValueWriter(ref ctx, value);
840 ctx.WriteTag(EndTag);
852 ParseContext.Initialize(input, out ParseContext ctx);
855 return ValueReader(ref ctx);
859 ctx.CopyStateTo(input);
866 /// <param name="ctx">The parse context to read from.</param>
868 public T Read(ref ParseContext ctx)
870 return ValueReader(ref ctx);