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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 message Label { | 51 message Label { |
52 optional string key = 1; | 52 optional string key = 1; |
53 optional string value = 2; | 53 optional string value = 2; |
54 } | 54 } |
55 | 55 |
56 optional Publisher publisher = 9; | 56 optional Publisher publisher = 9; |
57 repeated Label labels = 10; | 57 repeated Label labels = 10; |
58 | 58 |
| 59 enum Type { |
| 60 FICTION = 1; |
| 61 KIDS = 2; |
| 62 ACTION_AND_ADVENTURE = 3; |
| 63 } |
| 64 optional Type type = 11; |
| 65 |
59 extensions 200 to 499; | 66 extensions 200 to 499; |
60 } | 67 } |
61 | 68 |
62 // A publisher of a book, tests required fields. | 69 // A publisher of a book, tests required fields. |
63 message Publisher { | 70 message Publisher { |
64 required string name = 1; | 71 required string name = 1; |
65 } | 72 } |
66 | 73 |
67 // An author of a book | 74 // An author of a book |
68 message Author { | 75 message Author { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 169 } |
163 // Recurse | 170 // Recurse |
164 optional Book book = 1; | 171 optional Book book = 1; |
165 } | 172 } |
166 | 173 |
167 // For testing resiliency of our protostream parser. | 174 // For testing resiliency of our protostream parser. |
168 // Field number of NestedBook is reused for something else. | 175 // Field number of NestedBook is reused for something else. |
169 message BadNestedBook { | 176 message BadNestedBook { |
170 repeated uint32 book = 1 [packed=true]; // Packed to optional message. | 177 repeated uint32 book = 1 [packed=true]; // Packed to optional message. |
171 } | 178 } |
| 179 |
| 180 // A recursively defined message. |
| 181 message Cyclic { |
| 182 optional int32 m_int = 1; |
| 183 optional string m_str = 2; |
| 184 optional Book m_book = 3; |
| 185 repeated Author m_author = 5; |
| 186 optional Cyclic m_cyclic = 4; |
| 187 } |
OLD | NEW |