diff options
author | csharptest <roger@csharptest.net> | 2011-09-09 18:14:40 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-09-09 18:14:40 -0500 |
commit | 3c6e93283a90b2d5c944a02bba3f1606272d762d (patch) | |
tree | 30b73c9442bf14a96ef3c1181deefad61eaa6e4d /protos | |
parent | 8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff) | |
download | protobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.tar.gz protobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.tar.bz2 protobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.zip |
Completed addition and testing of new add_serializable option.
Diffstat (limited to 'protos')
-rw-r--r-- | protos/extest/unittest_extras_lite.proto | 123 | ||||
-rw-r--r-- | protos/extest/unittest_extras_xmltest.proto | 1 | ||||
-rw-r--r-- | protos/google/protobuf/csharp_options.proto | 3 |
3 files changed, 66 insertions, 61 deletions
diff --git a/protos/extest/unittest_extras_lite.proto b/protos/extest/unittest_extras_lite.proto index 46d5ab91..72e7ee81 100644 --- a/protos/extest/unittest_extras_lite.proto +++ b/protos/extest/unittest_extras_lite.proto @@ -1,61 +1,62 @@ -// Additional options required for C# generation. File from copyright -// line onwards is as per original distribution. -import "google/protobuf/csharp_options.proto"; -option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; -option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile"; - -package protobuf_unittest_extra; - -option optimize_for = LITE_RUNTIME; - -option java_package = "com.google.protobuf"; - -message TestRequiredLite { - required int32 d = 1; - required ExtraEnum en = 2 [default = DEFAULT]; -} - -enum ExtraEnum { - DEFAULT = 10; - EXLITE_FOO = 7; - EXLITE_BAR = 8; - EXLITE_BAZ = 9; -} - -message TestInteropPersonLite { - required string name = 1; - required int32 id = 2; - optional string email = 3; - repeated int32 codes = 10 [packed=true]; - - enum PhoneType { - MOBILE = 0; - HOME = 1; - WORK = 2; - } - - message PhoneNumber { - required string number = 1; - optional PhoneType type = 2 [default = HOME]; - } - - repeated PhoneNumber phone = 4; - - repeated group Addresses = 5 { - required string address = 1; - optional string address2 = 2; - required string city = 3; - required string state = 4; - required fixed32 zip = 5; - } - - extensions 100 to 199; -} - -message TestInteropEmployeeIdLite { - required string number = 1; -} - -extend TestInteropPersonLite { - required TestInteropEmployeeIdLite employee_id_lite = 126; -} +// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
+
+package protobuf_unittest_extra;
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+message TestRequiredLite {
+ required int32 d = 1;
+ required ExtraEnum en = 2 [default = DEFAULT];
+}
+
+enum ExtraEnum {
+ DEFAULT = 10;
+ EXLITE_FOO = 7;
+ EXLITE_BAR = 8;
+ EXLITE_BAZ = 9;
+}
+
+message TestInteropPersonLite {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+ repeated int32 codes = 10 [packed=true];
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+
+ repeated group Addresses = 5 {
+ required string address = 1;
+ optional string address2 = 2;
+ required string city = 3;
+ required string state = 4;
+ required fixed32 zip = 5;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestInteropEmployeeIdLite {
+ required string number = 1;
+}
+
+extend TestInteropPersonLite {
+ required TestInteropEmployeeIdLite employee_id_lite = 126;
+}
diff --git a/protos/extest/unittest_extras_xmltest.proto b/protos/extest/unittest_extras_xmltest.proto index f00fb027..7fc4e3a2 100644 --- a/protos/extest/unittest_extras_xmltest.proto +++ b/protos/extest/unittest_extras_xmltest.proto @@ -1,6 +1,7 @@ import "google/protobuf/csharp_options.proto";
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestXmlSerializerTestProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
package protobuf_unittest_extra;
diff --git a/protos/google/protobuf/csharp_options.proto b/protos/google/protobuf/csharp_options.proto index 33a7b03d..9ebcfa6b 100644 --- a/protos/google/protobuf/csharp_options.proto +++ b/protos/google/protobuf/csharp_options.proto @@ -38,6 +38,9 @@ message CSharpFileOptions { // Generate attributes indicating non-CLS-compliance
optional bool cls_compliance = 8 [default = true];
+
+ // Generate messages/builders with the [Serializable] attribute
+ optional bool add_serializable = 9 [default = false];
// The extension that should be appended to the umbrella_classname when creating files.
optional string file_extension = 221 [default = ".cs"];
|