Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
d1f5acaa
Commit
d1f5acaa
authored
Apr 29, 2015
by
Jie Luo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the package for field_presence_test.proto
parent
c5c9c6a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
265 additions
and
447 deletions
+265
-447
field_presence_test.proto
csharp/protos/google/protobuf/field_presence_test.proto
+1
-1
FieldPResenceTest.cs
csharp/src/ProtocolBuffers.Test/FieldPResenceTest.cs
+24
-24
FieldPresense.cs
csharp/src/ProtocolBuffers.Test/TestProtos/FieldPresense.cs
+240
-422
No files found.
csharp/protos/google/protobuf/field_presence_test.proto
View file @
d1f5acaa
syntax
=
"proto3"
;
syntax
=
"proto3"
;
package
field_presence_test
;
package
Google
.
ProtocolBuffers.TestProtos.FieldPresence
;
option
java_package
=
"com.google.protobuf"
;
option
java_package
=
"com.google.protobuf"
;
option
java_outer_classname
=
"FieldPresenceTestProto"
;
option
java_outer_classname
=
"FieldPresenceTestProto"
;
...
...
csharp/src/ProtocolBuffers.Test/FieldPResenceTest.cs
View file @
d1f5acaa
...
@@ -56,22 +56,22 @@ namespace Google.ProtocolBuffers
...
@@ -56,22 +56,22 @@ namespace Google.ProtocolBuffers
{
{
// Optional non-message fields don't have HasFoo method generated
// Optional non-message fields don't have HasFoo method generated
Type
proto2Type
=
typeof
(
TestAllTypes
);
Type
proto2Type
=
typeof
(
TestAllTypes
);
Type
proto3Type
=
typeof
(
field_presence_test
.
TestAllTypes
);
Type
proto3Type
=
typeof
(
FieldPresence
.
TestAllTypes
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalInt32"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalInt32"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalString"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalString"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalBytes"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalBytes"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalNestedEnum"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalNestedEnum"
);
proto2Type
=
typeof
(
TestAllTypes
.
Builder
);
proto2Type
=
typeof
(
TestAllTypes
.
Builder
);
proto3Type
=
typeof
(
field_presence_test
.
TestAllTypes
.
Builder
);
proto3Type
=
typeof
(
FieldPresence
.
TestAllTypes
.
Builder
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalInt32"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalInt32"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalString"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalString"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalBytes"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalBytes"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalNestedEnum"
);
CheckHasMethodRemoved
(
proto2Type
,
proto3Type
,
"OptionalNestedEnum"
);
// message fields still have the HasFoo method generated
// message fields still have the HasFoo method generated
Assert
.
False
(
field_presence_test
.
TestAllTypes
.
CreateBuilder
().
Build
().
HasOptionalNestedMessage
);
Assert
.
False
(
FieldPresence
.
TestAllTypes
.
CreateBuilder
().
Build
().
HasOptionalNestedMessage
);
Assert
.
False
(
field_presence_test
.
TestAllTypes
.
CreateBuilder
().
HasOptionalNestedMessage
);
Assert
.
False
(
FieldPresence
.
TestAllTypes
.
CreateBuilder
().
HasOptionalNestedMessage
);
}
}
[
TestMethod
]
[
TestMethod
]
...
@@ -81,29 +81,29 @@ namespace Google.ProtocolBuffers
...
@@ -81,29 +81,29 @@ namespace Google.ProtocolBuffers
// way as not set.
// way as not set.
// Serialization will ignore such fields.
// Serialization will ignore such fields.
field_presence_test
.
TestAllTypes
.
Builder
builder
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
();
FieldPresence
.
TestAllTypes
.
Builder
builder
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
();
builder
.
SetOptionalInt32
(
0
);
builder
.
SetOptionalInt32
(
0
);
builder
.
SetOptionalString
(
""
);
builder
.
SetOptionalString
(
""
);
builder
.
SetOptionalBytes
(
ByteString
.
Empty
);
builder
.
SetOptionalBytes
(
ByteString
.
Empty
);
builder
.
SetOptionalNestedEnum
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
);
builder
.
SetOptionalNestedEnum
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
);
field_presence_test
.
TestAllTypes
message
=
builder
.
Build
();
FieldPresence
.
TestAllTypes
message
=
builder
.
Build
();
Assert
.
AreEqual
(
0
,
message
.
SerializedSize
);
Assert
.
AreEqual
(
0
,
message
.
SerializedSize
);
// Test merge
// Test merge
field_presence_test
.
TestAllTypes
.
Builder
a
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
();
FieldPresence
.
TestAllTypes
.
Builder
a
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
();
a
.
SetOptionalInt32
(
1
);
a
.
SetOptionalInt32
(
1
);
a
.
SetOptionalString
(
"x"
);
a
.
SetOptionalString
(
"x"
);
a
.
SetOptionalBytes
(
ByteString
.
CopyFromUtf8
(
"y"
));
a
.
SetOptionalBytes
(
ByteString
.
CopyFromUtf8
(
"y"
));
a
.
SetOptionalNestedEnum
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
);
a
.
SetOptionalNestedEnum
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
);
a
.
MergeFrom
(
message
);
a
.
MergeFrom
(
message
);
field_presence_test
.
TestAllTypes
messageA
=
a
.
Build
();
FieldPresence
.
TestAllTypes
messageA
=
a
.
Build
();
Assert
.
AreEqual
(
1
,
messageA
.
OptionalInt32
);
Assert
.
AreEqual
(
1
,
messageA
.
OptionalInt32
);
Assert
.
AreEqual
(
"x"
,
messageA
.
OptionalString
);
Assert
.
AreEqual
(
"x"
,
messageA
.
OptionalString
);
Assert
.
AreEqual
(
ByteString
.
CopyFromUtf8
(
"y"
),
messageA
.
OptionalBytes
);
Assert
.
AreEqual
(
ByteString
.
CopyFromUtf8
(
"y"
),
messageA
.
OptionalBytes
);
Assert
.
AreEqual
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
,
messageA
.
OptionalNestedEnum
);
Assert
.
AreEqual
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
,
messageA
.
OptionalNestedEnum
);
// equals/hashCode should produce the same results
// equals/hashCode should produce the same results
field_presence_test
.
TestAllTypes
empty
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
().
Build
();
FieldPresence
.
TestAllTypes
empty
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
().
Build
();
Assert
.
True
(
empty
.
Equals
(
message
));
Assert
.
True
(
empty
.
Equals
(
message
));
Assert
.
True
(
message
.
Equals
(
empty
));
Assert
.
True
(
message
.
Equals
(
empty
));
Assert
.
AreEqual
(
empty
.
GetHashCode
(),
message
.
GetHashCode
());
Assert
.
AreEqual
(
empty
.
GetHashCode
(),
message
.
GetHashCode
());
...
@@ -112,24 +112,24 @@ namespace Google.ProtocolBuffers
...
@@ -112,24 +112,24 @@ namespace Google.ProtocolBuffers
[
TestMethod
]
[
TestMethod
]
public
void
TestFieldPresenceReflection
()
public
void
TestFieldPresenceReflection
()
{
{
MessageDescriptor
descriptor
=
field_presence_test
.
TestAllTypes
.
Descriptor
;
MessageDescriptor
descriptor
=
FieldPresence
.
TestAllTypes
.
Descriptor
;
FieldDescriptor
optionalInt32Field
=
descriptor
.
FindFieldByName
(
"optional_int32"
);
FieldDescriptor
optionalInt32Field
=
descriptor
.
FindFieldByName
(
"optional_int32"
);
FieldDescriptor
optionalStringField
=
descriptor
.
FindFieldByName
(
"optional_string"
);
FieldDescriptor
optionalStringField
=
descriptor
.
FindFieldByName
(
"optional_string"
);
FieldDescriptor
optionalBytesField
=
descriptor
.
FindFieldByName
(
"optional_bytes"
);
FieldDescriptor
optionalBytesField
=
descriptor
.
FindFieldByName
(
"optional_bytes"
);
FieldDescriptor
optionalNestedEnumField
=
descriptor
.
FindFieldByName
(
"optional_nested_enum"
);
FieldDescriptor
optionalNestedEnumField
=
descriptor
.
FindFieldByName
(
"optional_nested_enum"
);
field_presence_test
.
TestAllTypes
message
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
().
Build
();
FieldPresence
.
TestAllTypes
message
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
().
Build
();
Assert
.
False
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
False
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
False
(
message
.
HasField
(
optionalStringField
));
Assert
.
False
(
message
.
HasField
(
optionalStringField
));
Assert
.
False
(
message
.
HasField
(
optionalBytesField
));
Assert
.
False
(
message
.
HasField
(
optionalBytesField
));
Assert
.
False
(
message
.
HasField
(
optionalNestedEnumField
));
Assert
.
False
(
message
.
HasField
(
optionalNestedEnumField
));
// Set to default value is seen as not present
// Set to default value is seen as not present
message
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
()
message
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
()
.
SetOptionalInt32
(
0
)
.
SetOptionalInt32
(
0
)
.
SetOptionalString
(
""
)
.
SetOptionalString
(
""
)
.
SetOptionalBytes
(
ByteString
.
Empty
)
.
SetOptionalBytes
(
ByteString
.
Empty
)
.
SetOptionalNestedEnum
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
.
SetOptionalNestedEnum
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
.
Build
();
.
Build
();
Assert
.
False
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
False
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
False
(
message
.
HasField
(
optionalStringField
));
Assert
.
False
(
message
.
HasField
(
optionalStringField
));
...
@@ -138,11 +138,11 @@ namespace Google.ProtocolBuffers
...
@@ -138,11 +138,11 @@ namespace Google.ProtocolBuffers
Assert
.
AreEqual
(
0
,
message
.
AllFields
.
Count
);
Assert
.
AreEqual
(
0
,
message
.
AllFields
.
Count
);
// Set t0 non-defalut value is seen as present
// Set t0 non-defalut value is seen as present
message
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
()
message
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
()
.
SetOptionalInt32
(
1
)
.
SetOptionalInt32
(
1
)
.
SetOptionalString
(
"x"
)
.
SetOptionalString
(
"x"
)
.
SetOptionalBytes
(
ByteString
.
CopyFromUtf8
(
"y"
))
.
SetOptionalBytes
(
ByteString
.
CopyFromUtf8
(
"y"
))
.
SetOptionalNestedEnum
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
)
.
SetOptionalNestedEnum
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
BAR
)
.
Build
();
.
Build
();
Assert
.
True
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
True
(
message
.
HasField
(
optionalInt32Field
));
Assert
.
True
(
message
.
HasField
(
optionalStringField
));
Assert
.
True
(
message
.
HasField
(
optionalStringField
));
...
@@ -154,13 +154,13 @@ namespace Google.ProtocolBuffers
...
@@ -154,13 +154,13 @@ namespace Google.ProtocolBuffers
[
TestMethod
]
[
TestMethod
]
public
void
TestMessageField
()
public
void
TestMessageField
()
{
{
field_presence_test
.
TestAllTypes
.
Builder
builder
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
();
FieldPresence
.
TestAllTypes
.
Builder
builder
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
();
Assert
.
False
(
builder
.
HasOptionalNestedMessage
);
Assert
.
False
(
builder
.
HasOptionalNestedMessage
);
Assert
.
False
(
builder
.
Build
().
HasOptionalNestedMessage
);
Assert
.
False
(
builder
.
Build
().
HasOptionalNestedMessage
);
// Unlike non-message fields, if we set default value to message field, the field
// Unlike non-message fields, if we set default value to message field, the field
// shoule be seem as present.
// shoule be seem as present.
builder
.
SetOptionalNestedMessage
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
);
builder
.
SetOptionalNestedMessage
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
);
Assert
.
True
(
builder
.
HasOptionalNestedMessage
);
Assert
.
True
(
builder
.
HasOptionalNestedMessage
);
Assert
.
True
(
builder
.
Build
().
HasOptionalNestedMessage
);
Assert
.
True
(
builder
.
Build
().
HasOptionalNestedMessage
);
...
@@ -169,17 +169,17 @@ namespace Google.ProtocolBuffers
...
@@ -169,17 +169,17 @@ namespace Google.ProtocolBuffers
[
TestMethod
]
[
TestMethod
]
public
void
TestSeralizeAndParese
()
public
void
TestSeralizeAndParese
()
{
{
field_presence_test
.
TestAllTypes
.
Builder
builder
=
field_presence_test
.
TestAllTypes
.
CreateBuilder
();
FieldPresence
.
TestAllTypes
.
Builder
builder
=
FieldPresence
.
TestAllTypes
.
CreateBuilder
();
builder
.
SetOptionalInt32
(
1234
);
builder
.
SetOptionalInt32
(
1234
);
builder
.
SetOptionalString
(
"hello"
);
builder
.
SetOptionalString
(
"hello"
);
builder
.
SetOptionalNestedMessage
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
);
builder
.
SetOptionalNestedMessage
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
);
ByteString
data
=
builder
.
Build
().
ToByteString
();
ByteString
data
=
builder
.
Build
().
ToByteString
();
field_presence_test
.
TestAllTypes
message
=
field_presence_test
.
TestAllTypes
.
ParseFrom
(
data
);
FieldPresence
.
TestAllTypes
message
=
FieldPresence
.
TestAllTypes
.
ParseFrom
(
data
);
Assert
.
AreEqual
(
1234
,
message
.
OptionalInt32
);
Assert
.
AreEqual
(
1234
,
message
.
OptionalInt32
);
Assert
.
AreEqual
(
"hello"
,
message
.
OptionalString
);
Assert
.
AreEqual
(
"hello"
,
message
.
OptionalString
);
Assert
.
AreEqual
(
ByteString
.
Empty
,
message
.
OptionalBytes
);
Assert
.
AreEqual
(
ByteString
.
Empty
,
message
.
OptionalBytes
);
Assert
.
AreEqual
(
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
,
message
.
OptionalNestedEnum
);
Assert
.
AreEqual
(
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
,
message
.
OptionalNestedEnum
);
Assert
.
True
(
message
.
HasOptionalNestedMessage
);
Assert
.
True
(
message
.
HasOptionalNestedMessage
);
Assert
.
AreEqual
(
0
,
message
.
OptionalNestedMessage
.
Value
);
Assert
.
AreEqual
(
0
,
message
.
OptionalNestedMessage
.
Value
);
}
}
...
...
csharp/src/ProtocolBuffers.Test/TestProtos/FieldPresense.cs
View file @
d1f5acaa
// Generated by the protocol buffer compiler. DO NOT EDIT!
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protos/google/protobuf/field_presence_test.proto
// source: protos/google/protobuf/field_presence_test.proto
#pragma warning disable 1591, 0612, 3021
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
#region Designer generated code
...
@@ -7,55 +7,51 @@ using pb = global::Google.ProtocolBuffers;
...
@@ -7,55 +7,51 @@ using pb = global::Google.ProtocolBuffers;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbc
=
global
::
Google
.
ProtocolBuffers
.
Collections
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
pbd
=
global
::
Google
.
ProtocolBuffers
.
Descriptors
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
namespace
field_presence_test
namespace
Google.ProtocolBuffers.TestProtos.FieldPresence
{
{
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
static
partial
class
FieldPresenceTest
public
static
partial
class
FieldPresenceTest
{
{
#
region
Extension
registration
#
region
Extension
registration
public
static
void
RegisterAllExtensions
(
pb
::
ExtensionRegistry
registry
)
public
static
void
RegisterAllExtensions
(
pb
::
ExtensionRegistry
registry
)
{
{
}
}
#
endregion
#
endregion
#
region
Static
variables
#
region
Static
variables
internal
static
pbd
::
MessageDescriptor
internal__static_field_presence_test_TestAllTypes__Descriptor
;
internal
static
pbd
::
MessageDescriptor
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__Descriptor
;
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
field_presence_test
.
TestAllTypes
,
global
::
field_presence_test
.
TestAllTypes
.
Builder
>
internal__static_field_presence_test_TestAllTypes__FieldAccessorTable
;
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Builder
>
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__FieldAccessorTable
;
internal
static
pbd
::
MessageDescriptor
internal__static_field_presence_test_TestAllTypes_NestedMessage__Descriptor
;
internal
static
pbd
::
MessageDescriptor
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__Descriptor
;
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
,
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
>
internal__static_field_presence_test_TestAllTypes_NestedMessage__FieldAccessorTable
;
internal
static
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
>
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__FieldAccessorTable
;
#
endregion
#
endregion
#
region
Descriptor
#
region
Descriptor
public
static
pbd
::
FileDescriptor
Descriptor
public
static
pbd
::
FileDescriptor
Descriptor
{
{
get
{
return
descriptor
;
}
get
{
return
descriptor
;
}
}
}
private
static
pbd
::
FileDescriptor
descriptor
;
private
static
pbd
::
FileDescriptor
descriptor
;
static
FieldPresenceTest
()
static
FieldPresenceTest
()
{
{
byte
[]
descriptorData
=
global
::
System
.
Convert
.
FromBase64String
(
byte
[]
descriptorData
=
global
::
System
.
Convert
.
FromBase64String
(
string
.
Concat
(
string
.
Concat
(
"CjBwcm90b3MvZ29vZ2xlL3Byb3RvYnVmL2ZpZWxkX3ByZXNlbmNlX3Rlc3Qu"
,
"CjBwcm90b3MvZ29vZ2xlL3Byb3RvYnVmL2ZpZWxkX3ByZXNlbmNlX3Rlc3Qu"
,
"cHJvdG8SE2ZpZWxkX3ByZXNlbmNlX3Rlc3QivgIKDFRlc3RBbGxUeXBlcxIW"
,
"cHJvdG8SL0dvb2dsZS5Qcm90b2NvbEJ1ZmZlcnMuVGVzdFByb3Rvcy5GaWVs"
,
"Cg5vcHRpb25hbF9pbnQzMhgBIAEoBRIXCg9vcHRpb25hbF9zdHJpbmcYAiAB"
,
"ZFByZXNlbmNlIvYCCgxUZXN0QWxsVHlwZXMSFgoOb3B0aW9uYWxfaW50MzIY"
,
"KAkSFgoOb3B0aW9uYWxfYnl0ZXMYAyABKAwSSgoUb3B0aW9uYWxfbmVzdGVk"
,
"ASABKAUSFwoPb3B0aW9uYWxfc3RyaW5nGAIgASgJEhYKDm9wdGlvbmFsX2J5"
,
"X2VudW0YBCABKA4yLC5maWVsZF9wcmVzZW5jZV90ZXN0LlRlc3RBbGxUeXBl"
,
"dGVzGAMgASgMEmYKFG9wdGlvbmFsX25lc3RlZF9lbnVtGAQgASgOMkguR29v"
,
"cy5OZXN0ZWRFbnVtElAKF29wdGlvbmFsX25lc3RlZF9tZXNzYWdlGAUgASgL"
,
"Z2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zLkZpZWxkUHJlc2VuY2Uu"
,
"Mi8uZmllbGRfcHJlc2VuY2VfdGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVz"
,
"VGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SbAoXb3B0aW9uYWxfbmVzdGVkX21l"
,
"c2FnZRoeCg1OZXN0ZWRNZXNzYWdlEg0KBXZhbHVlGAEgASgFIicKCk5lc3Rl"
,
"c3NhZ2UYBSABKAsySy5Hb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90"
,
"ZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAJCMAoTY29tLmdvb2ds"
,
"b3MuRmllbGRQcmVzZW5jZS5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZRoe"
,
"ZS5wcm90b2J1ZkIWRmllbGRQcmVzZW5jZVRlc3RQcm90b6ABAWIGcHJvdG8z"
));
"Cg1OZXN0ZWRNZXNzYWdlEg0KBXZhbHVlGAEgASgFIicKCk5lc3RlZEVudW0S"
,
pbd
::
FileDescriptor
.
InternalDescriptorAssigner
assigner
=
delegate
(
pbd
::
FileDescriptor
root
)
"BwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAJCMAoTY29tLmdvb2dsZS5wcm90"
,
{
"b2J1ZkIWRmllbGRQcmVzZW5jZVRlc3RQcm90b6ABAWIGcHJvdG8z"
));
pbd
::
FileDescriptor
.
InternalDescriptorAssigner
assigner
=
delegate
(
pbd
::
FileDescriptor
root
)
{
descriptor
=
root
;
descriptor
=
root
;
internal__static_field_presence_test_TestAllTypes__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal__static_field_presence_test_TestAllTypes__FieldAccessorTable
=
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
field_presence_test
.
TestAllTypes
,
global
::
field_presence_test
.
TestAllTypes
.
Builder
>(
internal__static_field_presence_test_TestAllTypes__Descriptor
,
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Builder
>(
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__Descriptor
,
new
string
[]
{
"OptionalInt32"
,
"OptionalString"
,
"OptionalBytes"
,
"OptionalNestedEnum"
,
"OptionalNestedMessage"
,
});
new
string
[]
{
"OptionalInt32"
,
"OptionalString"
,
"OptionalBytes"
,
"OptionalNestedEnum"
,
"OptionalNestedMessage"
,
});
internal__static_field_presence_test_TestAllTypes_NestedMessage__Descriptor
=
internal__static_field_presence_test_TestAllTypes__Descriptor
.
NestedTypes
[
0
];
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__Descriptor
=
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__Descriptor
.
NestedTypes
[
0
];
internal__static_field_presence_test_TestAllTypes_NestedMessage__FieldAccessorTable
=
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
,
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
>(
internal__static_field_presence_test_TestAllTypes_NestedMessage__Descriptor
,
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
>(
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__Descriptor
,
new
string
[]
{
"Value"
,
});
new
string
[]
{
"Value"
,
});
pb
::
ExtensionRegistry
registry
=
pb
::
ExtensionRegistry
.
CreateInstance
();
pb
::
ExtensionRegistry
registry
=
pb
::
ExtensionRegistry
.
CreateInstance
();
RegisterAllExtensions
(
registry
);
RegisterAllExtensions
(
registry
);
...
@@ -70,190 +66,153 @@ namespace field_presence_test
...
@@ -70,190 +66,153 @@ namespace field_presence_test
}
}
#
region
Messages
#
region
Messages
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
sealed
partial
class
TestAllTypes
:
pb
::
GeneratedMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>
public
sealed
partial
class
TestAllTypes
:
pb
::
GeneratedMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>
{
{
private
TestAllTypes
()
{
}
private
TestAllTypes
()
{
}
private
static
readonly
TestAllTypes
defaultInstance
=
new
TestAllTypes
().
MakeReadOnly
();
private
static
readonly
TestAllTypes
defaultInstance
=
new
TestAllTypes
().
MakeReadOnly
();
private
static
readonly
string
[]
_testAllTypesFieldNames
=
new
string
[]
{
"optional_bytes"
,
"optional_int32"
,
"optional_nested_enum"
,
"optional_nested_message"
,
"optional_string"
};
private
static
readonly
string
[]
_testAllTypesFieldNames
=
new
string
[]
{
"optional_bytes"
,
"optional_int32"
,
"optional_nested_enum"
,
"optional_nested_message"
,
"optional_string"
};
private
static
readonly
uint
[]
_testAllTypesFieldTags
=
new
uint
[]
{
26
,
8
,
32
,
42
,
18
};
private
static
readonly
uint
[]
_testAllTypesFieldTags
=
new
uint
[]
{
26
,
8
,
32
,
42
,
18
};
public
static
TestAllTypes
DefaultInstance
public
static
TestAllTypes
DefaultInstance
{
{
get
{
return
defaultInstance
;
}
get
{
return
defaultInstance
;
}
}
}
public
override
TestAllTypes
DefaultInstanceForType
public
override
TestAllTypes
DefaultInstanceForType
{
{
get
{
return
DefaultInstance
;
}
get
{
return
DefaultInstance
;
}
}
}
protected
override
TestAllTypes
ThisMessage
protected
override
TestAllTypes
ThisMessage
{
{
get
{
return
this
;
}
get
{
return
this
;
}
}
}
public
static
pbd
::
MessageDescriptor
Descriptor
public
static
pbd
::
MessageDescriptor
Descriptor
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__Descriptor
;
}
get
{
return
global
::
field_presence_test
.
FieldPresenceTest
.
internal__static_field_presence_test_TestAllTypes__Descriptor
;
}
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
TestAllTypes
,
TestAllTypes
.
Builder
>
InternalFieldAccessors
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
TestAllTypes
,
TestAllTypes
.
Builder
>
InternalFieldAccessors
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes__FieldAccessorTable
;
}
get
{
return
global
::
field_presence_test
.
FieldPresenceTest
.
internal__static_field_presence_test_TestAllTypes__FieldAccessorTable
;
}
}
}
#
region
Nested
types
#
region
Nested
types
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
static
partial
class
Types
public
static
partial
class
Types
{
{
public
enum
NestedEnum
{
public
enum
NestedEnum
{
FOO
=
0
,
FOO
=
0
,
BAR
=
1
,
BAR
=
1
,
BAZ
=
2
,
BAZ
=
2
,
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
sealed
partial
class
NestedMessage
:
pb
::
GeneratedMessage
<
NestedMessage
,
NestedMessage
.
Builder
>
public
sealed
partial
class
NestedMessage
:
pb
::
GeneratedMessage
<
NestedMessage
,
NestedMessage
.
Builder
>
{
{
private
NestedMessage
()
{
}
private
NestedMessage
()
{
}
private
static
readonly
NestedMessage
defaultInstance
=
new
NestedMessage
().
MakeReadOnly
();
private
static
readonly
NestedMessage
defaultInstance
=
new
NestedMessage
().
MakeReadOnly
();
private
static
readonly
string
[]
_nestedMessageFieldNames
=
new
string
[]
{
"value"
};
private
static
readonly
string
[]
_nestedMessageFieldNames
=
new
string
[]
{
"value"
};
private
static
readonly
uint
[]
_nestedMessageFieldTags
=
new
uint
[]
{
8
};
private
static
readonly
uint
[]
_nestedMessageFieldTags
=
new
uint
[]
{
8
};
public
static
NestedMessage
DefaultInstance
public
static
NestedMessage
DefaultInstance
{
{
get
{
return
defaultInstance
;
}
get
{
return
defaultInstance
;
}
}
}
public
override
NestedMessage
DefaultInstanceForType
public
override
NestedMessage
DefaultInstanceForType
{
{
get
{
return
DefaultInstance
;
}
get
{
return
DefaultInstance
;
}
}
}
protected
override
NestedMessage
ThisMessage
protected
override
NestedMessage
ThisMessage
{
{
get
{
return
this
;
}
get
{
return
this
;
}
}
}
public
static
pbd
::
MessageDescriptor
Descriptor
public
static
pbd
::
MessageDescriptor
Descriptor
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__Descriptor
;
}
get
{
return
global
::
field_presence_test
.
FieldPresenceTest
.
internal__static_field_presence_test_TestAllTypes_NestedMessage__Descriptor
;
}
}
}
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
NestedMessage
,
NestedMessage
.
Builder
>
InternalFieldAccessors
protected
override
pb
::
FieldAccess
.
FieldAccessorTable
<
NestedMessage
,
NestedMessage
.
Builder
>
InternalFieldAccessors
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
internal__static_Google_ProtocolBuffers_TestProtos_FieldPresence_TestAllTypes_NestedMessage__FieldAccessorTable
;
}
get
{
return
global
::
field_presence_test
.
FieldPresenceTest
.
internal__static_field_presence_test_TestAllTypes_NestedMessage__FieldAccessorTable
;
}
}
}
public
const
int
ValueFieldNumber
=
1
;
public
const
int
ValueFieldNumber
=
1
;
private
int
value_
;
private
int
value_
;
public
int
Value
public
int
Value
{
{
get
{
return
value_
;
}
get
{
return
value_
;
}
}
}
public
override
void
WriteTo
(
pb
::
ICodedOutputStream
output
)
public
override
void
WriteTo
(
pb
::
ICodedOutputStream
output
)
{
{
CalcSerializedSize
();
CalcSerializedSize
();
string
[]
field_names
=
_nestedMessageFieldNames
;
string
[]
field_names
=
_nestedMessageFieldNames
;
if
(
Value
!=
0
)
if
(
Value
!=
0
)
{
{
output
.
WriteInt32
(
1
,
field_names
[
0
],
Value
);
output
.
WriteInt32
(
1
,
field_names
[
0
],
Value
);
}
}
UnknownFields
.
WriteTo
(
output
);
UnknownFields
.
WriteTo
(
output
);
}
}
private
int
memoizedSerializedSize
=
-
1
;
private
int
memoizedSerializedSize
=
-
1
;
public
override
int
SerializedSize
public
override
int
SerializedSize
{
{
get
{
get
{
int
size
=
memoizedSerializedSize
;
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
if
(
size
!=
-
1
)
return
size
;
return
CalcSerializedSize
();
return
CalcSerializedSize
();
}
}
}
}
private
int
CalcSerializedSize
()
private
int
CalcSerializedSize
()
{
{
int
size
=
memoizedSerializedSize
;
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
if
(
size
!=
-
1
)
return
size
;
size
=
0
;
size
=
0
;
if
(
Value
!=
0
)
if
(
Value
!=
0
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeInt32Size
(
1
,
Value
);
size
+=
pb
::
CodedOutputStream
.
ComputeInt32Size
(
1
,
Value
);
}
}
size
+=
UnknownFields
.
SerializedSize
;
size
+=
UnknownFields
.
SerializedSize
;
memoizedSerializedSize
=
size
;
memoizedSerializedSize
=
size
;
return
size
;
return
size
;
}
}
public
static
NestedMessage
ParseFrom
(
pb
::
ByteString
data
)
public
static
NestedMessage
ParseFrom
(
pb
::
ByteString
data
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
NestedMessage
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
byte
[]
data
)
public
static
NestedMessage
ParseFrom
(
byte
[]
data
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
NestedMessage
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
public
static
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
NestedMessage
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
)
public
static
NestedMessage
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
)
{
{
return
CreateBuilder
().
MergeDelimitedFrom
(
input
).
BuildParsed
();
return
CreateBuilder
().
MergeDelimitedFrom
(
input
).
BuildParsed
();
}
}
public
static
NestedMessage
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
NestedMessage
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
CreateBuilder
().
MergeDelimitedFrom
(
input
,
extensionRegistry
).
BuildParsed
();
return
CreateBuilder
().
MergeDelimitedFrom
(
input
,
extensionRegistry
).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
pb
::
ICodedInputStream
input
)
public
static
NestedMessage
ParseFrom
(
pb
::
ICodedInputStream
input
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
}
public
static
NestedMessage
ParseFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
NestedMessage
ParseFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
}
private
NestedMessage
MakeReadOnly
()
private
NestedMessage
MakeReadOnly
()
{
{
return
this
;
return
this
;
}
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
NestedMessage
prototype
)
public
static
Builder
CreateBuilder
(
NestedMessage
prototype
)
{
{
return
new
Builder
(
prototype
);
return
new
Builder
(
prototype
);
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
NestedMessage
,
Builder
>
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
NestedMessage
,
Builder
>
{
{
protected
override
Builder
ThisBuilder
{
protected
override
Builder
ThisBuilder
{
get
{
return
this
;
}
get
{
return
this
;
}
}
}
public
Builder
()
public
Builder
()
{
{
result
=
DefaultInstance
;
result
=
DefaultInstance
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
}
}
internal
Builder
(
NestedMessage
cloneFrom
)
internal
Builder
(
NestedMessage
cloneFrom
)
{
{
result
=
cloneFrom
;
result
=
cloneFrom
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
}
}
...
@@ -261,10 +220,8 @@ namespace field_presence_test
...
@@ -261,10 +220,8 @@ namespace field_presence_test
private
bool
resultIsReadOnly
;
private
bool
resultIsReadOnly
;
private
NestedMessage
result
;
private
NestedMessage
result
;
private
NestedMessage
PrepareBuilder
()
private
NestedMessage
PrepareBuilder
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
NestedMessage
original
=
result
;
NestedMessage
original
=
result
;
result
=
new
NestedMessage
();
result
=
new
NestedMessage
();
resultIsReadOnly
=
false
;
resultIsReadOnly
=
false
;
...
@@ -273,168 +230,133 @@ namespace field_presence_test
...
@@ -273,168 +230,133 @@ namespace field_presence_test
return
result
;
return
result
;
}
}
public
override
bool
IsInitialized
public
override
bool
IsInitialized
{
{
get
{
return
result
.
IsInitialized
;
}
get
{
return
result
.
IsInitialized
;
}
}
}
protected
override
NestedMessage
MessageBeingBuilt
protected
override
NestedMessage
MessageBeingBuilt
{
{
get
{
return
PrepareBuilder
();
}
get
{
return
PrepareBuilder
();
}
}
}
public
override
Builder
Clear
()
public
override
Builder
Clear
()
{
{
result
=
DefaultInstance
;
result
=
DefaultInstance
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
return
this
;
return
this
;
}
}
public
override
Builder
Clone
()
public
override
Builder
Clone
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
return
new
Builder
(
result
);
return
new
Builder
(
result
);
}
}
else
{
else
{
return
new
Builder
().
MergeFrom
(
result
);
return
new
Builder
().
MergeFrom
(
result
);
}
}
}
}
public
override
pbd
::
MessageDescriptor
DescriptorForType
public
override
pbd
::
MessageDescriptor
DescriptorForType
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
Descriptor
;
}
get
{
return
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
Descriptor
;
}
}
}
public
override
NestedMessage
DefaultInstanceForType
public
override
NestedMessage
DefaultInstanceForType
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
;
}
get
{
return
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
;
}
}
}
public
override
NestedMessage
BuildPartial
()
public
override
NestedMessage
BuildPartial
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
return
result
;
return
result
;
}
}
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
return
result
.
MakeReadOnly
();
return
result
.
MakeReadOnly
();
}
}
public
override
Builder
MergeFrom
(
pb
::
IMessage
other
)
public
override
Builder
MergeFrom
(
pb
::
IMessage
other
)
{
{
if
(
other
is
NestedMessage
)
{
if
(
other
is
NestedMessage
)
return
MergeFrom
((
NestedMessage
)
other
);
{
}
else
{
return
MergeFrom
((
NestedMessage
)
other
);
}
else
{
base
.
MergeFrom
(
other
);
base
.
MergeFrom
(
other
);
return
this
;
return
this
;
}
}
}
}
public
override
Builder
MergeFrom
(
NestedMessage
other
)
public
override
Builder
MergeFrom
(
NestedMessage
other
)
{
{
if
(
other
==
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
)
return
this
;
if
(
other
==
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
)
return
this
;
PrepareBuilder
();
PrepareBuilder
();
if
(
other
.
Value
!=
0
)
if
(
other
.
Value
!=
0
)
{
{
Value
=
other
.
Value
;
Value
=
other
.
Value
;
}
}
this
.
MergeUnknownFields
(
other
.
UnknownFields
);
this
.
MergeUnknownFields
(
other
.
UnknownFields
);
return
this
;
return
this
;
}
}
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
)
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
)
{
{
return
MergeFrom
(
input
,
pb
::
ExtensionRegistry
.
Empty
);
return
MergeFrom
(
input
,
pb
::
ExtensionRegistry
.
Empty
);
}
}
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
PrepareBuilder
();
PrepareBuilder
();
pb
::
UnknownFieldSet
.
Builder
unknownFields
=
null
;
pb
::
UnknownFieldSet
.
Builder
unknownFields
=
null
;
uint
tag
;
uint
tag
;
string
field_name
;
string
field_name
;
while
(
input
.
ReadTag
(
out
tag
,
out
field_name
))
while
(
input
.
ReadTag
(
out
tag
,
out
field_name
))
{
{
if
(
tag
==
0
&&
field_name
!=
null
)
{
if
(
tag
==
0
&&
field_name
!=
null
)
{
int
field_ordinal
=
global
::
System
.
Array
.
BinarySearch
(
_nestedMessageFieldNames
,
field_name
,
global
::
System
.
StringComparer
.
Ordinal
);
int
field_ordinal
=
global
::
System
.
Array
.
BinarySearch
(
_nestedMessageFieldNames
,
field_name
,
global
::
System
.
StringComparer
.
Ordinal
);
if
(
field_ordinal
>=
0
)
if
(
field_ordinal
>=
0
)
tag
=
_nestedMessageFieldTags
[
field_ordinal
];
tag
=
_nestedMessageFieldTags
[
field_ordinal
];
else
else
{
{
if
(
unknownFields
==
null
)
{
if
(
unknownFields
==
null
)
{
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
}
}
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
continue
;
continue
;
}
}
}
}
switch
(
tag
)
switch
(
tag
)
{
{
case
0
:
{
case
0
:
{
throw
pb
::
InvalidProtocolBufferException
.
InvalidTag
();
throw
pb
::
InvalidProtocolBufferException
.
InvalidTag
();
}
}
default
:
default
:
{
{
if
(
pb
::
WireFormat
.
IsEndGroupTag
(
tag
))
{
if
(
pb
::
WireFormat
.
IsEndGroupTag
(
tag
))
if
(
unknownFields
!=
null
)
{
{
if
(
unknownFields
!=
null
)
{
this
.
UnknownFields
=
unknownFields
.
Build
();
this
.
UnknownFields
=
unknownFields
.
Build
();
}
}
return
this
;
return
this
;
}
}
if
(
unknownFields
==
null
)
if
(
unknownFields
==
null
)
{
{
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
}
}
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
break
;
break
;
}
}
case
8
:
case
8
:
{
{
input
.
ReadInt32
(
ref
result
.
value_
);
input
.
ReadInt32
(
ref
result
.
value_
);
break
;
break
;
}
}
}
}
}
}
if
(
unknownFields
!=
null
)
if
(
unknownFields
!=
null
)
{
{
this
.
UnknownFields
=
unknownFields
.
Build
();
this
.
UnknownFields
=
unknownFields
.
Build
();
}
}
return
this
;
return
this
;
}
}
public
int
Value
public
int
Value
{
{
get
{
return
result
.
Value
;
}
get
{
return
result
.
Value
;
}
set
{
SetValue
(
value
);
}
set
{
SetValue
(
value
);
}
}
}
public
Builder
SetValue
(
int
value
)
public
Builder
SetValue
(
int
value
)
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
value_
=
value
;
result
.
value_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
ClearValue
()
public
Builder
ClearValue
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
value_
=
0
;
result
.
value_
=
0
;
return
this
;
return
this
;
}
}
}
}
static
NestedMessage
()
static
NestedMessage
()
{
{
object
.
ReferenceEquals
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
Descriptor
,
null
);
object
.
ReferenceEquals
(
global
::
field_presence_test
.
FieldPresenceTest
.
Descriptor
,
null
);
}
}
}
}
...
@@ -443,179 +365,143 @@ namespace field_presence_test
...
@@ -443,179 +365,143 @@ namespace field_presence_test
public
const
int
OptionalInt32FieldNumber
=
1
;
public
const
int
OptionalInt32FieldNumber
=
1
;
private
int
optionalInt32_
;
private
int
optionalInt32_
;
public
int
OptionalInt32
public
int
OptionalInt32
{
{
get
{
return
optionalInt32_
;
}
get
{
return
optionalInt32_
;
}
}
}
public
const
int
OptionalStringFieldNumber
=
2
;
public
const
int
OptionalStringFieldNumber
=
2
;
private
string
optionalString_
=
""
;
private
string
optionalString_
=
""
;
public
string
OptionalString
public
string
OptionalString
{
{
get
{
return
optionalString_
;
}
get
{
return
optionalString_
;
}
}
}
public
const
int
OptionalBytesFieldNumber
=
3
;
public
const
int
OptionalBytesFieldNumber
=
3
;
private
pb
::
ByteString
optionalBytes_
=
pb
::
ByteString
.
Empty
;
private
pb
::
ByteString
optionalBytes_
=
pb
::
ByteString
.
Empty
;
public
pb
::
ByteString
OptionalBytes
public
pb
::
ByteString
OptionalBytes
{
{
get
{
return
optionalBytes_
;
}
get
{
return
optionalBytes_
;
}
}
}
public
const
int
OptionalNestedEnumFieldNumber
=
4
;
public
const
int
OptionalNestedEnumFieldNumber
=
4
;
private
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
optionalNestedEnum_
=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
;
private
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
optionalNestedEnum_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
;
public
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
OptionalNestedEnum
public
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
OptionalNestedEnum
{
{
get
{
return
optionalNestedEnum_
;
}
get
{
return
optionalNestedEnum_
;
}
}
}
public
const
int
OptionalNestedMessageFieldNumber
=
5
;
public
const
int
OptionalNestedMessageFieldNumber
=
5
;
private
bool
hasOptionalNestedMessage
;
private
bool
hasOptionalNestedMessage
;
private
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
optionalNestedMessage_
;
private
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
optionalNestedMessage_
;
public
bool
HasOptionalNestedMessage
public
bool
HasOptionalNestedMessage
{
{
get
{
return
hasOptionalNestedMessage
;
}
get
{
return
hasOptionalNestedMessage
;
}
}
}
public
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
OptionalNestedMessage
public
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
OptionalNestedMessage
{
{
get
{
return
optionalNestedMessage_
??
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
;
}
get
{
return
optionalNestedMessage_
??
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
;
}
}
}
public
override
void
WriteTo
(
pb
::
ICodedOutputStream
output
)
public
override
void
WriteTo
(
pb
::
ICodedOutputStream
output
)
{
{
CalcSerializedSize
();
CalcSerializedSize
();
string
[]
field_names
=
_testAllTypesFieldNames
;
string
[]
field_names
=
_testAllTypesFieldNames
;
if
(
OptionalInt32
!=
0
)
if
(
OptionalInt32
!=
0
)
{
{
output
.
WriteInt32
(
1
,
field_names
[
1
],
OptionalInt32
);
output
.
WriteInt32
(
1
,
field_names
[
1
],
OptionalInt32
);
}
}
if
(
OptionalString
!=
""
)
if
(
OptionalString
!=
""
)
{
{
output
.
WriteString
(
2
,
field_names
[
4
],
OptionalString
);
output
.
WriteString
(
2
,
field_names
[
4
],
OptionalString
);
}
}
if
(
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
if
(
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
{
{
output
.
WriteBytes
(
3
,
field_names
[
0
],
OptionalBytes
);
output
.
WriteBytes
(
3
,
field_names
[
0
],
OptionalBytes
);
}
}
if
(
OptionalNestedEnum
!=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
if
(
OptionalNestedEnum
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
{
{
output
.
WriteEnum
(
4
,
field_names
[
2
],
(
int
)
OptionalNestedEnum
,
OptionalNestedEnum
);
output
.
WriteEnum
(
4
,
field_names
[
2
],
(
int
)
OptionalNestedEnum
,
OptionalNestedEnum
);
}
}
if
(
hasOptionalNestedMessage
)
if
(
hasOptionalNestedMessage
)
{
{
output
.
WriteMessage
(
5
,
field_names
[
3
],
OptionalNestedMessage
);
output
.
WriteMessage
(
5
,
field_names
[
3
],
OptionalNestedMessage
);
}
}
UnknownFields
.
WriteTo
(
output
);
UnknownFields
.
WriteTo
(
output
);
}
}
private
int
memoizedSerializedSize
=
-
1
;
private
int
memoizedSerializedSize
=
-
1
;
public
override
int
SerializedSize
public
override
int
SerializedSize
{
{
get
{
get
{
int
size
=
memoizedSerializedSize
;
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
if
(
size
!=
-
1
)
return
size
;
return
CalcSerializedSize
();
return
CalcSerializedSize
();
}
}
}
}
private
int
CalcSerializedSize
()
private
int
CalcSerializedSize
()
{
{
int
size
=
memoizedSerializedSize
;
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
if
(
size
!=
-
1
)
return
size
;
size
=
0
;
size
=
0
;
if
(
OptionalInt32
!=
0
)
if
(
OptionalInt32
!=
0
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeInt32Size
(
1
,
OptionalInt32
);
size
+=
pb
::
CodedOutputStream
.
ComputeInt32Size
(
1
,
OptionalInt32
);
}
}
if
(
OptionalString
!=
""
)
if
(
OptionalString
!=
""
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeStringSize
(
2
,
OptionalString
);
size
+=
pb
::
CodedOutputStream
.
ComputeStringSize
(
2
,
OptionalString
);
}
}
if
(
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
if
(
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeBytesSize
(
3
,
OptionalBytes
);
size
+=
pb
::
CodedOutputStream
.
ComputeBytesSize
(
3
,
OptionalBytes
);
}
}
if
(
OptionalNestedEnum
!=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
if
(
OptionalNestedEnum
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeEnumSize
(
4
,
(
int
)
OptionalNestedEnum
);
size
+=
pb
::
CodedOutputStream
.
ComputeEnumSize
(
4
,
(
int
)
OptionalNestedEnum
);
}
}
if
(
hasOptionalNestedMessage
)
if
(
hasOptionalNestedMessage
)
{
{
size
+=
pb
::
CodedOutputStream
.
ComputeMessageSize
(
5
,
OptionalNestedMessage
);
size
+=
pb
::
CodedOutputStream
.
ComputeMessageSize
(
5
,
OptionalNestedMessage
);
}
}
size
+=
UnknownFields
.
SerializedSize
;
size
+=
UnknownFields
.
SerializedSize
;
memoizedSerializedSize
=
size
;
memoizedSerializedSize
=
size
;
return
size
;
return
size
;
}
}
public
static
TestAllTypes
ParseFrom
(
pb
::
ByteString
data
)
public
static
TestAllTypes
ParseFrom
(
pb
::
ByteString
data
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
TestAllTypes
ParseFrom
(
pb
::
ByteString
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
byte
[]
data
)
public
static
TestAllTypes
ParseFrom
(
byte
[]
data
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
TestAllTypes
ParseFrom
(
byte
[]
data
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
data
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
public
static
TestAllTypes
ParseFrom
(
global
::
System
.
IO
.
Stream
input
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
TestAllTypes
ParseFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
)
public
static
TestAllTypes
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
)
{
{
return
CreateBuilder
().
MergeDelimitedFrom
(
input
).
BuildParsed
();
return
CreateBuilder
().
MergeDelimitedFrom
(
input
).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
TestAllTypes
ParseDelimitedFrom
(
global
::
System
.
IO
.
Stream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
CreateBuilder
().
MergeDelimitedFrom
(
input
,
extensionRegistry
).
BuildParsed
();
return
CreateBuilder
().
MergeDelimitedFrom
(
input
,
extensionRegistry
).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
pb
::
ICodedInputStream
input
)
public
static
TestAllTypes
ParseFrom
(
pb
::
ICodedInputStream
input
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
)).
BuildParsed
();
}
}
public
static
TestAllTypes
ParseFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
static
TestAllTypes
ParseFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
return
((
Builder
)
CreateBuilder
().
MergeFrom
(
input
,
extensionRegistry
)).
BuildParsed
();
}
}
private
TestAllTypes
MakeReadOnly
()
private
TestAllTypes
MakeReadOnly
()
{
{
return
this
;
return
this
;
}
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
()
{
return
new
Builder
();
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
ToBuilder
()
{
return
CreateBuilder
(
this
);
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
override
Builder
CreateBuilderForType
()
{
return
new
Builder
();
}
public
static
Builder
CreateBuilder
(
TestAllTypes
prototype
)
public
static
Builder
CreateBuilder
(
TestAllTypes
prototype
)
{
{
return
new
Builder
(
prototype
);
return
new
Builder
(
prototype
);
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
TestAllTypes
,
Builder
>
public
sealed
partial
class
Builder
:
pb
::
GeneratedBuilder
<
TestAllTypes
,
Builder
>
{
{
protected
override
Builder
ThisBuilder
{
protected
override
Builder
ThisBuilder
{
get
{
return
this
;
}
get
{
return
this
;
}
}
}
public
Builder
()
public
Builder
()
{
{
result
=
DefaultInstance
;
result
=
DefaultInstance
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
}
}
internal
Builder
(
TestAllTypes
cloneFrom
)
internal
Builder
(
TestAllTypes
cloneFrom
)
{
{
result
=
cloneFrom
;
result
=
cloneFrom
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
}
}
...
@@ -623,10 +509,8 @@ namespace field_presence_test
...
@@ -623,10 +509,8 @@ namespace field_presence_test
private
bool
resultIsReadOnly
;
private
bool
resultIsReadOnly
;
private
TestAllTypes
result
;
private
TestAllTypes
result
;
private
TestAllTypes
PrepareBuilder
()
private
TestAllTypes
PrepareBuilder
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
TestAllTypes
original
=
result
;
TestAllTypes
original
=
result
;
result
=
new
TestAllTypes
();
result
=
new
TestAllTypes
();
resultIsReadOnly
=
false
;
resultIsReadOnly
=
false
;
...
@@ -635,183 +519,140 @@ namespace field_presence_test
...
@@ -635,183 +519,140 @@ namespace field_presence_test
return
result
;
return
result
;
}
}
public
override
bool
IsInitialized
public
override
bool
IsInitialized
{
{
get
{
return
result
.
IsInitialized
;
}
get
{
return
result
.
IsInitialized
;
}
}
}
protected
override
TestAllTypes
MessageBeingBuilt
protected
override
TestAllTypes
MessageBeingBuilt
{
{
get
{
return
PrepareBuilder
();
}
get
{
return
PrepareBuilder
();
}
}
}
public
override
Builder
Clear
()
public
override
Builder
Clear
()
{
{
result
=
DefaultInstance
;
result
=
DefaultInstance
;
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
return
this
;
return
this
;
}
}
public
override
Builder
Clone
()
public
override
Builder
Clone
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
return
new
Builder
(
result
);
return
new
Builder
(
result
);
}
}
else
{
else
{
return
new
Builder
().
MergeFrom
(
result
);
return
new
Builder
().
MergeFrom
(
result
);
}
}
}
}
public
override
pbd
::
MessageDescriptor
DescriptorForType
public
override
pbd
::
MessageDescriptor
DescriptorForType
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Descriptor
;
}
get
{
return
global
::
field_presence_test
.
TestAllTypes
.
Descriptor
;
}
}
}
public
override
TestAllTypes
DefaultInstanceForType
public
override
TestAllTypes
DefaultInstanceForType
{
{
get
{
return
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
DefaultInstance
;
}
get
{
return
global
::
field_presence_test
.
TestAllTypes
.
DefaultInstance
;
}
}
}
public
override
TestAllTypes
BuildPartial
()
public
override
TestAllTypes
BuildPartial
()
{
{
if
(
resultIsReadOnly
)
{
if
(
resultIsReadOnly
)
{
return
result
;
return
result
;
}
}
resultIsReadOnly
=
true
;
resultIsReadOnly
=
true
;
return
result
.
MakeReadOnly
();
return
result
.
MakeReadOnly
();
}
}
public
override
Builder
MergeFrom
(
pb
::
IMessage
other
)
public
override
Builder
MergeFrom
(
pb
::
IMessage
other
)
{
{
if
(
other
is
TestAllTypes
)
{
if
(
other
is
TestAllTypes
)
return
MergeFrom
((
TestAllTypes
)
other
);
{
}
else
{
return
MergeFrom
((
TestAllTypes
)
other
);
}
else
{
base
.
MergeFrom
(
other
);
base
.
MergeFrom
(
other
);
return
this
;
return
this
;
}
}
}
}
public
override
Builder
MergeFrom
(
TestAllTypes
other
)
public
override
Builder
MergeFrom
(
TestAllTypes
other
)
{
{
if
(
other
==
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
DefaultInstance
)
return
this
;
if
(
other
==
global
::
field_presence_test
.
TestAllTypes
.
DefaultInstance
)
return
this
;
PrepareBuilder
();
PrepareBuilder
();
if
(
other
.
OptionalInt32
!=
0
)
if
(
other
.
OptionalInt32
!=
0
)
{
{
OptionalInt32
=
other
.
OptionalInt32
;
OptionalInt32
=
other
.
OptionalInt32
;
}
}
if
(
other
.
OptionalString
!=
""
)
if
(
other
.
OptionalString
!=
""
)
{
{
OptionalString
=
other
.
OptionalString
;
OptionalString
=
other
.
OptionalString
;
}
}
if
(
other
.
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
if
(
other
.
OptionalBytes
!=
pb
::
ByteString
.
Empty
)
{
{
OptionalBytes
=
other
.
OptionalBytes
;
OptionalBytes
=
other
.
OptionalBytes
;
}
}
if
(
other
.
OptionalNestedEnum
!=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
if
(
other
.
OptionalNestedEnum
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
)
{
{
OptionalNestedEnum
=
other
.
OptionalNestedEnum
;
OptionalNestedEnum
=
other
.
OptionalNestedEnum
;
}
}
if
(
other
.
HasOptionalNestedMessage
)
if
(
other
.
HasOptionalNestedMessage
)
{
{
MergeOptionalNestedMessage
(
other
.
OptionalNestedMessage
);
MergeOptionalNestedMessage
(
other
.
OptionalNestedMessage
);
}
}
this
.
MergeUnknownFields
(
other
.
UnknownFields
);
this
.
MergeUnknownFields
(
other
.
UnknownFields
);
return
this
;
return
this
;
}
}
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
)
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
)
{
{
return
MergeFrom
(
input
,
pb
::
ExtensionRegistry
.
Empty
);
return
MergeFrom
(
input
,
pb
::
ExtensionRegistry
.
Empty
);
}
}
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
public
override
Builder
MergeFrom
(
pb
::
ICodedInputStream
input
,
pb
::
ExtensionRegistry
extensionRegistry
)
{
{
PrepareBuilder
();
PrepareBuilder
();
pb
::
UnknownFieldSet
.
Builder
unknownFields
=
null
;
pb
::
UnknownFieldSet
.
Builder
unknownFields
=
null
;
uint
tag
;
uint
tag
;
string
field_name
;
string
field_name
;
while
(
input
.
ReadTag
(
out
tag
,
out
field_name
))
while
(
input
.
ReadTag
(
out
tag
,
out
field_name
))
{
{
if
(
tag
==
0
&&
field_name
!=
null
)
{
if
(
tag
==
0
&&
field_name
!=
null
)
{
int
field_ordinal
=
global
::
System
.
Array
.
BinarySearch
(
_testAllTypesFieldNames
,
field_name
,
global
::
System
.
StringComparer
.
Ordinal
);
int
field_ordinal
=
global
::
System
.
Array
.
BinarySearch
(
_testAllTypesFieldNames
,
field_name
,
global
::
System
.
StringComparer
.
Ordinal
);
if
(
field_ordinal
>=
0
)
if
(
field_ordinal
>=
0
)
tag
=
_testAllTypesFieldTags
[
field_ordinal
];
tag
=
_testAllTypesFieldTags
[
field_ordinal
];
else
else
{
{
if
(
unknownFields
==
null
)
{
if
(
unknownFields
==
null
)
{
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
}
}
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
continue
;
continue
;
}
}
}
}
switch
(
tag
)
switch
(
tag
)
{
{
case
0
:
{
case
0
:
{
throw
pb
::
InvalidProtocolBufferException
.
InvalidTag
();
throw
pb
::
InvalidProtocolBufferException
.
InvalidTag
();
}
}
default
:
default
:
{
{
if
(
pb
::
WireFormat
.
IsEndGroupTag
(
tag
))
{
if
(
pb
::
WireFormat
.
IsEndGroupTag
(
tag
))
if
(
unknownFields
!=
null
)
{
{
if
(
unknownFields
!=
null
)
{
this
.
UnknownFields
=
unknownFields
.
Build
();
this
.
UnknownFields
=
unknownFields
.
Build
();
}
}
return
this
;
return
this
;
}
}
if
(
unknownFields
==
null
)
if
(
unknownFields
==
null
)
{
{
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
}
}
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
ParseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
,
field_name
);
break
;
break
;
}
}
case
8
:
case
8
:
{
{
input
.
ReadInt32
(
ref
result
.
optionalInt32_
);
input
.
ReadInt32
(
ref
result
.
optionalInt32_
);
break
;
break
;
}
}
case
18
:
case
18
:
{
{
input
.
ReadString
(
ref
result
.
optionalString_
);
input
.
ReadString
(
ref
result
.
optionalString_
);
break
;
break
;
}
}
case
26
:
case
26
:
{
{
input
.
ReadBytes
(
ref
result
.
optionalBytes_
);
input
.
ReadBytes
(
ref
result
.
optionalBytes_
);
break
;
break
;
}
}
case
32
:
case
32
:
{
{
object
unknown
;
object
unknown
;
if
(
input
.
ReadEnum
(
ref
result
.
optionalNestedEnum_
,
out
unknown
))
if
(
input
.
ReadEnum
(
ref
result
.
optionalNestedEnum_
,
out
unknown
))
{
{
}
else
if
(
unknown
is
int
)
{
}
if
(
unknownFields
==
null
)
{
else
if
(
unknown
is
int
)
{
if
(
unknownFields
==
null
)
{
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
unknownFields
=
pb
::
UnknownFieldSet
.
CreateBuilder
(
this
.
UnknownFields
);
}
}
unknownFields
.
MergeVarintField
(
4
,
(
ulong
)(
int
)
unknown
);
unknownFields
.
MergeVarintField
(
4
,
(
ulong
)(
int
)
unknown
);
}
}
break
;
break
;
}
}
case
42
:
case
42
:
{
{
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
subBuilder
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
CreateBuilder
();
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
subBuilder
=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
CreateBuilder
();
if
(
result
.
hasOptionalNestedMessage
)
{
if
(
result
.
hasOptionalNestedMessage
)
{
subBuilder
.
MergeFrom
(
OptionalNestedMessage
);
subBuilder
.
MergeFrom
(
OptionalNestedMessage
);
}
}
input
.
ReadMessage
(
subBuilder
,
extensionRegistry
);
input
.
ReadMessage
(
subBuilder
,
extensionRegistry
);
...
@@ -821,140 +662,117 @@ namespace field_presence_test
...
@@ -821,140 +662,117 @@ namespace field_presence_test
}
}
}
}
if
(
unknownFields
!=
null
)
if
(
unknownFields
!=
null
)
{
{
this
.
UnknownFields
=
unknownFields
.
Build
();
this
.
UnknownFields
=
unknownFields
.
Build
();
}
}
return
this
;
return
this
;
}
}
public
int
OptionalInt32
public
int
OptionalInt32
{
{
get
{
return
result
.
OptionalInt32
;
}
get
{
return
result
.
OptionalInt32
;
}
set
{
SetOptionalInt32
(
value
);
}
set
{
SetOptionalInt32
(
value
);
}
}
}
public
Builder
SetOptionalInt32
(
int
value
)
public
Builder
SetOptionalInt32
(
int
value
)
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalInt32_
=
value
;
result
.
optionalInt32_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
ClearOptionalInt32
()
public
Builder
ClearOptionalInt32
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalInt32_
=
0
;
result
.
optionalInt32_
=
0
;
return
this
;
return
this
;
}
}
public
string
OptionalString
public
string
OptionalString
{
{
get
{
return
result
.
OptionalString
;
}
get
{
return
result
.
OptionalString
;
}
set
{
SetOptionalString
(
value
);
}
set
{
SetOptionalString
(
value
);
}
}
}
public
Builder
SetOptionalString
(
string
value
)
public
Builder
SetOptionalString
(
string
value
)
{
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalString_
=
value
;
result
.
optionalString_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
ClearOptionalString
()
public
Builder
ClearOptionalString
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalString_
=
""
;
result
.
optionalString_
=
""
;
return
this
;
return
this
;
}
}
public
pb
::
ByteString
OptionalBytes
public
pb
::
ByteString
OptionalBytes
{
{
get
{
return
result
.
OptionalBytes
;
}
get
{
return
result
.
OptionalBytes
;
}
set
{
SetOptionalBytes
(
value
);
}
set
{
SetOptionalBytes
(
value
);
}
}
}
public
Builder
SetOptionalBytes
(
pb
::
ByteString
value
)
public
Builder
SetOptionalBytes
(
pb
::
ByteString
value
)
{
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalBytes_
=
value
;
result
.
optionalBytes_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
ClearOptionalBytes
()
public
Builder
ClearOptionalBytes
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalBytes_
=
pb
::
ByteString
.
Empty
;
result
.
optionalBytes_
=
pb
::
ByteString
.
Empty
;
return
this
;
return
this
;
}
}
public
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
OptionalNestedEnum
public
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
OptionalNestedEnum
{
{
get
{
return
result
.
OptionalNestedEnum
;
}
get
{
return
result
.
OptionalNestedEnum
;
}
set
{
SetOptionalNestedEnum
(
value
);
}
set
{
SetOptionalNestedEnum
(
value
);
}
}
}
public
Builder
SetOptionalNestedEnum
(
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
value
)
public
Builder
SetOptionalNestedEnum
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
value
)
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalNestedEnum_
=
value
;
result
.
optionalNestedEnum_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
ClearOptionalNestedEnum
()
public
Builder
ClearOptionalNestedEnum
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
optionalNestedEnum_
=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
;
result
.
optionalNestedEnum_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedEnum
.
FOO
;
return
this
;
return
this
;
}
}
public
bool
HasOptionalNestedMessage
public
bool
HasOptionalNestedMessage
{
{
get
{
return
result
.
hasOptionalNestedMessage
;
}
get
{
return
result
.
hasOptionalNestedMessage
;
}
}
}
public
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
OptionalNestedMessage
public
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
OptionalNestedMessage
{
{
get
{
return
result
.
OptionalNestedMessage
;
}
get
{
return
result
.
OptionalNestedMessage
;
}
set
{
SetOptionalNestedMessage
(
value
);
}
set
{
SetOptionalNestedMessage
(
value
);
}
}
}
public
Builder
SetOptionalNestedMessage
(
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
value
)
public
Builder
SetOptionalNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
PrepareBuilder
();
PrepareBuilder
();
result
.
hasOptionalNestedMessage
=
true
;
result
.
hasOptionalNestedMessage
=
true
;
result
.
optionalNestedMessage_
=
value
;
result
.
optionalNestedMessage_
=
value
;
return
this
;
return
this
;
}
}
public
Builder
SetOptionalNestedMessage
(
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
builderForValue
)
public
Builder
SetOptionalNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
builderForValue
)
{
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
PrepareBuilder
();
PrepareBuilder
();
result
.
hasOptionalNestedMessage
=
true
;
result
.
hasOptionalNestedMessage
=
true
;
result
.
optionalNestedMessage_
=
builderForValue
.
Build
();
result
.
optionalNestedMessage_
=
builderForValue
.
Build
();
return
this
;
return
this
;
}
}
public
Builder
MergeOptionalNestedMessage
(
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
value
)
public
Builder
MergeOptionalNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
PrepareBuilder
();
PrepareBuilder
();
if
(
result
.
hasOptionalNestedMessage
&&
if
(
result
.
hasOptionalNestedMessage
&&
result
.
optionalNestedMessage_
!=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
)
result
.
optionalNestedMessage_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
DefaultInstance
)
{
{
result
.
optionalNestedMessage_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
TestAllTypes
.
Types
.
NestedMessage
.
CreateBuilder
(
result
.
optionalNestedMessage_
).
MergeFrom
(
value
).
BuildPartial
();
result
.
optionalNestedMessage_
=
global
::
field_presence_test
.
TestAllTypes
.
Types
.
NestedMessage
.
CreateBuilder
(
result
.
optionalNestedMessage_
).
MergeFrom
(
value
).
BuildPartial
();
}
else
{
}
else
{
result
.
optionalNestedMessage_
=
value
;
result
.
optionalNestedMessage_
=
value
;
}
}
result
.
hasOptionalNestedMessage
=
true
;
result
.
hasOptionalNestedMessage
=
true
;
return
this
;
return
this
;
}
}
public
Builder
ClearOptionalNestedMessage
()
public
Builder
ClearOptionalNestedMessage
()
{
{
PrepareBuilder
();
PrepareBuilder
();
result
.
hasOptionalNestedMessage
=
false
;
result
.
hasOptionalNestedMessage
=
false
;
result
.
optionalNestedMessage_
=
null
;
result
.
optionalNestedMessage_
=
null
;
return
this
;
return
this
;
}
}
}
}
static
TestAllTypes
()
static
TestAllTypes
()
{
{
object
.
ReferenceEquals
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
FieldPresence
.
FieldPresenceTest
.
Descriptor
,
null
);
object
.
ReferenceEquals
(
global
::
field_presence_test
.
FieldPresenceTest
.
Descriptor
,
null
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment