Merge pull request #654 from jtattermusch/csharp_hide_freeze
Remove the C# Freeze API
This commit is contained in:
commit
7a0effb9e9
35 changed files with 8 additions and 1498 deletions
|
@ -99,7 +99,6 @@ csharp_EXTRA_DIST= \
|
|||
csharp/src/Google.Protobuf/Collections/RepeatedField.cs \
|
||||
csharp/src/Google.Protobuf/FieldCodec.cs \
|
||||
csharp/src/Google.Protobuf/FrameworkPortability.cs \
|
||||
csharp/src/Google.Protobuf/Freezable.cs \
|
||||
csharp/src/Google.Protobuf/Google.Protobuf.csproj \
|
||||
csharp/src/Google.Protobuf/Google.Protobuf.nuspec \
|
||||
csharp/src/Google.Protobuf/IMessage.cs \
|
||||
|
|
|
@ -74,20 +74,11 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
return new Person(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
phones_.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +88,6 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
public int Id {
|
||||
get { return id_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
id_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +97,6 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
public string Email {
|
||||
get { return email_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
email_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -269,19 +258,11 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
return new PhoneNumber(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int NumberFieldNumber = 1;
|
||||
private string number_ = "";
|
||||
public string Number {
|
||||
get { return number_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
number_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +272,6 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type {
|
||||
get { return type_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
type_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -417,14 +397,6 @@ namespace Google.Protobuf.Examples.AddressBook {
|
|||
return new AddressBook(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
people_.Freeze();
|
||||
}
|
||||
|
||||
public const int PeopleFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person> _repeated_people_codec
|
||||
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser);
|
||||
|
|
|
@ -45,53 +45,6 @@ namespace Google.Protobuf.Collections
|
|||
/// </summary>
|
||||
public class MapFieldTest
|
||||
{
|
||||
// Protobuf-specific tests
|
||||
[Test]
|
||||
public void Freeze_FreezesMessages()
|
||||
{
|
||||
var message = new ForeignMessage { C = 20 };
|
||||
var map = new MapField<string, ForeignMessage> { { "x", message } };
|
||||
map.Freeze();
|
||||
Assert.IsTrue(message.IsFrozen);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze_Idempotent()
|
||||
{
|
||||
var message = new ForeignMessage { C = 20 };
|
||||
var map = new MapField<string, ForeignMessage> { { "x", message } };
|
||||
Assert.IsFalse(map.IsFrozen);
|
||||
map.Freeze();
|
||||
Assert.IsTrue(message.IsFrozen);
|
||||
map.Freeze();
|
||||
Assert.IsTrue(message.IsFrozen);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze_PreventsMutation()
|
||||
{
|
||||
var map = new MapField<string, string>();
|
||||
map.Freeze();
|
||||
Assert.IsTrue(map.IsFrozen);
|
||||
Assert.IsTrue(map.IsReadOnly);
|
||||
ICollection<KeyValuePair<string, string>> collection = map;
|
||||
Assert.Throws<InvalidOperationException>(() => map["x"] = "y");
|
||||
Assert.Throws<InvalidOperationException>(() => map.Add("x", "y"));
|
||||
Assert.Throws<InvalidOperationException>(() => map.Remove("x"));
|
||||
Assert.Throws<InvalidOperationException>(() => map.Clear());
|
||||
Assert.Throws<InvalidOperationException>(() => collection.Add(NewKeyValuePair("x", "y")));
|
||||
Assert.Throws<InvalidOperationException>(() => collection.Remove(NewKeyValuePair("x", "y")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Clone_ReturnsNonFrozen()
|
||||
{
|
||||
var map = new MapField<string, string>();
|
||||
map.Freeze();
|
||||
var clone = map.Clone();
|
||||
clone.Add("x", "y");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Clone_ClonesMessages()
|
||||
{
|
||||
|
@ -422,10 +375,6 @@ namespace Google.Protobuf.Collections
|
|||
dictionary.Remove("x");
|
||||
Assert.AreEqual(0, dictionary.Count);
|
||||
Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null));
|
||||
|
||||
map.Freeze();
|
||||
// Call should fail even though it clearly doesn't contain 5 as a key.
|
||||
Assert.Throws<InvalidOperationException>(() => dictionary.Remove(5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -449,8 +398,6 @@ namespace Google.Protobuf.Collections
|
|||
var map = new MapField<string, string> { { "x", "y" } };
|
||||
IDictionary dictionary = map;
|
||||
Assert.IsFalse(dictionary.IsFixedSize);
|
||||
map.Freeze();
|
||||
Assert.IsTrue(dictionary.IsFixedSize);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -504,9 +451,6 @@ namespace Google.Protobuf.Collections
|
|||
Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5);
|
||||
Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z");
|
||||
Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null);
|
||||
map.Freeze();
|
||||
// Note: Not InvalidOperationException.
|
||||
Assert.Throws<NotSupportedException>(() => dictionary["a"] = "c");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -193,44 +193,10 @@ namespace Google.Protobuf.Collections
|
|||
Assert.Throws<ArgumentOutOfRangeException>(() => list[2] = "bad");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze_FreezesElements()
|
||||
{
|
||||
var list = new RepeatedField<TestAllTypes> { new TestAllTypes() };
|
||||
Assert.IsFalse(list[0].IsFrozen);
|
||||
list.Freeze();
|
||||
Assert.IsTrue(list[0].IsFrozen);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze_PreventsMutations()
|
||||
{
|
||||
var list = new RepeatedField<int> { 0 };
|
||||
list.Freeze();
|
||||
Assert.Throws<InvalidOperationException>(() => list.Add(1));
|
||||
Assert.Throws<InvalidOperationException>(() => list[0] = 1);
|
||||
Assert.Throws<InvalidOperationException>(() => list.Clear());
|
||||
Assert.Throws<InvalidOperationException>(() => list.RemoveAt(0));
|
||||
Assert.Throws<InvalidOperationException>(() => list.Remove(0));
|
||||
Assert.Throws<InvalidOperationException>(() => list.Insert(0, 0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze_ReportsFrozen()
|
||||
{
|
||||
var list = new RepeatedField<int> { 0 };
|
||||
Assert.IsFalse(list.IsFrozen);
|
||||
Assert.IsFalse(list.IsReadOnly);
|
||||
list.Freeze();
|
||||
Assert.IsTrue(list.IsFrozen);
|
||||
Assert.IsTrue(list.IsReadOnly);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Clone_ReturnsMutable()
|
||||
{
|
||||
var list = new RepeatedField<int> { 0 };
|
||||
list.Freeze();
|
||||
var clone = list.Clone();
|
||||
clone[0] = 1;
|
||||
}
|
||||
|
@ -585,8 +551,6 @@ namespace Google.Protobuf.Collections
|
|||
var field = new RepeatedField<string> { "first", "second" };
|
||||
IList list = field;
|
||||
Assert.IsFalse(list.IsFixedSize);
|
||||
field.Freeze();
|
||||
Assert.IsTrue(list.IsFixedSize);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -503,23 +503,6 @@ namespace Google.Protobuf
|
|||
Assert.AreNotEqual(original, clone);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Freeze()
|
||||
{
|
||||
var frozen = new TestAllTypes();
|
||||
frozen.Freeze();
|
||||
Assert.IsTrue(frozen.IsFrozen);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.ClearOneofField());
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.SingleInt32 = 0);
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.SingleNestedMessage = null);
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.SingleNestedEnum = 0);
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.OneofString = null);
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.OneofUint32 = 0U);
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.RepeatedDouble.Add(0.0));
|
||||
Assert.Throws<InvalidOperationException>(() => frozen.RepeatedNestedMessage.Add(new TestAllTypes.Types.NestedMessage()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OneofProperties()
|
||||
{
|
||||
|
|
|
@ -216,30 +216,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestMap(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
mapInt32Int32_.Freeze();
|
||||
mapInt64Int64_.Freeze();
|
||||
mapUint32Uint32_.Freeze();
|
||||
mapUint64Uint64_.Freeze();
|
||||
mapSint32Sint32_.Freeze();
|
||||
mapSint64Sint64_.Freeze();
|
||||
mapFixed32Fixed32_.Freeze();
|
||||
mapFixed64Fixed64_.Freeze();
|
||||
mapSfixed32Sfixed32_.Freeze();
|
||||
mapSfixed64Sfixed64_.Freeze();
|
||||
mapInt32Float_.Freeze();
|
||||
mapInt32Double_.Freeze();
|
||||
mapBoolBool_.Freeze();
|
||||
mapStringString_.Freeze();
|
||||
mapInt32Bytes_.Freeze();
|
||||
mapInt32Enum_.Freeze();
|
||||
mapInt32ForeignMessage_.Freeze();
|
||||
}
|
||||
|
||||
public const int MapInt32Int32FieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
|
||||
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
|
||||
|
@ -613,20 +589,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestMapSubmessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (testMap_ != null) TestMap.Freeze();
|
||||
}
|
||||
|
||||
public const int TestMapFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestMap testMap_;
|
||||
public global::Google.Protobuf.TestProtos.TestMap TestMap {
|
||||
get { return testMap_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
testMap_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -737,14 +704,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestMessageMap(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
mapInt32Message_.Freeze();
|
||||
}
|
||||
|
||||
public const int MapInt32MessageFieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec _map_mapInt32Message_codec
|
||||
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10);
|
||||
|
@ -847,15 +806,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestSameTypeMap(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
map1_.Freeze();
|
||||
map2_.Freeze();
|
||||
}
|
||||
|
||||
public const int Map1FieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, int>.Codec _map_map1_codec
|
||||
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
|
||||
|
@ -988,28 +938,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestArenaMap(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
mapInt32Int32_.Freeze();
|
||||
mapInt64Int64_.Freeze();
|
||||
mapUint32Uint32_.Freeze();
|
||||
mapUint64Uint64_.Freeze();
|
||||
mapSint32Sint32_.Freeze();
|
||||
mapSint64Sint64_.Freeze();
|
||||
mapFixed32Fixed32_.Freeze();
|
||||
mapFixed64Fixed64_.Freeze();
|
||||
mapSfixed32Sfixed32_.Freeze();
|
||||
mapSfixed64Sfixed64_.Freeze();
|
||||
mapInt32Float_.Freeze();
|
||||
mapInt32Double_.Freeze();
|
||||
mapBoolBool_.Freeze();
|
||||
mapInt32Enum_.Freeze();
|
||||
mapInt32ForeignMessage_.Freeze();
|
||||
}
|
||||
|
||||
public const int MapInt32Int32FieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
|
||||
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
|
||||
|
@ -1349,14 +1277,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new MessageContainingEnumCalledType(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
type_.Freeze();
|
||||
}
|
||||
|
||||
public const int TypeFieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec _map_type_codec
|
||||
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10);
|
||||
|
@ -1468,14 +1388,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new MessageContainingMapCalledEntry(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
entry_.Freeze();
|
||||
}
|
||||
|
||||
public const int EntryFieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, int>.Codec _map_entry_codec
|
||||
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
|
||||
|
|
|
@ -79,19 +79,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new ImportMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DFieldNumber = 1;
|
||||
private int d_;
|
||||
public int D {
|
||||
get { return d_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
d_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,19 +65,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new PublicImportMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int EFieldNumber = 1;
|
||||
private int e_;
|
||||
public int E {
|
||||
get { return e_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
e_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,13 +96,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new Issue307(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Issue307);
|
||||
}
|
||||
|
@ -187,13 +180,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new NestedOnce(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as NestedOnce);
|
||||
}
|
||||
|
@ -278,13 +264,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new NestedTwice(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as NestedTwice);
|
||||
}
|
||||
|
@ -381,21 +360,11 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new NegativeEnumMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
values_.Freeze();
|
||||
packedValues_.Freeze();
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO;
|
||||
public global::UnitTest.Issues.TestProtos.NegativeEnum Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -535,13 +504,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new DeprecatedChild(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as DeprecatedChild);
|
||||
}
|
||||
|
@ -631,24 +593,12 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new DeprecatedFieldsMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
primitiveArray_.Freeze();
|
||||
if (messageValue_ != null) MessageValue.Freeze();
|
||||
messageArray_.Freeze();
|
||||
enumArray_.Freeze();
|
||||
}
|
||||
|
||||
public const int PrimitiveValueFieldNumber = 1;
|
||||
private int primitiveValue_;
|
||||
[global::System.ObsoleteAttribute()]
|
||||
public int PrimitiveValue {
|
||||
get { return primitiveValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
primitiveValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +618,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue {
|
||||
get { return messageValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
messageValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +637,6 @@ namespace UnitTest.Issues.TestProtos {
|
|||
public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue {
|
||||
get { return enumValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
enumValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -869,19 +817,11 @@ namespace UnitTest.Issues.TestProtos {
|
|||
return new ItemField(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ItemFieldNumber = 1;
|
||||
private int item_;
|
||||
public int Item {
|
||||
get { return item_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
item_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,46 +307,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestAllTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (singleNestedMessage_ != null) SingleNestedMessage.Freeze();
|
||||
if (singleForeignMessage_ != null) SingleForeignMessage.Freeze();
|
||||
if (singleImportMessage_ != null) SingleImportMessage.Freeze();
|
||||
if (singlePublicImportMessage_ != null) SinglePublicImportMessage.Freeze();
|
||||
repeatedInt32_.Freeze();
|
||||
repeatedInt64_.Freeze();
|
||||
repeatedUint32_.Freeze();
|
||||
repeatedUint64_.Freeze();
|
||||
repeatedSint32_.Freeze();
|
||||
repeatedSint64_.Freeze();
|
||||
repeatedFixed32_.Freeze();
|
||||
repeatedFixed64_.Freeze();
|
||||
repeatedSfixed32_.Freeze();
|
||||
repeatedSfixed64_.Freeze();
|
||||
repeatedFloat_.Freeze();
|
||||
repeatedDouble_.Freeze();
|
||||
repeatedBool_.Freeze();
|
||||
repeatedString_.Freeze();
|
||||
repeatedBytes_.Freeze();
|
||||
repeatedNestedMessage_.Freeze();
|
||||
repeatedForeignMessage_.Freeze();
|
||||
repeatedImportMessage_.Freeze();
|
||||
repeatedNestedEnum_.Freeze();
|
||||
repeatedForeignEnum_.Freeze();
|
||||
repeatedImportEnum_.Freeze();
|
||||
repeatedPublicImportMessage_.Freeze();
|
||||
if (oneofField_ is IFreezable) ((IFreezable) oneofField_).Freeze();
|
||||
}
|
||||
|
||||
public const int SingleInt32FieldNumber = 1;
|
||||
private int singleInt32_;
|
||||
public int SingleInt32 {
|
||||
get { return singleInt32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleInt32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +321,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long SingleInt64 {
|
||||
get { return singleInt64_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleInt64_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +330,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public uint SingleUint32 {
|
||||
get { return singleUint32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleUint32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +339,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public ulong SingleUint64 {
|
||||
get { return singleUint64_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleUint64_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +348,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int SingleSint32 {
|
||||
get { return singleSint32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleSint32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +357,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long SingleSint64 {
|
||||
get { return singleSint64_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleSint64_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +366,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public uint SingleFixed32 {
|
||||
get { return singleFixed32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleFixed32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +375,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public ulong SingleFixed64 {
|
||||
get { return singleFixed64_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleFixed64_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +384,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int SingleSfixed32 {
|
||||
get { return singleSfixed32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleSfixed32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +393,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long SingleSfixed64 {
|
||||
get { return singleSfixed64_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleSfixed64_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +402,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public float SingleFloat {
|
||||
get { return singleFloat_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleFloat_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +411,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public double SingleDouble {
|
||||
get { return singleDouble_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleDouble_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +420,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public bool SingleBool {
|
||||
get { return singleBool_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleBool_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +429,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string SingleString {
|
||||
get { return singleString_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleString_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +438,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public pb::ByteString SingleBytes {
|
||||
get { return singleBytes_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleBytes_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -496,7 +447,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage SingleNestedMessage {
|
||||
get { return singleNestedMessage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleNestedMessage_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +456,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ForeignMessage SingleForeignMessage {
|
||||
get { return singleForeignMessage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleForeignMessage_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +465,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ImportMessage SingleImportMessage {
|
||||
get { return singleImportMessage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleImportMessage_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +474,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum {
|
||||
get { return singleNestedEnum_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleNestedEnum_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +483,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum {
|
||||
get { return singleForeignEnum_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleForeignEnum_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +492,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum {
|
||||
get { return singleImportEnum_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleImportEnum_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -556,7 +501,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.PublicImportMessage SinglePublicImportMessage {
|
||||
get { return singlePublicImportMessage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singlePublicImportMessage_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -741,7 +685,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public uint OneofUint32 {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = OneofFieldOneofCase.OneofUint32;
|
||||
}
|
||||
|
@ -751,7 +694,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage OneofNestedMessage {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage;
|
||||
}
|
||||
|
@ -761,7 +703,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string OneofString {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value ?? "";
|
||||
oneofFieldCase_ = OneofFieldOneofCase.OneofString;
|
||||
}
|
||||
|
@ -771,7 +712,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public pb::ByteString OneofBytes {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value ?? pb::ByteString.Empty;
|
||||
oneofFieldCase_ = OneofFieldOneofCase.OneofBytes;
|
||||
}
|
||||
|
@ -791,7 +731,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
}
|
||||
|
||||
public void ClearOneofField() {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofFieldCase_ = OneofFieldOneofCase.None;
|
||||
oneofField_ = null;
|
||||
}
|
||||
|
@ -1551,19 +1490,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new NestedMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int BbFieldNumber = 1;
|
||||
private int bb_;
|
||||
public int Bb {
|
||||
get { return bb_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
bb_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1675,22 +1606,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new NestedTestAllTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (child_ != null) Child.Freeze();
|
||||
if (payload_ != null) Payload.Freeze();
|
||||
repeatedChild_.Freeze();
|
||||
}
|
||||
|
||||
public const int ChildFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_;
|
||||
public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child {
|
||||
get { return child_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
child_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1700,7 +1620,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestAllTypes Payload {
|
||||
get { return payload_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
payload_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1850,20 +1769,12 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestDeprecatedFields(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DeprecatedInt32FieldNumber = 1;
|
||||
private int deprecatedInt32_;
|
||||
[global::System.ObsoleteAttribute()]
|
||||
public int DeprecatedInt32 {
|
||||
get { return deprecatedInt32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecatedInt32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1968,19 +1879,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new ForeignMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int CFieldNumber = 1;
|
||||
private int c_;
|
||||
public int C {
|
||||
get { return c_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
c_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2084,13 +1987,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestReservedFields(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as TestReservedFields);
|
||||
}
|
||||
|
@ -2175,20 +2071,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestForeignNested(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (foreignNested_ != null) ForeignNested.Freeze();
|
||||
}
|
||||
|
||||
public const int ForeignNestedFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_;
|
||||
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested {
|
||||
get { return foreignNested_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
foreignNested_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2300,19 +2187,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestReallyLargeTagNumber(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int AFieldNumber = 1;
|
||||
private int a_;
|
||||
public int A {
|
||||
get { return a_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
a_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2322,7 +2201,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int Bb {
|
||||
get { return bb_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
bb_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2444,20 +2322,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestRecursiveMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (a_ != null) A.Freeze();
|
||||
}
|
||||
|
||||
public const int AFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_;
|
||||
public global::Google.Protobuf.TestProtos.TestRecursiveMessage A {
|
||||
get { return a_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
a_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2467,7 +2336,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int I {
|
||||
get { return i_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
i_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2594,20 +2462,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestMutualRecursionA(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (bb_ != null) Bb.Freeze();
|
||||
}
|
||||
|
||||
public const int BbFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_;
|
||||
public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb {
|
||||
get { return bb_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
bb_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2719,20 +2578,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestMutualRecursionB(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (a_ != null) A.Freeze();
|
||||
}
|
||||
|
||||
public const int AFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_;
|
||||
public global::Google.Protobuf.TestProtos.TestMutualRecursionA A {
|
||||
get { return a_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
a_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2742,7 +2592,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int OptionalInt32 {
|
||||
get { return optionalInt32_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
optionalInt32_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2876,24 +2725,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestCamelCaseFieldNames(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (messageField_ != null) MessageField.Freeze();
|
||||
repeatedPrimitiveField_.Freeze();
|
||||
repeatedStringField_.Freeze();
|
||||
repeatedEnumField_.Freeze();
|
||||
repeatedMessageField_.Freeze();
|
||||
}
|
||||
|
||||
public const int PrimitiveFieldFieldNumber = 1;
|
||||
private int primitiveField_;
|
||||
public int PrimitiveField {
|
||||
get { return primitiveField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
primitiveField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2903,7 +2739,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string StringField {
|
||||
get { return stringField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
stringField_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2913,7 +2748,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ForeignEnum EnumField {
|
||||
get { return enumField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
enumField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2923,7 +2757,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.ForeignMessage MessageField {
|
||||
get { return messageField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
messageField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3155,20 +2988,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestFieldOrderings(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (singleNestedMessage_ != null) SingleNestedMessage.Freeze();
|
||||
}
|
||||
|
||||
public const int MyStringFieldNumber = 11;
|
||||
private string myString_ = "";
|
||||
public string MyString {
|
||||
get { return myString_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
myString_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -3178,7 +3002,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long MyInt {
|
||||
get { return myInt_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
myInt_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3188,7 +3011,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public float MyFloat {
|
||||
get { return myFloat_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
myFloat_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3198,7 +3020,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage SingleNestedMessage {
|
||||
get { return singleNestedMessage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
singleNestedMessage_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3359,19 +3180,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new NestedMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int OoFieldNumber = 2;
|
||||
private long oo_;
|
||||
public long Oo {
|
||||
get { return oo_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oo_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3381,7 +3194,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int Bb {
|
||||
get { return bb_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
bb_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3507,19 +3319,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new SparseEnumMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int SparseEnumFieldNumber = 1;
|
||||
private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED;
|
||||
public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum {
|
||||
get { return sparseEnum_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sparseEnum_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3624,19 +3428,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new OneString(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private string data_ = "";
|
||||
public string Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -3741,14 +3537,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new MoreString(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
data_.Freeze();
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<string> _repeated_data_codec
|
||||
= pb::FieldCodec.ForString(10);
|
||||
|
@ -3850,19 +3638,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new OneBytes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private pb::ByteString data_ = pb::ByteString.Empty;
|
||||
public pb::ByteString Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -3967,19 +3747,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new MoreBytes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private pb::ByteString data_ = pb::ByteString.Empty;
|
||||
public pb::ByteString Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -4084,19 +3856,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new Int32Message(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private int data_;
|
||||
public int Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4201,19 +3965,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new Uint32Message(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private uint data_;
|
||||
public uint Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4318,19 +4074,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new Int64Message(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private long data_;
|
||||
public long Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4435,19 +4183,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new Uint64Message(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private ulong data_;
|
||||
public ulong Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4552,19 +4292,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new BoolMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int DataFieldNumber = 1;
|
||||
private bool data_;
|
||||
public bool Data {
|
||||
get { return data_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
data_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4680,19 +4412,10 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestOneof(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (foo_ is IFreezable) ((IFreezable) foo_).Freeze();
|
||||
}
|
||||
|
||||
public const int FooIntFieldNumber = 1;
|
||||
public int FooInt {
|
||||
get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
foo_ = value;
|
||||
fooCase_ = FooOneofCase.FooInt;
|
||||
}
|
||||
|
@ -4702,7 +4425,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string FooString {
|
||||
get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
foo_ = value ?? "";
|
||||
fooCase_ = FooOneofCase.FooString;
|
||||
}
|
||||
|
@ -4712,7 +4434,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.TestProtos.TestAllTypes FooMessage {
|
||||
get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes) foo_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
foo_ = value;
|
||||
fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage;
|
||||
}
|
||||
|
@ -4731,7 +4452,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
}
|
||||
|
||||
public void ClearFoo() {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
fooCase_ = FooOneofCase.None;
|
||||
foo_ = null;
|
||||
}
|
||||
|
@ -4889,27 +4609,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestPackedTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
packedInt32_.Freeze();
|
||||
packedInt64_.Freeze();
|
||||
packedUint32_.Freeze();
|
||||
packedUint64_.Freeze();
|
||||
packedSint32_.Freeze();
|
||||
packedSint64_.Freeze();
|
||||
packedFixed32_.Freeze();
|
||||
packedFixed64_.Freeze();
|
||||
packedSfixed32_.Freeze();
|
||||
packedSfixed64_.Freeze();
|
||||
packedFloat_.Freeze();
|
||||
packedDouble_.Freeze();
|
||||
packedBool_.Freeze();
|
||||
packedEnum_.Freeze();
|
||||
}
|
||||
|
||||
public const int PackedInt32FieldNumber = 90;
|
||||
private static readonly pb::FieldCodec<int> _repeated_packedInt32_codec
|
||||
= pb::FieldCodec.ForInt32(722);
|
||||
|
@ -5259,27 +4958,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestUnpackedTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
unpackedInt32_.Freeze();
|
||||
unpackedInt64_.Freeze();
|
||||
unpackedUint32_.Freeze();
|
||||
unpackedUint64_.Freeze();
|
||||
unpackedSint32_.Freeze();
|
||||
unpackedSint64_.Freeze();
|
||||
unpackedFixed32_.Freeze();
|
||||
unpackedFixed64_.Freeze();
|
||||
unpackedSfixed32_.Freeze();
|
||||
unpackedSfixed64_.Freeze();
|
||||
unpackedFloat_.Freeze();
|
||||
unpackedDouble_.Freeze();
|
||||
unpackedBool_.Freeze();
|
||||
unpackedEnum_.Freeze();
|
||||
}
|
||||
|
||||
public const int UnpackedInt32FieldNumber = 90;
|
||||
private static readonly pb::FieldCodec<int> _repeated_unpackedInt32_codec
|
||||
= pb::FieldCodec.ForInt32(720);
|
||||
|
@ -5621,19 +5299,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestRepeatedScalarDifferentTagSizes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
repeatedFixed32_.Freeze();
|
||||
repeatedInt32_.Freeze();
|
||||
repeatedFixed64_.Freeze();
|
||||
repeatedInt64_.Freeze();
|
||||
repeatedFloat_.Freeze();
|
||||
repeatedUint64_.Freeze();
|
||||
}
|
||||
|
||||
public const int RepeatedFixed32FieldNumber = 12;
|
||||
private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
|
||||
= pb::FieldCodec.ForFixed32(98);
|
||||
|
@ -5826,19 +5491,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestCommentInjectionMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int AFieldNumber = 1;
|
||||
private string a_ = "";
|
||||
public string A {
|
||||
get { return a_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
a_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -5942,13 +5599,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new FooRequest(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as FooRequest);
|
||||
}
|
||||
|
@ -6032,13 +5682,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new FooResponse(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as FooResponse);
|
||||
}
|
||||
|
@ -6122,13 +5765,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new FooClientMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as FooClientMessage);
|
||||
}
|
||||
|
@ -6212,13 +5848,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new FooServerMessage(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as FooServerMessage);
|
||||
}
|
||||
|
@ -6302,13 +5931,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new BarRequest(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as BarRequest);
|
||||
}
|
||||
|
@ -6392,13 +6014,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new BarResponse(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as BarResponse);
|
||||
}
|
||||
|
|
|
@ -217,28 +217,11 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new TestWellKnownTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (anyField_ != null) AnyField.Freeze();
|
||||
if (apiField_ != null) ApiField.Freeze();
|
||||
if (durationField_ != null) DurationField.Freeze();
|
||||
if (emptyField_ != null) EmptyField.Freeze();
|
||||
if (fieldMaskField_ != null) FieldMaskField.Freeze();
|
||||
if (sourceContextField_ != null) SourceContextField.Freeze();
|
||||
if (structField_ != null) StructField.Freeze();
|
||||
if (timestampField_ != null) TimestampField.Freeze();
|
||||
if (typeField_ != null) TypeField.Freeze();
|
||||
}
|
||||
|
||||
public const int AnyFieldFieldNumber = 1;
|
||||
private global::Google.Protobuf.WellKnownTypes.Any anyField_;
|
||||
public global::Google.Protobuf.WellKnownTypes.Any AnyField {
|
||||
get { return anyField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
anyField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +231,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Api ApiField {
|
||||
get { return apiField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
apiField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +240,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
|
||||
get { return durationField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
durationField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +249,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
|
||||
get { return emptyField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
emptyField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +258,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
|
||||
get { return fieldMaskField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
fieldMaskField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +267,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
|
||||
get { return sourceContextField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sourceContextField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +276,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Struct StructField {
|
||||
get { return structField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
structField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +285,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
|
||||
get { return timestampField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
timestampField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +294,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Type TypeField {
|
||||
get { return typeField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
typeField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +304,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public double? DoubleField {
|
||||
get { return doubleField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
doubleField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +314,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public float? FloatField {
|
||||
get { return floatField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
floatField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +324,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long? Int64Field {
|
||||
get { return int64Field_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
int64Field_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +334,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public ulong? Uint64Field {
|
||||
get { return uint64Field_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
uint64Field_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -373,7 +344,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int? Int32Field {
|
||||
get { return int32Field_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
int32Field_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -384,7 +354,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public uint? Uint32Field {
|
||||
get { return uint32Field_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
uint32Field_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +364,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public bool? BoolField {
|
||||
get { return boolField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
boolField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +374,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string StringField {
|
||||
get { return stringField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
stringField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +384,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public pb::ByteString BytesField {
|
||||
get { return bytesField_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
bytesField_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -901,31 +867,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new RepeatedWellKnownTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
anyField_.Freeze();
|
||||
apiField_.Freeze();
|
||||
durationField_.Freeze();
|
||||
emptyField_.Freeze();
|
||||
fieldMaskField_.Freeze();
|
||||
sourceContextField_.Freeze();
|
||||
structField_.Freeze();
|
||||
timestampField_.Freeze();
|
||||
typeField_.Freeze();
|
||||
doubleField_.Freeze();
|
||||
floatField_.Freeze();
|
||||
int64Field_.Freeze();
|
||||
uint64Field_.Freeze();
|
||||
int32Field_.Freeze();
|
||||
uint32Field_.Freeze();
|
||||
boolField_.Freeze();
|
||||
stringField_.Freeze();
|
||||
bytesField_.Freeze();
|
||||
}
|
||||
|
||||
public const int AnyFieldFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_anyField_codec
|
||||
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser);
|
||||
|
@ -1372,19 +1313,10 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new OneofWellKnownTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (oneofField_ is IFreezable) ((IFreezable) oneofField_).Freeze();
|
||||
}
|
||||
|
||||
public const int AnyFieldFieldNumber = 1;
|
||||
public global::Google.Protobuf.WellKnownTypes.Any AnyField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.AnyField ? (global::Google.Protobuf.WellKnownTypes.Any) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.AnyField;
|
||||
}
|
||||
|
@ -1394,7 +1326,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Api ApiField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.ApiField ? (global::Google.Protobuf.WellKnownTypes.Api) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.ApiField;
|
||||
}
|
||||
|
@ -1404,7 +1335,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.DurationField ? (global::Google.Protobuf.WellKnownTypes.Duration) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DurationField;
|
||||
}
|
||||
|
@ -1414,7 +1344,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.EmptyField ? (global::Google.Protobuf.WellKnownTypes.Empty) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.EmptyField;
|
||||
}
|
||||
|
@ -1424,7 +1353,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField ? (global::Google.Protobuf.WellKnownTypes.FieldMask) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FieldMaskField;
|
||||
}
|
||||
|
@ -1434,7 +1362,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.SourceContextField ? (global::Google.Protobuf.WellKnownTypes.SourceContext) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.SourceContextField;
|
||||
}
|
||||
|
@ -1444,7 +1371,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Struct StructField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.StructField ? (global::Google.Protobuf.WellKnownTypes.Struct) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StructField;
|
||||
}
|
||||
|
@ -1454,7 +1380,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.TimestampField ? (global::Google.Protobuf.WellKnownTypes.Timestamp) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TimestampField;
|
||||
}
|
||||
|
@ -1464,7 +1389,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public global::Google.Protobuf.WellKnownTypes.Type TypeField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.TypeField ? (global::Google.Protobuf.WellKnownTypes.Type) oneofField_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TypeField;
|
||||
}
|
||||
|
@ -1475,7 +1399,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public double? DoubleField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.DoubleField ? (double?) oneofField_ : (double?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DoubleField;
|
||||
}
|
||||
|
@ -1486,7 +1409,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public float? FloatField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.FloatField ? (float?) oneofField_ : (float?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FloatField;
|
||||
}
|
||||
|
@ -1497,7 +1419,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public long? Int64Field {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.Int64Field ? (long?) oneofField_ : (long?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int64Field;
|
||||
}
|
||||
|
@ -1508,7 +1429,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public ulong? Uint64Field {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.Uint64Field ? (ulong?) oneofField_ : (ulong?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint64Field;
|
||||
}
|
||||
|
@ -1519,7 +1439,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public int? Int32Field {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.Int32Field ? (int?) oneofField_ : (int?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int32Field;
|
||||
}
|
||||
|
@ -1530,7 +1449,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public uint? Uint32Field {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.Uint32Field ? (uint?) oneofField_ : (uint?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint32Field;
|
||||
}
|
||||
|
@ -1541,7 +1459,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public bool? BoolField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.BoolField ? (bool?) oneofField_ : (bool?) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BoolField;
|
||||
}
|
||||
|
@ -1552,7 +1469,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public string StringField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.StringField ? (string) oneofField_ : (string) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StringField;
|
||||
}
|
||||
|
@ -1563,7 +1479,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
public pb::ByteString BytesField {
|
||||
get { return oneofFieldCase_ == OneofFieldOneofCase.BytesField ? (pb::ByteString) oneofField_ : (pb::ByteString) null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofField_ = value;
|
||||
oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BytesField;
|
||||
}
|
||||
|
@ -1597,7 +1512,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
}
|
||||
|
||||
public void ClearOneofField() {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofFieldCase_ = OneofFieldOneofCase.None;
|
||||
oneofField_ = null;
|
||||
}
|
||||
|
@ -2030,31 +1944,6 @@ namespace Google.Protobuf.TestProtos {
|
|||
return new MapWellKnownTypes(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
anyField_.Freeze();
|
||||
apiField_.Freeze();
|
||||
durationField_.Freeze();
|
||||
emptyField_.Freeze();
|
||||
fieldMaskField_.Freeze();
|
||||
sourceContextField_.Freeze();
|
||||
structField_.Freeze();
|
||||
timestampField_.Freeze();
|
||||
typeField_.Freeze();
|
||||
doubleField_.Freeze();
|
||||
floatField_.Freeze();
|
||||
int64Field_.Freeze();
|
||||
uint64Field_.Freeze();
|
||||
int32Field_.Freeze();
|
||||
uint32Field_.Freeze();
|
||||
boolField_.Freeze();
|
||||
stringField_.Freeze();
|
||||
bytesField_.Freeze();
|
||||
}
|
||||
|
||||
public const int AnyFieldFieldNumber = 1;
|
||||
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec _map_anyField_codec
|
||||
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10);
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Google.Protobuf.Collections
|
|||
/// </remarks>
|
||||
/// <typeparam name="TKey">Key type in the map. Must be a type supported by Protocol Buffer map keys.</typeparam>
|
||||
/// <typeparam name="TValue">Value type in the map. Must be a type supported by Protocol Buffers.</typeparam>
|
||||
public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IFreezable, IDictionary<TKey, TValue>, IEquatable<MapField<TKey, TValue>>, IDictionary
|
||||
public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IDictionary<TKey, TValue>, IEquatable<MapField<TKey, TValue>>, IDictionary
|
||||
{
|
||||
// TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.)
|
||||
private readonly bool allowNullValues;
|
||||
|
@ -119,7 +119,6 @@ namespace Google.Protobuf.Collections
|
|||
|
||||
public bool Remove(TKey key)
|
||||
{
|
||||
this.CheckMutable();
|
||||
ThrowHelper.ThrowIfNull(key, "key");
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> node;
|
||||
if (map.TryGetValue(key, out node))
|
||||
|
@ -169,7 +168,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
ThrowHelper.ThrowIfNull(value, "value");
|
||||
}
|
||||
this.CheckMutable();
|
||||
LinkedListNode<KeyValuePair<TKey, TValue>> node;
|
||||
var pair = new KeyValuePair<TKey, TValue>(key, value);
|
||||
if (map.TryGetValue(key, out node))
|
||||
|
@ -214,7 +212,6 @@ namespace Google.Protobuf.Collections
|
|||
|
||||
public void Clear()
|
||||
{
|
||||
this.CheckMutable();
|
||||
list.Clear();
|
||||
map.Clear();
|
||||
}
|
||||
|
@ -233,7 +230,6 @@ namespace Google.Protobuf.Collections
|
|||
|
||||
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
this.CheckMutable();
|
||||
if (item.Key == null)
|
||||
{
|
||||
throw new ArgumentException("Key is null", "item");
|
||||
|
@ -260,31 +256,6 @@ namespace Google.Protobuf.Collections
|
|||
public int Count { get { return list.Count; } }
|
||||
public bool IsReadOnly { get { return frozen; } }
|
||||
|
||||
public void Freeze()
|
||||
{
|
||||
if (IsFrozen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
frozen = true;
|
||||
// Only values can be frozen, as all the key types are simple.
|
||||
// Everything can be done in-place, as we're just freezing objects.
|
||||
if (typeof(IFreezable).IsAssignableFrom(typeof(TValue)))
|
||||
{
|
||||
for (var node = list.First; node != null; node = node.Next)
|
||||
{
|
||||
var pair = node.Value;
|
||||
IFreezable freezableValue = pair.Value as IFreezable;
|
||||
if (freezableValue != null)
|
||||
{
|
||||
freezableValue.Freeze();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFrozen { get { return frozen; } }
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
return Equals(other as MapField<TKey, TValue>);
|
||||
|
@ -405,7 +376,6 @@ namespace Google.Protobuf.Collections
|
|||
void IDictionary.Remove(object key)
|
||||
{
|
||||
ThrowHelper.ThrowIfNull(key, "key");
|
||||
this.CheckMutable();
|
||||
if (!(key is TKey))
|
||||
{
|
||||
return;
|
||||
|
@ -420,7 +390,7 @@ namespace Google.Protobuf.Collections
|
|||
temp.CopyTo(array, index);
|
||||
}
|
||||
|
||||
bool IDictionary.IsFixedSize { get { return IsFrozen; } }
|
||||
bool IDictionary.IsFixedSize { get { return false; } }
|
||||
|
||||
ICollection IDictionary.Keys { get { return (ICollection)Keys; } }
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Google.Protobuf.Collections
|
|||
/// restrictions (no null values) and capabilities (deep cloning and freezing).
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type of the repeated field.</typeparam>
|
||||
public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>, IFreezable
|
||||
public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>
|
||||
{
|
||||
private static readonly T[] EmptyArray = new T[0];
|
||||
private const int MinArraySize = 8;
|
||||
|
@ -190,21 +190,6 @@ namespace Google.Protobuf.Collections
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsFrozen { get { return frozen; } }
|
||||
|
||||
public void Freeze()
|
||||
{
|
||||
frozen = true;
|
||||
IFreezable[] freezableArray = array as IFreezable[];
|
||||
if (freezableArray != null)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
freezableArray[i].Freeze();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureSize(int size)
|
||||
{
|
||||
if (array.Length < size)
|
||||
|
@ -223,14 +208,12 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
this.CheckMutable();
|
||||
EnsureSize(count + 1);
|
||||
array[count++] = item;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
this.CheckMutable();
|
||||
array = EmptyArray;
|
||||
count = 0;
|
||||
}
|
||||
|
@ -247,7 +230,6 @@ namespace Google.Protobuf.Collections
|
|||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
this.CheckMutable();
|
||||
int index = IndexOf(item);
|
||||
if (index == -1)
|
||||
{
|
||||
|
@ -261,7 +243,7 @@ namespace Google.Protobuf.Collections
|
|||
|
||||
public int Count { get { return count; } }
|
||||
|
||||
public bool IsReadOnly { get { return IsFrozen; } }
|
||||
public bool IsReadOnly { get { return false; } }
|
||||
|
||||
public void Add(RepeatedField<T> values)
|
||||
{
|
||||
|
@ -269,7 +251,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentNullException("values");
|
||||
}
|
||||
this.CheckMutable();
|
||||
EnsureSize(count + values.count);
|
||||
// We know that all the values will be valid, because it's a RepeatedField.
|
||||
Array.Copy(values.array, 0, array, count, values.count);
|
||||
|
@ -282,7 +263,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentNullException("values");
|
||||
}
|
||||
this.CheckMutable();
|
||||
// TODO: Check for ICollection and get the Count?
|
||||
foreach (T item in values)
|
||||
{
|
||||
|
@ -372,7 +352,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.CheckMutable();
|
||||
EnsureSize(count + 1);
|
||||
Array.Copy(array, index, array, index + 1, count - index);
|
||||
array[index] = item;
|
||||
|
@ -385,7 +364,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.CheckMutable();
|
||||
Array.Copy(array, index + 1, array, index, count - index - 1);
|
||||
count--;
|
||||
array[count] = default(T);
|
||||
|
@ -407,7 +385,6 @@ namespace Google.Protobuf.Collections
|
|||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.CheckMutable();
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
|
@ -417,7 +394,7 @@ namespace Google.Protobuf.Collections
|
|||
}
|
||||
|
||||
#region Explicit interface implementation for IList and ICollection.
|
||||
bool IList.IsFixedSize { get { return IsFrozen; } }
|
||||
bool IList.IsFixedSize { get { return false; } }
|
||||
|
||||
void ICollection.CopyTo(Array array, int index)
|
||||
{
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="IFreezable"/> types.
|
||||
/// </summary>
|
||||
public static class Freezable
|
||||
{
|
||||
/// <summary>
|
||||
/// Throws an <see cref="InvalidOperationException"/> if <paramref name="target"/>
|
||||
/// is frozen.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is a convenience methods that freezable types can call before all
|
||||
/// mutations, to protect frozen objects.
|
||||
/// </remarks>
|
||||
public static void CheckMutable(this IFreezable target)
|
||||
{
|
||||
if (target.IsFrozen)
|
||||
{
|
||||
throw new InvalidOperationException("Attempt to mutate frozen object");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,7 +64,6 @@
|
|||
<Compile Include="Compatibility\TypeExtensions.cs" />
|
||||
<Compile Include="FieldCodec.cs" />
|
||||
<Compile Include="FrameworkPortability.cs" />
|
||||
<Compile Include="Freezable.cs" />
|
||||
<Compile Include="JsonFormatter.cs" />
|
||||
<Compile Include="MessageExtensions.cs" />
|
||||
<Compile Include="IMessage.cs" />
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Google.Protobuf
|
|||
/// the implementation class.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The message type.</typeparam>
|
||||
public interface IMessage<T> : IMessage, IEquatable<T>, IDeepCloneable<T>, IFreezable where T : IMessage<T>
|
||||
public interface IMessage<T> : IMessage, IEquatable<T>, IDeepCloneable<T> where T : IMessage<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Merges the given message into this one.
|
||||
|
@ -97,10 +97,6 @@ namespace Google.Protobuf
|
|||
/// Additionally, due to the type constraint on <c>T</c> in <see cref="IMessage{T}"/>,
|
||||
/// it is simpler to keep this as a separate interface.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Freezable types which implement this interface should always return a mutable clone,
|
||||
/// even if the original object is frozen.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type itself, returned by the <see cref="Clone"/> method.</typeparam>
|
||||
public interface IDeepCloneable<T>
|
||||
|
@ -111,32 +107,4 @@ namespace Google.Protobuf
|
|||
/// <returns>A deep clone of this object.</returns>
|
||||
T Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a mechanism for freezing a message (or repeated field collection)
|
||||
/// to make it immutable.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Implementations are under no obligation to make this thread-safe: if a freezable
|
||||
/// type instance is shared between threads before being frozen, and one thread then
|
||||
/// freezes it, it is possible for other threads to make changes during the freezing
|
||||
/// operation and also to observe stale values for mutated fields. Objects should be
|
||||
/// frozen before being made available to other threads.
|
||||
/// </remarks>
|
||||
public interface IFreezable
|
||||
{
|
||||
/// <summary>
|
||||
/// Freezes this object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the object is already frozen, this method has no effect.
|
||||
/// </remarks>
|
||||
void Freeze();
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether or not this object is frozen (and therefore immutable).
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this object is frozen; <c>false</c> otherwise.</value>
|
||||
bool IsFrozen { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,14 +190,6 @@ namespace Google.Protobuf.Reflection {
|
|||
return new FileDescriptorSet(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
file_.Freeze();
|
||||
}
|
||||
|
||||
public const int FileFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FileDescriptorProto> _repeated_file_codec
|
||||
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser);
|
||||
|
@ -310,28 +302,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new FileDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
dependency_.Freeze();
|
||||
publicDependency_.Freeze();
|
||||
weakDependency_.Freeze();
|
||||
messageType_.Freeze();
|
||||
enumType_.Freeze();
|
||||
service_.Freeze();
|
||||
extension_.Freeze();
|
||||
if (options_ != null) Options.Freeze();
|
||||
if (sourceCodeInfo_ != null) SourceCodeInfo.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +316,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string Package {
|
||||
get { return package_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
package_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +381,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FileOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +390,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo {
|
||||
get { return sourceCodeInfo_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sourceCodeInfo_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -427,7 +399,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string Syntax {
|
||||
get { return syntax_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
syntax_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -682,28 +653,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new DescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
field_.Freeze();
|
||||
extension_.Freeze();
|
||||
nestedType_.Freeze();
|
||||
enumType_.Freeze();
|
||||
extensionRange_.Freeze();
|
||||
oneofDecl_.Freeze();
|
||||
if (options_ != null) Options.Freeze();
|
||||
reservedRange_.Freeze();
|
||||
reservedName_.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +715,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.MessageOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -978,19 +931,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new ExtensionRange(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int StartFieldNumber = 1;
|
||||
private int start_;
|
||||
internal int Start {
|
||||
get { return start_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
start_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1000,7 +945,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal int End {
|
||||
get { return end_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
end_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1122,19 +1066,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new ReservedRange(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int StartFieldNumber = 1;
|
||||
private int start_;
|
||||
internal int Start {
|
||||
get { return start_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
start_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1144,7 +1080,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal int End {
|
||||
get { return end_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
end_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1278,20 +1213,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new FieldDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (options_ != null) Options.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1301,7 +1227,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal int Number {
|
||||
get { return number_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
number_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1311,7 +1236,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label {
|
||||
get { return label_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
label_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1321,7 +1245,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type {
|
||||
get { return type_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
type_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1331,7 +1254,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string TypeName {
|
||||
get { return typeName_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
typeName_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1341,7 +1263,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string Extendee {
|
||||
get { return extendee_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
extendee_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1351,7 +1272,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string DefaultValue {
|
||||
get { return defaultValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
defaultValue_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1361,7 +1281,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal int OneofIndex {
|
||||
get { return oneofIndex_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofIndex_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1371,7 +1290,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FieldOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1643,19 +1561,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new OneofDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1762,21 +1672,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new EnumDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
value_.Freeze();
|
||||
if (options_ != null) Options.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1794,7 +1694,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.EnumOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1932,20 +1831,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new EnumValueDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (options_ != null) Options.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1955,7 +1845,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal int Number {
|
||||
get { return number_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
number_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -1965,7 +1854,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.EnumValueOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2110,21 +1998,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new ServiceDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
method_.Freeze();
|
||||
if (options_ != null) Options.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2142,7 +2020,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.ServiceOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2283,20 +2160,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new MethodDescriptorProto(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (options_ != null) Options.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
internal string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2306,7 +2174,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string InputType {
|
||||
get { return inputType_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
inputType_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2316,7 +2183,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string OutputType {
|
||||
get { return outputType_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
outputType_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2326,7 +2192,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.MethodOptions Options {
|
||||
get { return options_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
options_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2336,7 +2201,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool ClientStreaming {
|
||||
get { return clientStreaming_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
clientStreaming_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2346,7 +2210,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool ServerStreaming {
|
||||
get { return serverStreaming_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
serverStreaming_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2551,20 +2414,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new FileOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int JavaPackageFieldNumber = 1;
|
||||
private string javaPackage_ = "";
|
||||
internal string JavaPackage {
|
||||
get { return javaPackage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaPackage_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2574,7 +2428,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string JavaOuterClassname {
|
||||
get { return javaOuterClassname_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaOuterClassname_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2584,7 +2437,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool JavaMultipleFiles {
|
||||
get { return javaMultipleFiles_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaMultipleFiles_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2594,7 +2446,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool JavaGenerateEqualsAndHash {
|
||||
get { return javaGenerateEqualsAndHash_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaGenerateEqualsAndHash_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2604,7 +2455,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool JavaStringCheckUtf8 {
|
||||
get { return javaStringCheckUtf8_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaStringCheckUtf8_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2614,7 +2464,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor {
|
||||
get { return optimizeFor_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
optimizeFor_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2624,7 +2473,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string GoPackage {
|
||||
get { return goPackage_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
goPackage_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2634,7 +2482,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool CcGenericServices {
|
||||
get { return ccGenericServices_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
ccGenericServices_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2644,7 +2491,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool JavaGenericServices {
|
||||
get { return javaGenericServices_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
javaGenericServices_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2654,7 +2500,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool PyGenericServices {
|
||||
get { return pyGenericServices_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
pyGenericServices_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2664,7 +2509,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2674,7 +2518,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool CcEnableArenas {
|
||||
get { return ccEnableArenas_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
ccEnableArenas_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -2684,7 +2527,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string ObjcClassPrefix {
|
||||
get { return objcClassPrefix_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
objcClassPrefix_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -2694,7 +2536,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string CsharpNamespace {
|
||||
get { return csharpNamespace_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
csharpNamespace_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -3040,20 +2881,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new MessageOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int MessageSetWireFormatFieldNumber = 1;
|
||||
private bool messageSetWireFormat_;
|
||||
internal bool MessageSetWireFormat {
|
||||
get { return messageSetWireFormat_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
messageSetWireFormat_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3063,7 +2895,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool NoStandardDescriptorAccessor {
|
||||
get { return noStandardDescriptorAccessor_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
noStandardDescriptorAccessor_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3073,7 +2904,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3083,7 +2913,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool MapEntry {
|
||||
get { return mapEntry_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
mapEntry_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3259,20 +3088,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new FieldOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int CtypeFieldNumber = 1;
|
||||
private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING;
|
||||
internal global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype {
|
||||
get { return ctype_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
ctype_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3282,7 +3102,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Packed {
|
||||
get { return packed_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
packed_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3292,7 +3111,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype {
|
||||
get { return jstype_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
jstype_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3302,7 +3120,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Lazy {
|
||||
get { return lazy_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
lazy_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3312,7 +3129,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3322,7 +3138,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Weak {
|
||||
get { return weak_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
weak_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3544,20 +3359,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new EnumOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int AllowAliasFieldNumber = 2;
|
||||
private bool allowAlias_;
|
||||
internal bool AllowAlias {
|
||||
get { return allowAlias_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
allowAlias_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3567,7 +3373,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3706,20 +3511,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new EnumValueOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int DeprecatedFieldNumber = 1;
|
||||
private bool deprecated_;
|
||||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3842,20 +3638,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new ServiceOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int DeprecatedFieldNumber = 33;
|
||||
private bool deprecated_;
|
||||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -3978,20 +3765,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new MethodOptions(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
uninterpretedOption_.Freeze();
|
||||
}
|
||||
|
||||
public const int DeprecatedFieldNumber = 33;
|
||||
private bool deprecated_;
|
||||
internal bool Deprecated {
|
||||
get { return deprecated_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
deprecated_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4119,14 +3897,6 @@ namespace Google.Protobuf.Reflection {
|
|||
return new UninterpretedOption(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
name_.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 2;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> _repeated_name_codec
|
||||
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser);
|
||||
|
@ -4140,7 +3910,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string IdentifierValue {
|
||||
get { return identifierValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
identifierValue_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -4150,7 +3919,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal ulong PositiveIntValue {
|
||||
get { return positiveIntValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
positiveIntValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4160,7 +3928,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal long NegativeIntValue {
|
||||
get { return negativeIntValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
negativeIntValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4170,7 +3937,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal double DoubleValue {
|
||||
get { return doubleValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
doubleValue_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4180,7 +3946,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal pb::ByteString StringValue {
|
||||
get { return stringValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
stringValue_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -4190,7 +3955,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string AggregateValue {
|
||||
get { return aggregateValue_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
aggregateValue_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -4386,19 +4150,11 @@ namespace Google.Protobuf.Reflection {
|
|||
return new NamePart(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int NamePart_FieldNumber = 1;
|
||||
private string namePart_ = "";
|
||||
internal string NamePart_ {
|
||||
get { return namePart_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
namePart_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -4408,7 +4164,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal bool IsExtension {
|
||||
get { return isExtension_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
isExtension_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -4534,14 +4289,6 @@ namespace Google.Protobuf.Reflection {
|
|||
return new SourceCodeInfo(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
location_.Freeze();
|
||||
}
|
||||
|
||||
public const int LocationFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> _repeated_location_codec
|
||||
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser);
|
||||
|
@ -4648,16 +4395,6 @@ namespace Google.Protobuf.Reflection {
|
|||
return new Location(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
path_.Freeze();
|
||||
span_.Freeze();
|
||||
leadingDetachedComments_.Freeze();
|
||||
}
|
||||
|
||||
public const int PathFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<int> _repeated_path_codec
|
||||
= pb::FieldCodec.ForInt32(10);
|
||||
|
@ -4679,7 +4416,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string LeadingComments {
|
||||
get { return leadingComments_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
leadingComments_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -4689,7 +4425,6 @@ namespace Google.Protobuf.Reflection {
|
|||
internal string TrailingComments {
|
||||
get { return trailingComments_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
trailingComments_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,19 +69,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Any(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int TypeUrlFieldNumber = 1;
|
||||
private string typeUrl_ = "";
|
||||
public string TypeUrl {
|
||||
get { return typeUrl_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
typeUrl_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +83,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public pb::ByteString Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,22 +82,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Api(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
methods_.Freeze();
|
||||
options_.Freeze();
|
||||
if (sourceContext_ != null) SourceContext.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +112,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string Version {
|
||||
get { return version_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
version_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +121,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
|
||||
get { return sourceContext_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sourceContext_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -299,20 +286,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Method(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
options_.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +300,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string RequestTypeUrl {
|
||||
get { return requestTypeUrl_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
requestTypeUrl_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +309,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public bool RequestStreaming {
|
||||
get { return requestStreaming_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
requestStreaming_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +318,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string ResponseTypeUrl {
|
||||
get { return responseTypeUrl_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
responseTypeUrl_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +327,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public bool ResponseStreaming {
|
||||
get { return responseStreaming_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
responseStreaming_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,19 +70,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Duration(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int SecondsFieldNumber = 1;
|
||||
private long seconds_;
|
||||
public long Seconds {
|
||||
get { return seconds_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
seconds_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +84,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public int Nanos {
|
||||
get { return nanos_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
nanos_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Empty(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Empty);
|
||||
}
|
||||
|
|
|
@ -68,14 +68,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new FieldMask(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
paths_.Freeze();
|
||||
}
|
||||
|
||||
public const int PathsFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<string> _repeated_paths_codec
|
||||
= pb::FieldCodec.ForString(10);
|
||||
|
|
|
@ -69,19 +69,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new SourceContext(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int FileNameFieldNumber = 1;
|
||||
private string fileName_ = "";
|
||||
public string FileName {
|
||||
get { return fileName_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
fileName_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,14 +87,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Struct(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
fields_.Freeze();
|
||||
}
|
||||
|
||||
public const int FieldsFieldNumber = 1;
|
||||
private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec
|
||||
= new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10);
|
||||
|
@ -216,19 +208,10 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Value(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (kind_ is IFreezable) ((IFreezable) kind_).Freeze();
|
||||
}
|
||||
|
||||
public const int NullValueFieldNumber = 1;
|
||||
public global::Google.Protobuf.WellKnownTypes.NullValue NullValue {
|
||||
get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NULL_VALUE; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
kindCase_ = KindOneofCase.NullValue;
|
||||
}
|
||||
|
@ -238,7 +221,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public double NumberValue {
|
||||
get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
kindCase_ = KindOneofCase.NumberValue;
|
||||
}
|
||||
|
@ -248,7 +230,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string StringValue {
|
||||
get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value ?? "";
|
||||
kindCase_ = KindOneofCase.StringValue;
|
||||
}
|
||||
|
@ -258,7 +239,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public bool BoolValue {
|
||||
get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
kindCase_ = KindOneofCase.BoolValue;
|
||||
}
|
||||
|
@ -268,7 +248,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.Struct StructValue {
|
||||
get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.StructValue;
|
||||
}
|
||||
|
@ -278,7 +257,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.ListValue ListValue {
|
||||
get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.ListValue;
|
||||
}
|
||||
|
@ -300,7 +278,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
}
|
||||
|
||||
public void ClearKind() {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kindCase_ = KindOneofCase.None;
|
||||
kind_ = null;
|
||||
}
|
||||
|
@ -499,14 +476,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new ListValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
values_.Freeze();
|
||||
}
|
||||
|
||||
public const int ValuesFieldNumber = 1;
|
||||
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec
|
||||
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser);
|
||||
|
|
|
@ -70,19 +70,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Timestamp(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int SecondsFieldNumber = 1;
|
||||
private long seconds_;
|
||||
public long Seconds {
|
||||
get { return seconds_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
seconds_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +84,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public int Nanos {
|
||||
get { return nanos_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
nanos_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,23 +103,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Type(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
fields_.Freeze();
|
||||
oneofs_.Freeze();
|
||||
options_.Freeze();
|
||||
if (sourceContext_ != null) SourceContext.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +141,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
|
||||
get { return sourceContext_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sourceContext_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -314,20 +301,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Field(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
options_.Freeze();
|
||||
}
|
||||
|
||||
public const int KindFieldNumber = 1;
|
||||
private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN;
|
||||
public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind {
|
||||
get { return kind_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
kind_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +315,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality {
|
||||
get { return cardinality_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
cardinality_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +324,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public int Number {
|
||||
get { return number_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
number_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +333,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +342,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public string TypeUrl {
|
||||
get { return typeUrl_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
typeUrl_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +351,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public int OneofIndex {
|
||||
get { return oneofIndex_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
oneofIndex_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -387,7 +360,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public bool Packed {
|
||||
get { return packed_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
packed_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -642,22 +614,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Enum(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
enumvalue_.Freeze();
|
||||
options_.Freeze();
|
||||
if (sourceContext_ != null) SourceContext.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -683,7 +644,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
|
||||
get { return sourceContext_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
sourceContext_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -830,20 +790,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new EnumValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
options_.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -853,7 +804,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public int Number {
|
||||
get { return number_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
number_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -992,20 +942,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Option(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
if (value_ != null) Value.Freeze();
|
||||
}
|
||||
|
||||
public const int NameFieldNumber = 1;
|
||||
private string name_ = "";
|
||||
public string Name {
|
||||
get { return name_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
name_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1015,7 +956,6 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
public global::Google.Protobuf.WellKnownTypes.Any Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,19 +78,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new DoubleValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private double value_;
|
||||
public double Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -195,19 +187,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new FloatValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private float value_;
|
||||
public float Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -312,19 +296,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Int64Value(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private long value_;
|
||||
public long Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -429,19 +405,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new UInt64Value(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private ulong value_;
|
||||
public ulong Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -546,19 +514,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new Int32Value(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private int value_;
|
||||
public int Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -663,19 +623,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new UInt32Value(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private uint value_;
|
||||
public uint Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -780,19 +732,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new BoolValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private bool value_;
|
||||
public bool Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
@ -897,19 +841,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new StringValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private string value_ = "";
|
||||
public string Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value ?? "";
|
||||
}
|
||||
}
|
||||
|
@ -1014,19 +950,11 @@ namespace Google.Protobuf.WellKnownTypes {
|
|||
return new BytesValue(this);
|
||||
}
|
||||
|
||||
public void Freeze() {
|
||||
if (IsFrozen) {
|
||||
return;
|
||||
}
|
||||
_frozen = true;
|
||||
}
|
||||
|
||||
public const int ValueFieldNumber = 1;
|
||||
private pb::ByteString value_ = pb::ByteString.Empty;
|
||||
public pb::ByteString Value {
|
||||
get { return value_; }
|
||||
set {
|
||||
pb::Freezable.CheckMutable(this);
|
||||
value_ = value ?? pb::ByteString.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,8 +129,6 @@ void MapFieldGenerator::GenerateCloningCode(io::Printer* printer) {
|
|||
}
|
||||
|
||||
void MapFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
printer->Print(variables_,
|
||||
"$name$_.Freeze();\n");
|
||||
}
|
||||
|
||||
} // namespace csharp
|
||||
|
|
|
@ -190,7 +190,6 @@ void MessageGenerator::Generate(io::Printer* printer) {
|
|||
" get { return $name$Case_; }\n"
|
||||
"}\n\n"
|
||||
"public void Clear$property_name$() {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n"
|
||||
" $name$Case_ = $property_name$OneofCase.None;\n"
|
||||
" $name$_ = null;\n"
|
||||
"}\n\n");
|
||||
|
@ -293,33 +292,6 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
|
|||
}
|
||||
|
||||
void MessageGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
map<string, string> vars;
|
||||
vars["class_name"] = class_name();
|
||||
printer->Print(
|
||||
"public void Freeze() {\n"
|
||||
" if (IsFrozen) {\n"
|
||||
" return;\n"
|
||||
" }\n"
|
||||
" _frozen = true;\n");
|
||||
printer->Indent();
|
||||
// Freeze non-oneof fields first (only messages and repeated fields will actually generate any code)
|
||||
for (int i = 0; i < descriptor_->field_count(); i++) {
|
||||
if (!descriptor_->field(i)->containing_oneof()) {
|
||||
scoped_ptr<FieldGeneratorBase> generator(
|
||||
CreateFieldGeneratorInternal(descriptor_->field(i)));
|
||||
generator->GenerateFreezingCode(printer);
|
||||
}
|
||||
}
|
||||
|
||||
// For each oneof, if the value is freezable, freeze it. We don't actually need to know which type it was.
|
||||
for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) {
|
||||
vars["name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false);
|
||||
printer->Print(vars,
|
||||
"if ($name$_ is IFreezable) ((IFreezable) $name$_).Freeze();\n");
|
||||
}
|
||||
|
||||
printer->Outdent();
|
||||
printer->Print("}\n\n");
|
||||
}
|
||||
|
||||
void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
|
||||
|
|
|
@ -67,7 +67,6 @@ void MessageFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $name$_; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n"
|
||||
" $name$_ = value;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
|
@ -134,8 +133,6 @@ void MessageFieldGenerator::GenerateCloningCode(io::Printer* printer) {
|
|||
}
|
||||
|
||||
void MessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
printer->Print(variables_,
|
||||
"if ($has_property_check$) $property_name$.Freeze();\n");
|
||||
}
|
||||
|
||||
void MessageFieldGenerator::GenerateCodecCode(io::Printer* printer) {
|
||||
|
@ -161,7 +158,6 @@ void MessageOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : null; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n"
|
||||
" $oneof_name$_ = value;\n"
|
||||
" $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$property_name$;\n"
|
||||
" }\n"
|
||||
|
|
|
@ -73,8 +73,7 @@ void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
variables_,
|
||||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $name$_; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n");
|
||||
" set {\n");
|
||||
if (is_value_type) {
|
||||
printer->Print(
|
||||
variables_,
|
||||
|
@ -176,8 +175,7 @@ void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
variables_,
|
||||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : $default_value$; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n");
|
||||
" set {\n");
|
||||
if (is_value_type) {
|
||||
printer->Print(
|
||||
variables_,
|
||||
|
|
|
@ -117,8 +117,6 @@ void RepeatedEnumFieldGenerator::GenerateCloningCode(io::Printer* printer) {
|
|||
}
|
||||
|
||||
void RepeatedEnumFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
printer->Print(variables_,
|
||||
"$name$_.Freeze();\n");
|
||||
}
|
||||
|
||||
} // namespace csharp
|
||||
|
|
|
@ -132,8 +132,6 @@ void RepeatedMessageFieldGenerator::GenerateCloningCode(io::Printer* printer) {
|
|||
}
|
||||
|
||||
void RepeatedMessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
printer->Print(variables_,
|
||||
"$name$_.Freeze();\n");
|
||||
}
|
||||
|
||||
} // namespace csharp
|
||||
|
|
|
@ -115,8 +115,6 @@ void RepeatedPrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer)
|
|||
}
|
||||
|
||||
void RepeatedPrimitiveFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
|
||||
printer->Print(variables_,
|
||||
"$name$_.Freeze();\n");
|
||||
}
|
||||
|
||||
} // namespace csharp
|
||||
|
|
|
@ -76,7 +76,6 @@ void WrapperFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $name$_; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n"
|
||||
" $name$_ = value;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
|
@ -172,7 +171,6 @@ void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
|
|||
"$access_level$ $type_name$ $property_name$ {\n"
|
||||
" get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : ($type_name$) null; }\n"
|
||||
" set {\n"
|
||||
" pb::Freezable.CheckMutable(this);\n"
|
||||
" $oneof_name$_ = value;\n"
|
||||
" $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$property_name$;\n"
|
||||
" }\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue