ProtoDecoratorBase.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #if !NO_RUNTIME
  2. using System;
  3. using ProtoBuf.Meta;
  4. #if FEAT_IKVM
  5. using Type = IKVM.Reflection.Type;
  6. using IKVM.Reflection;
  7. #else
  8. using System.Reflection;
  9. #endif
  10. namespace ProtoBuf.Serializers
  11. {
  12. abstract class ProtoDecoratorBase : IProtoSerializer
  13. {
  14. public abstract Type ExpectedType { get; }
  15. protected readonly IProtoSerializer Tail;
  16. protected ProtoDecoratorBase(IProtoSerializer tail) { this.Tail = tail; }
  17. public abstract bool ReturnsValue { get; }
  18. public abstract bool RequiresOldValue { get; }
  19. #if !FEAT_IKVM
  20. public abstract void Write(object value, ProtoWriter dest);
  21. public abstract object Read(object value, ProtoReader source);
  22. #endif
  23. #if FEAT_COMPILER
  24. void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom) { EmitWrite(ctx, valueFrom); }
  25. protected abstract void EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom);
  26. void IProtoSerializer.EmitRead(Compiler.CompilerContext ctx, Compiler.Local valueFrom) { EmitRead(ctx, valueFrom); }
  27. protected abstract void EmitRead(Compiler.CompilerContext ctx, Compiler.Local valueFrom);
  28. #endif
  29. }
  30. }
  31. #endif