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 23 matching lines...) Expand all Loading... |
34 * | 34 * |
35 * @author aappleby@google.com (Austin Appleby) | 35 * @author aappleby@google.com (Austin Appleby) |
36 */ | 36 */ |
37 | 37 |
38 goog.provide('jspb.AnyFieldType'); | 38 goog.provide('jspb.AnyFieldType'); |
39 goog.provide('jspb.BinaryConstants'); | 39 goog.provide('jspb.BinaryConstants'); |
40 goog.provide('jspb.BinaryMessage'); | 40 goog.provide('jspb.BinaryMessage'); |
41 goog.provide('jspb.BuilderFunction'); | 41 goog.provide('jspb.BuilderFunction'); |
42 goog.provide('jspb.ByteSource'); | 42 goog.provide('jspb.ByteSource'); |
43 goog.provide('jspb.ClonerFunction'); | 43 goog.provide('jspb.ClonerFunction'); |
| 44 goog.provide('jspb.ComparerFunction'); |
44 goog.provide('jspb.ConstBinaryMessage'); | 45 goog.provide('jspb.ConstBinaryMessage'); |
| 46 goog.provide('jspb.PrunerFunction'); |
45 goog.provide('jspb.ReaderFunction'); | 47 goog.provide('jspb.ReaderFunction'); |
46 goog.provide('jspb.RecyclerFunction'); | 48 goog.provide('jspb.RecyclerFunction'); |
| 49 goog.provide('jspb.RepeatedFieldType'); |
| 50 goog.provide('jspb.ScalarFieldType'); |
47 goog.provide('jspb.WriterFunction'); | 51 goog.provide('jspb.WriterFunction'); |
48 | 52 |
| 53 |
49 goog.forwardDeclare('jspb.Message'); | 54 goog.forwardDeclare('jspb.Message'); |
50 goog.forwardDeclare('jsproto.BinaryExtension'); | 55 goog.forwardDeclare('jsproto.BinaryExtension'); |
51 | 56 |
52 | 57 |
53 | 58 |
54 /** | 59 /** |
55 * Base interface class for all const messages. Does __not__ define any | 60 * Base interface class for all const messages. Does __not__ define any |
56 * methods, as doing so on a widely-used interface defeats dead-code | 61 * methods, as doing so on a widely-used interface defeats dead-code |
57 * elimination. | 62 * elimination. |
58 * @interface | 63 * @interface |
(...skipping 13 matching lines...) Expand all Loading... |
72 | 77 |
73 /** | 78 /** |
74 * The types convertible to Uint8Arrays. Strings are assumed to be | 79 * The types convertible to Uint8Arrays. Strings are assumed to be |
75 * base64-encoded. | 80 * base64-encoded. |
76 * @typedef {ArrayBuffer|Uint8Array|Array<number>|string} | 81 * @typedef {ArrayBuffer|Uint8Array|Array<number>|string} |
77 */ | 82 */ |
78 jspb.ByteSource; | 83 jspb.ByteSource; |
79 | 84 |
80 | 85 |
81 /** | 86 /** |
| 87 * A scalar field in jspb can be a boolean, number, or string. |
| 88 * @typedef {boolean|number|string} |
| 89 */ |
| 90 jspb.ScalarFieldType; |
| 91 |
| 92 |
| 93 /** |
| 94 * A repeated field in jspb is an array of scalars, blobs, or messages. |
| 95 * @typedef {!Array<jspb.ScalarFieldType>| |
| 96 !Array<!Uint8Array>| |
| 97 !Array<!jspb.BinaryMessage>} |
| 98 */ |
| 99 jspb.RepeatedFieldType; |
| 100 |
| 101 |
| 102 /** |
82 * A field in jspb can be a scalar, a block of bytes, another proto, or an | 103 * A field in jspb can be a scalar, a block of bytes, another proto, or an |
83 * array of any of the above. | 104 * array of any of the above. |
84 * @typedef {boolean|number|string|Uint8Array| | 105 * @typedef {jspb.ScalarFieldType| |
85 jspb.BinaryMessage|jsproto.BinaryExtension| | 106 jspb.RepeatedFieldType| |
86 Array<jspb.AnyFieldType>} | 107 !Uint8Array| |
| 108 !jspb.BinaryMessage| |
| 109 !jsproto.BinaryExtension} |
87 */ | 110 */ |
88 jspb.AnyFieldType; | 111 jspb.AnyFieldType; |
89 | 112 |
90 | 113 |
91 /** | 114 /** |
92 * A builder function creates an instance of a message object. | 115 * A builder function creates an instance of a message object. |
93 * @typedef {function():!jspb.BinaryMessage} | 116 * @typedef {function():!jspb.BinaryMessage} |
94 */ | 117 */ |
95 jspb.BuilderFunction; | 118 jspb.BuilderFunction; |
96 | 119 |
(...skipping 21 matching lines...) Expand all Loading... |
118 | 141 |
119 /** | 142 /** |
120 * A writer function serializes a message to a BinaryWriter. | 143 * A writer function serializes a message to a BinaryWriter. |
121 * @typedef {!function(!jspb.Message, !jspb.BinaryWriter):void | | 144 * @typedef {!function(!jspb.Message, !jspb.BinaryWriter):void | |
122 * !function(!jspb.ConstBinaryMessage, !jspb.BinaryWriter):void} | 145 * !function(!jspb.ConstBinaryMessage, !jspb.BinaryWriter):void} |
123 */ | 146 */ |
124 jspb.WriterFunction; | 147 jspb.WriterFunction; |
125 | 148 |
126 | 149 |
127 /** | 150 /** |
| 151 * A pruner function removes default-valued fields and empty submessages from a |
| 152 * message and returns either the pruned message or null if the entire message |
| 153 * was pruned away. |
| 154 * @typedef {function(?jspb.BinaryMessage):?jspb.BinaryMessage} |
| 155 */ |
| 156 jspb.PrunerFunction; |
| 157 |
| 158 |
| 159 /** |
| 160 * A comparer function returns true if two protos are equal. |
| 161 * @typedef {!function(?jspb.ConstBinaryMessage, |
| 162 * ?jspb.ConstBinaryMessage):boolean} |
| 163 */ |
| 164 jspb.ComparerFunction; |
| 165 |
| 166 |
| 167 /** |
128 * Field type codes, taken from proto2/public/wire_format_lite.h. | 168 * Field type codes, taken from proto2/public/wire_format_lite.h. |
129 * @enum {number} | 169 * @enum {number} |
130 */ | 170 */ |
131 jspb.BinaryConstants.FieldType = { | 171 jspb.BinaryConstants.FieldType = { |
132 INVALID: -1, | 172 INVALID: -1, |
133 DOUBLE: 1, | 173 DOUBLE: 1, |
134 FLOAT: 2, | 174 FLOAT: 2, |
135 INT64: 3, | 175 INT64: 3, |
136 UINT64: 4, | 176 UINT64: 4, |
137 INT32: 5, | 177 INT32: 5, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 * @const {number} | 351 * @const {number} |
312 */ | 352 */ |
313 jspb.BinaryConstants.TWO_TO_64 = 18446744073709551616; | 353 jspb.BinaryConstants.TWO_TO_64 = 18446744073709551616; |
314 | 354 |
315 | 355 |
316 /** | 356 /** |
317 * Eight-character string of zeros, used as the default 64-bit hash value. | 357 * Eight-character string of zeros, used as the default 64-bit hash value. |
318 * @const {string} | 358 * @const {string} |
319 */ | 359 */ |
320 jspb.BinaryConstants.ZERO_HASH = '\0\0\0\0\0\0\0\0'; | 360 jspb.BinaryConstants.ZERO_HASH = '\0\0\0\0\0\0\0\0'; |
OLD | NEW |