Commit 6b812f8a authored by csharptest's avatar csharptest

Working split for lite interfaces

parent a6722c34
...@@ -173,10 +173,6 @@ namespace Google.ProtocolBuffers { ...@@ -173,10 +173,6 @@ namespace Google.ProtocolBuffers {
} }
public virtual TBuilder MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry) { 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); UnknownFieldSet.Builder unknownFields = UnknownFieldSet.CreateBuilder(UnknownFields);
unknownFields.MergeFrom(input, extensionRegistry, this); unknownFields.MergeFrom(input, extensionRegistry, this);
UnknownFields = unknownFields.Build(); UnknownFields = unknownFields.Build();
...@@ -198,10 +194,6 @@ namespace Google.ProtocolBuffers { ...@@ -198,10 +194,6 @@ namespace Google.ProtocolBuffers {
} }
public virtual TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry) { 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(); CodedInputStream input = data.CreateCodedInput();
MergeFrom(input, extensionRegistry); MergeFrom(input, extensionRegistry);
input.CheckLastTagWas(0); input.CheckLastTagWas(0);
...@@ -216,10 +208,6 @@ namespace Google.ProtocolBuffers { ...@@ -216,10 +208,6 @@ namespace Google.ProtocolBuffers {
} }
public virtual TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry) { 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); CodedInputStream input = CodedInputStream.CreateInstance(data);
MergeFrom(input, extensionRegistry); MergeFrom(input, extensionRegistry);
input.CheckLastTagWas(0); input.CheckLastTagWas(0);
...@@ -234,10 +222,6 @@ namespace Google.ProtocolBuffers { ...@@ -234,10 +222,6 @@ namespace Google.ProtocolBuffers {
} }
public virtual TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry) { 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); CodedInputStream codedInput = CodedInputStream.CreateInstance(input);
MergeFrom(codedInput, extensionRegistry); MergeFrom(codedInput, extensionRegistry);
codedInput.CheckLastTagWas(0); codedInput.CheckLastTagWas(0);
...@@ -245,7 +229,7 @@ namespace Google.ProtocolBuffers { ...@@ -245,7 +229,7 @@ namespace Google.ProtocolBuffers {
} }
public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry) { public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry) {
return MergeDelimitedFrom(input, (ExtensionRegistryLite)extensionRegistry); return Lite.MergeDelimitedFrom(input, extensionRegistry);
} }
public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistryLite extensionRegistry) { public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistryLite extensionRegistry) {
...@@ -266,9 +250,81 @@ namespace Google.ProtocolBuffers { ...@@ -266,9 +250,81 @@ namespace Google.ProtocolBuffers {
public virtual IBuilder SetRepeatedField(FieldDescriptor field, int index, object value) { public virtual IBuilder SetRepeatedField(FieldDescriptor field, int index, object value) {
this[field, index] = value; this[field, index] = value;
return ThisBuilder; return ThisBuilder;
} }
/// <summary> /// <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 /// 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 /// of data to be read. Note that this is only used to read delimited streams, so it
/// doesn't attempt to implement everything. /// doesn't attempt to implement everything.
...@@ -331,50 +387,7 @@ namespace Google.ProtocolBuffers { ...@@ -331,50 +387,7 @@ namespace Google.ProtocolBuffers {
public override void Write(byte[] buffer, int offset, int count) { public override void Write(byte[] buffer, int offset, int count) {
throw new NotSupportedException(); throw new NotSupportedException();
} }
} }
#endregion
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();
}
} }
} }
...@@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers { ...@@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers {
get { return fields.IsInitializedWithRespectTo(type); } 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); UnknownFieldSet.Builder unknownFieldsBuilder = UnknownFieldSet.CreateBuilder(unknownFields);
unknownFieldsBuilder.MergeFrom(input, extensionRegistry, this); unknownFieldsBuilder.MergeFrom(input, extensionRegistry, this);
unknownFields = unknownFieldsBuilder.Build(); unknownFields = unknownFieldsBuilder.Build();
......
...@@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers { ...@@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers {
/// <summary> /// <summary>
/// Construct a new, empty instance. /// Construct a new, empty instance.
/// </summary> /// </summary>
public static new ExtensionRegistry CreateInstance() { public static ExtensionRegistry CreateInstance() {
return new ExtensionRegistry(new Dictionary<string, ExtensionInfo>(), return new ExtensionRegistry(new Dictionary<string, ExtensionInfo>(),
new Dictionary<ExtensionIntPair, IGeneratedExtensionLite>(), false); new Dictionary<ExtensionIntPair, IGeneratedExtensionLite>(), false);
} }
...@@ -115,7 +115,7 @@ namespace Google.ProtocolBuffers { ...@@ -115,7 +115,7 @@ namespace Google.ProtocolBuffers {
/// <summary> /// <summary>
/// Get the unmodifiable singleton empty instance. /// Get the unmodifiable singleton empty instance.
/// </summary> /// </summary>
public new static ExtensionRegistry Empty { public static ExtensionRegistry Empty {
get { return empty; } get { return empty; }
} }
......
...@@ -103,7 +103,7 @@ namespace Google.ProtocolBuffers { ...@@ -103,7 +103,7 @@ namespace Google.ProtocolBuffers {
this.extensionsByNumber = extensionsByNumber; this.extensionsByNumber = extensionsByNumber;
this.readOnly = readOnly; this.readOnly = readOnly;
} }
#if LITE
/// <summary> /// <summary>
/// Construct a new, empty instance. /// Construct a new, empty instance.
/// </summary> /// </summary>
...@@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers { ...@@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers {
public static ExtensionRegistryLite Empty { public static ExtensionRegistryLite Empty {
get { return empty; } get { return empty; }
} }
#endif
public ExtensionRegistryLite AsReadOnly() { public ExtensionRegistryLite AsReadOnly() {
return MakeReadOnly(); return MakeReadOnly();
} }
......
...@@ -7,18 +7,4 @@ namespace Google.ProtocolBuffers { ...@@ -7,18 +7,4 @@ namespace Google.ProtocolBuffers {
object ContainingType { get; } object ContainingType { get; }
IMessageLite MessageDefaultInstance { 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 { ...@@ -504,7 +504,7 @@ namespace Google.ProtocolBuffers {
break; break;
} }
ExtensionRegistry extensionRegistry = (extensionRegistryLite as ExtensionRegistry) ?? ExtensionRegistry.CreateInstance(); ExtensionRegistry extensionRegistry = (ExtensionRegistry)extensionRegistryLite;
if (!MergeFieldFrom(input, extensionRegistry, builder, tag)) { if (!MergeFieldFrom(input, extensionRegistry, builder, tag)) {
// end group tag // end group tag
break; 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