Commit 6b812f8a authored by csharptest's avatar csharptest

Working split for lite interfaces

parent a6722c34
......@@ -173,10 +173,6 @@ namespace Google.ProtocolBuffers {
}
public virtual TBuilder MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry) {
return MergeFrom(input, (ExtensionRegistryLite)extensionRegistry);
}
public virtual TBuilder MergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) {
UnknownFieldSet.Builder unknownFields = UnknownFieldSet.CreateBuilder(UnknownFields);
unknownFields.MergeFrom(input, extensionRegistry, this);
UnknownFields = unknownFields.Build();
......@@ -198,10 +194,6 @@ namespace Google.ProtocolBuffers {
}
public virtual TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry) {
return MergeFrom(data, (ExtensionRegistryLite)extensionRegistry);
}
public virtual TBuilder MergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry) {
CodedInputStream input = data.CreateCodedInput();
MergeFrom(input, extensionRegistry);
input.CheckLastTagWas(0);
......@@ -216,10 +208,6 @@ namespace Google.ProtocolBuffers {
}
public virtual TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry) {
return MergeFrom(data, (ExtensionRegistryLite)extensionRegistry);
}
public virtual TBuilder MergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry) {
CodedInputStream input = CodedInputStream.CreateInstance(data);
MergeFrom(input, extensionRegistry);
input.CheckLastTagWas(0);
......@@ -234,10 +222,6 @@ namespace Google.ProtocolBuffers {
}
public virtual TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry) {
return MergeFrom(input, (ExtensionRegistryLite)extensionRegistry);
}
public virtual TBuilder MergeFrom(Stream input, ExtensionRegistryLite extensionRegistry) {
CodedInputStream codedInput = CodedInputStream.CreateInstance(input);
MergeFrom(codedInput, extensionRegistry);
codedInput.CheckLastTagWas(0);
......@@ -245,7 +229,7 @@ namespace Google.ProtocolBuffers {
}
public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry) {
return MergeDelimitedFrom(input, (ExtensionRegistryLite)extensionRegistry);
return Lite.MergeDelimitedFrom(input, extensionRegistry);
}
public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistryLite extensionRegistry) {
......@@ -268,6 +252,78 @@ namespace Google.ProtocolBuffers {
return ThisBuilder;
}
/// <summary>
/// used internally to explicitly resolve lite edition methods
/// </summary>
protected IBuilderLite<TMessage, TBuilder> Lite { get { return this; } }
public virtual TBuilder MergeFrom(IMessageLite other) {
#warning Not implemented for Lite edition
return MergeFrom((IMessage)other);
}
public TBuilder MergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) {
#warning Not implemented for Lite edition
return MergeFrom(input, (ExtensionRegistry)extensionRegistry);
}
public virtual TBuilder MergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry) {
#warning Not implemented for Lite edition
return MergeFrom(data, (ExtensionRegistry)extensionRegistry);
}
public virtual TBuilder MergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry) {
#warning Not implemented for Lite edition
return MergeFrom(data, (ExtensionRegistry)extensionRegistry);
}
public virtual TBuilder MergeFrom(Stream input, ExtensionRegistryLite extensionRegistry) {
#warning Not implemented for Lite edition
return MergeFrom(input, (ExtensionRegistry)extensionRegistry);
}
IBuilderLite IBuilderLite.WeakClear() {
return WeakClear();
}
public IBuilderLite WeakMergeFrom(IMessageLite message) {
return MergeFrom(message);
}
IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data) {
return WeakMergeFrom(data);
}
IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data, ExtensionRegistryLite registry) {
return WeakMergeFrom(data, registry);
}
IBuilderLite IBuilderLite.WeakMergeFrom(CodedInputStream input) {
return WeakMergeFrom(input);
}
IBuilderLite IBuilderLite.WeakMergeFrom(CodedInputStream input, ExtensionRegistryLite registry) {
return WeakMergeFrom(input, registry);
}
IMessageLite IBuilderLite.WeakBuild() {
return WeakBuild();
}
IMessageLite IBuilderLite.WeakBuildPartial() {
return WeakBuildPartial();
}
IBuilderLite IBuilderLite.WeakClone() {
return WeakClone();
}
IMessageLite IBuilderLite.WeakDefaultInstanceForType {
get { return WeakDefaultInstanceForType; }
}
#region LimitedInputStream
/// <summary>
/// Stream implementation which proxies another stream, only allowing a certain amount
/// of data to be read. Note that this is only used to read delimited streams, so it
......@@ -332,49 +388,6 @@ namespace Google.ProtocolBuffers {
throw new NotSupportedException();
}
}
IBuilderLite IBuilderLite.WeakClear() {
return WeakClear();
}
public IBuilderLite WeakMergeFrom(IMessageLite message) {
return MergeFrom(message);
}
IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data) {
return WeakMergeFrom(data);
}
IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data, ExtensionRegistryLite registry) {
throw new NotImplementedException();
}
IBuilderLite IBuilderLite.WeakMergeFrom(CodedInputStream input) {
return WeakMergeFrom(input);
}
IBuilderLite IBuilderLite.WeakMergeFrom(CodedInputStream input, ExtensionRegistryLite registry) {
throw new NotImplementedException();
}
IMessageLite IBuilderLite.WeakBuild() {
return WeakBuild();
}
IMessageLite IBuilderLite.WeakBuildPartial() {
return WeakBuildPartial();
}
IBuilderLite IBuilderLite.WeakClone() {
return WeakClone();
}
IMessageLite IBuilderLite.WeakDefaultInstanceForType {
get { return WeakDefaultInstanceForType; }
}
public TBuilder MergeFrom(IMessageLite other) {
throw new NotImplementedException();
}
#endregion
}
}
......@@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers {
get { return fields.IsInitializedWithRespectTo(type); }
}
public override Builder MergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) {
public override Builder MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry) {
UnknownFieldSet.Builder unknownFieldsBuilder = UnknownFieldSet.CreateBuilder(unknownFields);
unknownFieldsBuilder.MergeFrom(input, extensionRegistry, this);
unknownFields = unknownFieldsBuilder.Build();
......
......@@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Construct a new, empty instance.
/// </summary>
public static new ExtensionRegistry CreateInstance() {
public static ExtensionRegistry CreateInstance() {
return new ExtensionRegistry(new Dictionary<string, ExtensionInfo>(),
new Dictionary<ExtensionIntPair, IGeneratedExtensionLite>(), false);
}
......@@ -115,7 +115,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Get the unmodifiable singleton empty instance.
/// </summary>
public new static ExtensionRegistry Empty {
public static ExtensionRegistry Empty {
get { return empty; }
}
......
......@@ -103,7 +103,7 @@ namespace Google.ProtocolBuffers {
this.extensionsByNumber = extensionsByNumber;
this.readOnly = readOnly;
}
#if LITE
/// <summary>
/// Construct a new, empty instance.
/// </summary>
......@@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers {
public static ExtensionRegistryLite Empty {
get { return empty; }
}
#endif
public ExtensionRegistryLite AsReadOnly() {
return MakeReadOnly();
}
......
......@@ -7,18 +7,4 @@ namespace Google.ProtocolBuffers {
object ContainingType { get; }
IMessageLite MessageDefaultInstance { get; }
}
public class GeneratedExtensionLite : IGeneratedExtensionLite {
public int Number {
get { throw new NotImplementedException(); }
}
public object ContainingType {
get { throw new NotImplementedException(); }
}
public IMessageLite MessageDefaultInstance {
get { throw new NotImplementedException(); }
}
}
}
\ No newline at end of file
......@@ -504,7 +504,7 @@ namespace Google.ProtocolBuffers {
break;
}
ExtensionRegistry extensionRegistry = (extensionRegistryLite as ExtensionRegistry) ?? ExtensionRegistry.CreateInstance();
ExtensionRegistry extensionRegistry = (ExtensionRegistry)extensionRegistryLite;
if (!MergeFieldFrom(input, extensionRegistry, builder, tag)) {
// end group tag
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment