Lines Matching refs:codec
419 /// It is assumed that the stream is initially positioned after the tag specified by the codec.
424 /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
425 public void AddEntriesFrom(CodedInputStream input, Codec codec)
430 AddEntriesFrom(ref ctx, codec);
442 /// It is assumed that the input is initially positioned after the tag specified by the codec.
447 /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
449 public void AddEntriesFrom(ref ParseContext ctx, Codec codec)
451 var adapter = new Codec.MessageAdapter(codec);
457 } while (ParsingPrimitives.MaybeConsumeTag(ref ctx.buffer, ref ctx.state, codec.MapTag));
461 /// Writes the contents of this map to the given coded output stream, using the specified codec
465 /// <param name="codec">The codec to use for each entry.</param>
466 public void WriteTo(CodedOutputStream output, Codec codec)
471 WriteTo(ref ctx, codec);
480 /// Writes the contents of this map to the given write context, using the specified codec
484 /// <param name="codec">The codec to use for each entry.</param>
486 public void WriteTo(ref WriteContext ctx, Codec codec)
488 var message = new Codec.MessageAdapter(codec);
493 ctx.WriteTag(codec.MapTag);
499 /// Calculates the size of this map based on the given entry codec.
501 /// <param name="codec">The codec to use to encode each entry.</param>
503 public int CalculateSize(Codec codec)
509 var message = new Codec.MessageAdapter(codec);
515 size += CodedOutputStream.ComputeRawVarint32Size(codec.MapTag);
634 /// A codec for a specific map field. This contains all the information required to encode and
644 /// Creates a new entry codec based on a separate key codec and value codec,
647 /// <param name="keyCodec">The key codec.</param>
648 /// <param name="valueCodec">The value codec.</param>
664 /// delegates the work to a codec, but implements the <see cref="IMessage"/> interface
666 /// This is nested inside Codec as it's tightly coupled to the associated codec,
673 private readonly Codec codec;
677 internal MessageAdapter(Codec codec)
679 this.codec = codec;
684 Key = codec.keyCodec.DefaultValue;
685 Value = codec.valueCodec.DefaultValue;
700 if (tag == codec.keyCodec.Tag)
702 Key = codec.keyCodec.Read(ref ctx);
704 else if (tag == codec.valueCodec.Tag)
706 Value = codec.valueCodec.Read(ref ctx);
722 Value = codec.valueCodec.Read(new CodedInputStream(ZeroLengthMessageStreamData));
727 Value = codec.valueCodec.Read(ref zeroLengthCtx);
741 codec.keyCodec.WriteTagAndValue(ref ctx, Key);
742 codec.valueCodec.WriteTagAndValue(ref ctx, Value);
747 return codec.keyCodec.CalculateSizeWithTag(Key) + codec.valueCodec.CalculateSizeWithTag(Value);