Debian Codegraph @

php/src/Google/Protobuf/Internal/FieldOptions.php

raw
1 <?php
2 # Generated by the protocol buffer compiler. DO NOT EDIT!
3 # source: google/protobuf/descriptor.proto
4
5 namespace Google\Protobuf\Internal;
6
7 use Google\Protobuf\Internal\GPBType;
8 use Google\Protobuf\Internal\GPBWire;
9 use Google\Protobuf\Internal\RepeatedField;
10 use Google\Protobuf\Internal\InputStream;
11 use Google\Protobuf\Internal\GPBUtil;
12
13 /**
14 * Generated from protobuf message <code>google.protobuf.FieldOptions</code>
15 */
16 class FieldOptions extends \Google\Protobuf\Internal\Message
17 {
18 /**
19 * The ctype option instructs the C++ code generator to use a different
20 * representation of the field than it normally would. See the specific
21 * options below. This option is not yet implemented in the open source
22 * release -- sorry, we'll try to include it in a future version!
23 *
24 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
25 */
26 protected $ctype = null;
27 /**
28 * The packed option can be enabled for repeated primitive fields to enable
29 * a more efficient representation on the wire. Rather than repeatedly
30 * writing the tag and type for each element, the entire array is encoded as
31 * a single length-delimited blob. In proto3, only explicit setting it to
32 * false will avoid using packed encoding.
33 *
34 * Generated from protobuf field <code>optional bool packed = 2;</code>
35 */
36 protected $packed = null;
37 /**
38 * The jstype option determines the JavaScript type used for values of the
39 * field. The option is permitted only for 64 bit integral and fixed types
40 * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
41 * is represented as JavaScript string, which avoids loss of precision that
42 * can happen when a large value is converted to a floating point JavaScript.
43 * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
44 * use the JavaScript "number" type. The behavior of the default option
45 * JS_NORMAL is implementation dependent.
46 * This option is an enum to permit additional types to be added, e.g.
47 * goog.math.Integer.
48 *
49 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
50 */
51 protected $jstype = null;
52 /**
53 * Should this field be parsed lazily? Lazy applies only to message-type
54 * fields. It means that when the outer message is initially parsed, the
55 * inner message's contents will not be parsed but instead stored in encoded
56 * form. The inner message will actually be parsed when it is first accessed.
57 * This is only a hint. Implementations are free to choose whether to use
58 * eager or lazy parsing regardless of the value of this option. However,
59 * setting this option true suggests that the protocol author believes that
60 * using lazy parsing on this field is worth the additional bookkeeping
61 * overhead typically needed to implement it.
62 * This option does not affect the public interface of any generated code;
63 * all method signatures remain the same. Furthermore, thread-safety of the
64 * interface is not affected by this option; const methods remain safe to
65 * call from multiple threads concurrently, while non-const methods continue
66 * to require exclusive access.
67 * Note that implementations may choose not to check required fields within
68 * a lazy sub-message. That is, calling IsInitialized() on the outer message
69 * may return true even if the inner message has missing required fields.
70 * This is necessary because otherwise the inner message would have to be
71 * parsed in order to perform the check, defeating the purpose of lazy
72 * parsing. An implementation which chooses not to check required fields
73 * must be consistent about it. That is, for any particular sub-message, the
74 * implementation must either *always* check its required fields, or *never*
75 * check its required fields, regardless of whether or not the message has
76 * been parsed.
77 * As of 2021, lazy does no correctness checks on the byte stream during
78 * parsing. This may lead to crashes if and when an invalid byte stream is
79 * finally parsed upon access.
80 * TODO(b/211906113): Enable validation on lazy fields.
81 *
82 * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
83 */
84 protected $lazy = null;
85 /**
86 * unverified_lazy does no correctness checks on the byte stream. This should
87 * only be used where lazy with verification is prohibitive for performance
88 * reasons.
89 *
90 * Generated from protobuf field <code>optional bool unverified_lazy = 15 [default = false];</code>
91 */
92 protected $unverified_lazy = null;
93 /**
94 * Is this field deprecated?
95 * Depending on the target platform, this can emit Deprecated annotations
96 * for accessors, or it will be completely ignored; in the very least, this
97 * is a formalization for deprecating fields.
98 *
99 * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
100 */
101 protected $deprecated = null;
102 /**
103 * For Google-internal migration only. Do not use.
104 *
105 * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
106 */
107 protected $weak = null;
108 /**
109 * The parser stores options it doesn't recognize here. See above.
110 *
111 * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
112 */
113 private $uninterpreted_option;
114
115 /**
116 * Constructor.
117 *
118 * @param array $data {
119 * Optional. Data for populating the Message object.
120 *
121 * @type int $ctype
122 * The ctype option instructs the C++ code generator to use a different
123 * representation of the field than it normally would. See the specific
124 * options below. This option is not yet implemented in the open source
125 * release -- sorry, we'll try to include it in a future version!
126 * @type bool $packed
127 * The packed option can be enabled for repeated primitive fields to enable
128 * a more efficient representation on the wire. Rather than repeatedly
129 * writing the tag and type for each element, the entire array is encoded as
130 * a single length-delimited blob. In proto3, only explicit setting it to
131 * false will avoid using packed encoding.
132 * @type int $jstype
133 * The jstype option determines the JavaScript type used for values of the
134 * field. The option is permitted only for 64 bit integral and fixed types
135 * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
136 * is represented as JavaScript string, which avoids loss of precision that
137 * can happen when a large value is converted to a floating point JavaScript.
138 * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
139 * use the JavaScript "number" type. The behavior of the default option
140 * JS_NORMAL is implementation dependent.
141 * This option is an enum to permit additional types to be added, e.g.
142 * goog.math.Integer.
143 * @type bool $lazy
144 * Should this field be parsed lazily? Lazy applies only to message-type
145 * fields. It means that when the outer message is initially parsed, the
146 * inner message's contents will not be parsed but instead stored in encoded
147 * form. The inner message will actually be parsed when it is first accessed.
148 * This is only a hint. Implementations are free to choose whether to use
149 * eager or lazy parsing regardless of the value of this option. However,
150 * setting this option true suggests that the protocol author believes that
151 * using lazy parsing on this field is worth the additional bookkeeping
152 * overhead typically needed to implement it.
153 * This option does not affect the public interface of any generated code;
154 * all method signatures remain the same. Furthermore, thread-safety of the
155 * interface is not affected by this option; const methods remain safe to
156 * call from multiple threads concurrently, while non-const methods continue
157 * to require exclusive access.
158 * Note that implementations may choose not to check required fields within
159 * a lazy sub-message. That is, calling IsInitialized() on the outer message
160 * may return true even if the inner message has missing required fields.
161 * This is necessary because otherwise the inner message would have to be
162 * parsed in order to perform the check, defeating the purpose of lazy
163 * parsing. An implementation which chooses not to check required fields
164 * must be consistent about it. That is, for any particular sub-message, the
165 * implementation must either *always* check its required fields, or *never*
166 * check its required fields, regardless of whether or not the message has
167 * been parsed.
168 * As of 2021, lazy does no correctness checks on the byte stream during
169 * parsing. This may lead to crashes if and when an invalid byte stream is
170 * finally parsed upon access.
171 * TODO(b/211906113): Enable validation on lazy fields.
172 * @type bool $unverified_lazy
173 * unverified_lazy does no correctness checks on the byte stream. This should
174 * only be used where lazy with verification is prohibitive for performance
175 * reasons.
176 * @type bool $deprecated
177 * Is this field deprecated?
178 * Depending on the target platform, this can emit Deprecated annotations
179 * for accessors, or it will be completely ignored; in the very least, this
180 * is a formalization for deprecating fields.
181 * @type bool $weak
182 * For Google-internal migration only. Do not use.
183 * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
184 * The parser stores options it doesn't recognize here. See above.
185 * }
186 */
187 public function __construct($data = NULL) {
188 \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
189 parent::__construct($data);
190 }
191
192 /**
193 * The ctype option instructs the C++ code generator to use a different
194 * representation of the field than it normally would. See the specific
195 * options below. This option is not yet implemented in the open source
196 * release -- sorry, we'll try to include it in a future version!
197 *
198 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
199 * @return int
200 */
201 public function getCtype()
202 {
203 return isset($this->ctype) ? $this->ctype : 0;
204 }
205
206 public function hasCtype()
207 {
208 return isset($this->ctype);
209 }
210
211 public function clearCtype()
212 {
213 unset($this->ctype);
214 }
215
216 /**
217 * The ctype option instructs the C++ code generator to use a different
218 * representation of the field than it normally would. See the specific
219 * options below. This option is not yet implemented in the open source
220 * release -- sorry, we'll try to include it in a future version!
221 *
222 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
223 * @param int $var
224 * @return $this
225 */
226 public function setCtype($var)
227 {
228 GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions\CType::class);
229 $this->ctype = $var;
230
231 return $this;
232 }
233
234 /**
235 * The packed option can be enabled for repeated primitive fields to enable
236 * a more efficient representation on the wire. Rather than repeatedly
237 * writing the tag and type for each element, the entire array is encoded as
238 * a single length-delimited blob. In proto3, only explicit setting it to
239 * false will avoid using packed encoding.
240 *
241 * Generated from protobuf field <code>optional bool packed = 2;</code>
242 * @return bool
243 */
244 public function getPacked()
245 {
246 return isset($this->packed) ? $this->packed : false;
247 }
248
249 public function hasPacked()
250 {
251 return isset($this->packed);
252 }
253
254 public function clearPacked()
255 {
256 unset($this->packed);
257 }
258
259 /**
260 * The packed option can be enabled for repeated primitive fields to enable
261 * a more efficient representation on the wire. Rather than repeatedly
262 * writing the tag and type for each element, the entire array is encoded as
263 * a single length-delimited blob. In proto3, only explicit setting it to
264 * false will avoid using packed encoding.
265 *
266 * Generated from protobuf field <code>optional bool packed = 2;</code>
267 * @param bool $var
268 * @return $this
269 */
270 public function setPacked($var)
271 {
272 GPBUtil::checkBool($var);
273 $this->packed = $var;
274
275 return $this;
276 }
277
278 /**
279 * The jstype option determines the JavaScript type used for values of the
280 * field. The option is permitted only for 64 bit integral and fixed types
281 * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
282 * is represented as JavaScript string, which avoids loss of precision that
283 * can happen when a large value is converted to a floating point JavaScript.
284 * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
285 * use the JavaScript "number" type. The behavior of the default option
286 * JS_NORMAL is implementation dependent.
287 * This option is an enum to permit additional types to be added, e.g.
288 * goog.math.Integer.
289 *
290 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
291 * @return int
292 */
293 public function getJstype()
294 {
295 return isset($this->jstype) ? $this->jstype : 0;
296 }
297
298 public function hasJstype()
299 {
300 return isset($this->jstype);
301 }
302
303 public function clearJstype()
304 {
305 unset($this->jstype);
306 }
307
308 /**
309 * The jstype option determines the JavaScript type used for values of the
310 * field. The option is permitted only for 64 bit integral and fixed types
311 * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
312 * is represented as JavaScript string, which avoids loss of precision that
313 * can happen when a large value is converted to a floating point JavaScript.
314 * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
315 * use the JavaScript "number" type. The behavior of the default option
316 * JS_NORMAL is implementation dependent.
317 * This option is an enum to permit additional types to be added, e.g.
318 * goog.math.Integer.
319 *
320 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
321 * @param int $var
322 * @return $this
323 */
324 public function setJstype($var)
325 {
326 GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions\JSType::class);
327 $this->jstype = $var;
328
329 return $this;
330 }
331
332 /**
333 * Should this field be parsed lazily? Lazy applies only to message-type
334 * fields. It means that when the outer message is initially parsed, the
335 * inner message's contents will not be parsed but instead stored in encoded
336 * form. The inner message will actually be parsed when it is first accessed.
337 * This is only a hint. Implementations are free to choose whether to use
338 * eager or lazy parsing regardless of the value of this option. However,
339 * setting this option true suggests that the protocol author believes that
340 * using lazy parsing on this field is worth the additional bookkeeping
341 * overhead typically needed to implement it.
342 * This option does not affect the public interface of any generated code;
343 * all method signatures remain the same. Furthermore, thread-safety of the
344 * interface is not affected by this option; const methods remain safe to
345 * call from multiple threads concurrently, while non-const methods continue
346 * to require exclusive access.
347 * Note that implementations may choose not to check required fields within
348 * a lazy sub-message. That is, calling IsInitialized() on the outer message
349 * may return true even if the inner message has missing required fields.
350 * This is necessary because otherwise the inner message would have to be
351 * parsed in order to perform the check, defeating the purpose of lazy
352 * parsing. An implementation which chooses not to check required fields
353 * must be consistent about it. That is, for any particular sub-message, the
354 * implementation must either *always* check its required fields, or *never*
355 * check its required fields, regardless of whether or not the message has
356 * been parsed.
357 * As of 2021, lazy does no correctness checks on the byte stream during
358 * parsing. This may lead to crashes if and when an invalid byte stream is
359 * finally parsed upon access.
360 * TODO(b/211906113): Enable validation on lazy fields.
361 *
362 * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
363 * @return bool
364 */
365 public function getLazy()
366 {
367 return isset($this->lazy) ? $this->lazy : false;
368 }
369
370 public function hasLazy()
371 {
372 return isset($this->lazy);
373 }
374
375 public function clearLazy()
376 {
377 unset($this->lazy);
378 }
379
380 /**
381 * Should this field be parsed lazily? Lazy applies only to message-type
382 * fields. It means that when the outer message is initially parsed, the
383 * inner message's contents will not be parsed but instead stored in encoded
384 * form. The inner message will actually be parsed when it is first accessed.
385 * This is only a hint. Implementations are free to choose whether to use
386 * eager or lazy parsing regardless of the value of this option. However,
387 * setting this option true suggests that the protocol author believes that
388 * using lazy parsing on this field is worth the additional bookkeeping
389 * overhead typically needed to implement it.
390 * This option does not affect the public interface of any generated code;
391 * all method signatures remain the same. Furthermore, thread-safety of the
392 * interface is not affected by this option; const methods remain safe to
393 * call from multiple threads concurrently, while non-const methods continue
394 * to require exclusive access.
395 * Note that implementations may choose not to check required fields within
396 * a lazy sub-message. That is, calling IsInitialized() on the outer message
397 * may return true even if the inner message has missing required fields.
398 * This is necessary because otherwise the inner message would have to be
399 * parsed in order to perform the check, defeating the purpose of lazy
400 * parsing. An implementation which chooses not to check required fields
401 * must be consistent about it. That is, for any particular sub-message, the
402 * implementation must either *always* check its required fields, or *never*
403 * check its required fields, regardless of whether or not the message has
404 * been parsed.
405 * As of 2021, lazy does no correctness checks on the byte stream during
406 * parsing. This may lead to crashes if and when an invalid byte stream is
407 * finally parsed upon access.
408 * TODO(b/211906113): Enable validation on lazy fields.
409 *
410 * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
411 * @param bool $var
412 * @return $this
413 */
414 public function setLazy($var)
415 {
416 GPBUtil::checkBool($var);
417 $this->lazy = $var;
418
419 return $this;
420 }
421
422 /**
423 * unverified_lazy does no correctness checks on the byte stream. This should
424 * only be used where lazy with verification is prohibitive for performance
425 * reasons.
426 *
427 * Generated from protobuf field <code>optional bool unverified_lazy = 15 [default = false];</code>
428 * @return bool
429 */
430 public function getUnverifiedLazy()
431 {
432 return isset($this->unverified_lazy) ? $this->unverified_lazy : false;
433 }
434
435 public function hasUnverifiedLazy()
436 {
437 return isset($this->unverified_lazy);
438 }
439
440 public function clearUnverifiedLazy()
441 {
442 unset($this->unverified_lazy);
443 }
444
445 /**
446 * unverified_lazy does no correctness checks on the byte stream. This should
447 * only be used where lazy with verification is prohibitive for performance
448 * reasons.
449 *
450 * Generated from protobuf field <code>optional bool unverified_lazy = 15 [default = false];</code>
451 * @param bool $var
452 * @return $this
453 */
454 public function setUnverifiedLazy($var)
455 {
456 GPBUtil::checkBool($var);
457 $this->unverified_lazy = $var;
458
459 return $this;
460 }
461
462 /**
463 * Is this field deprecated?
464 * Depending on the target platform, this can emit Deprecated annotations
465 * for accessors, or it will be completely ignored; in the very least, this
466 * is a formalization for deprecating fields.
467 *
468 * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
469 * @return bool
470 */
471 public function getDeprecated()
472 {
473 return isset($this->deprecated) ? $this->deprecated : false;
474 }
475
476 public function hasDeprecated()
477 {
478 return isset($this->deprecated);
479 }
480
481 public function clearDeprecated()
482 {
483 unset($this->deprecated);
484 }
485
486 /**
487 * Is this field deprecated?
488 * Depending on the target platform, this can emit Deprecated annotations
489 * for accessors, or it will be completely ignored; in the very least, this
490 * is a formalization for deprecating fields.
491 *
492 * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
493 * @param bool $var
494 * @return $this
495 */
496 public function setDeprecated($var)
497 {
498 GPBUtil::checkBool($var);
499 $this->deprecated = $var;
500
501 return $this;
502 }
503
504 /**
505 * For Google-internal migration only. Do not use.
506 *
507 * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
508 * @return bool
509 */
510 public function getWeak()
511 {
512 return isset($this->weak) ? $this->weak : false;
513 }
514
515 public function hasWeak()
516 {
517 return isset($this->weak);
518 }
519
520 public function clearWeak()
521 {
522 unset($this->weak);
523 }
524
525 /**
526 * For Google-internal migration only. Do not use.
527 *
528 * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
529 * @param bool $var
530 * @return $this
531 */
532 public function setWeak($var)
533 {
534 GPBUtil::checkBool($var);
535 $this->weak = $var;
536
537 return $this;
538 }
539
540 /**
541 * The parser stores options it doesn't recognize here. See above.
542 *
543 * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
544 * @return \Google\Protobuf\Internal\RepeatedField
545 */
546 public function getUninterpretedOption()
547 {
548 return $this->uninterpreted_option;
549 }
550
551 /**
552 * The parser stores options it doesn't recognize here. See above.
553 *
554 * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
555 * @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
556 * @return $this
557 */
558 public function setUninterpretedOption($var)
559 {
560 $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
561 $this->uninterpreted_option = $arr;
562
563 return $this;
564 }
565
566 }
567