OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 optional int32 message_opt1 = 7739036; | 62 optional int32 message_opt1 = 7739036; |
63 } | 63 } |
64 | 64 |
65 extend google.protobuf.FieldOptions { | 65 extend google.protobuf.FieldOptions { |
66 optional fixed64 field_opt1 = 7740936; | 66 optional fixed64 field_opt1 = 7740936; |
67 // This is useful for testing that we correctly register default values for | 67 // This is useful for testing that we correctly register default values for |
68 // extension options. | 68 // extension options. |
69 optional int32 field_opt2 = 7753913 [default=42]; | 69 optional int32 field_opt2 = 7753913 [default=42]; |
70 } | 70 } |
71 | 71 |
| 72 extend google.protobuf.OneofOptions { |
| 73 optional int32 oneof_opt1 = 7740111; |
| 74 } |
| 75 |
72 extend google.protobuf.EnumOptions { | 76 extend google.protobuf.EnumOptions { |
73 optional sfixed32 enum_opt1 = 7753576; | 77 optional sfixed32 enum_opt1 = 7753576; |
74 } | 78 } |
75 | 79 |
76 extend google.protobuf.EnumValueOptions { | 80 extend google.protobuf.EnumValueOptions { |
77 optional int32 enum_value_opt1 = 1560678; | 81 optional int32 enum_value_opt1 = 1560678; |
78 } | 82 } |
79 | 83 |
80 extend google.protobuf.ServiceOptions { | 84 extend google.protobuf.ServiceOptions { |
81 optional sint64 service_opt1 = 7887650; | 85 optional sint64 service_opt1 = 7887650; |
(...skipping 11 matching lines...) Expand all Loading... |
93 // A test message with custom options at all possible locations (and also some | 97 // A test message with custom options at all possible locations (and also some |
94 // regular options, to make sure they interact nicely). | 98 // regular options, to make sure they interact nicely). |
95 message TestMessageWithCustomOptions { | 99 message TestMessageWithCustomOptions { |
96 option message_set_wire_format = false; | 100 option message_set_wire_format = false; |
97 | 101 |
98 option (message_opt1) = -56; | 102 option (message_opt1) = -56; |
99 | 103 |
100 optional string field1 = 1 [ctype=CORD, | 104 optional string field1 = 1 [ctype=CORD, |
101 (field_opt1)=8765432109]; | 105 (field_opt1)=8765432109]; |
102 | 106 |
| 107 oneof AnOneof { |
| 108 option (oneof_opt1) = -99; |
| 109 int32 oneof_field = 2; |
| 110 } |
| 111 |
103 enum AnEnum { | 112 enum AnEnum { |
104 option (enum_opt1) = -789; | 113 option (enum_opt1) = -789; |
105 | 114 |
106 ANENUM_VAL1 = 1; | 115 ANENUM_VAL1 = 1; |
107 ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; | 116 ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; |
108 } | 117 } |
109 } | 118 } |
110 | 119 |
111 | 120 |
112 // A test RPC service with custom options at all possible locations (and also | 121 // A test RPC service with custom options at all possible locations (and also |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 421 } |
413 | 422 |
414 extend google.protobuf.MessageOptions { | 423 extend google.protobuf.MessageOptions { |
415 optional OldOptionType required_enum_opt = 106161807; | 424 optional OldOptionType required_enum_opt = 106161807; |
416 } | 425 } |
417 | 426 |
418 // Test message using the "required_enum_opt" option defined above. | 427 // Test message using the "required_enum_opt" option defined above. |
419 message TestMessageWithRequiredEnumOption { | 428 message TestMessageWithRequiredEnumOption { |
420 option (required_enum_opt) = { value: OLD_VALUE }; | 429 option (required_enum_opt) = { value: OLD_VALUE }; |
421 } | 430 } |
OLD | NEW |