Debian Codegraph @

php/src/Google/Protobuf/Internal/FieldDescriptorProto.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 * Describes a field within a message.
15 *
16 * Generated from protobuf message <code>google.protobuf.FieldDescriptorProto</code>
17 */
18 class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
19 {
20 /**
21 * Generated from protobuf field <code>optional string name = 1;</code>
22 */
23 protected $name = null;
24 /**
25 * Generated from protobuf field <code>optional int32 number = 3;</code>
26 */
27 protected $number = null;
28 /**
29 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
30 */
31 protected $label = null;
32 /**
33 * If type_name is set, this need not be set. If both this and type_name
34 * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
35 *
36 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
37 */
38 protected $type = null;
39 /**
40 * For message and enum types, this is the name of the type. If the name
41 * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
42 * rules are used to find the type (i.e. first the nested types within this
43 * message are searched, then within the parent, on up to the root
44 * namespace).
45 *
46 * Generated from protobuf field <code>optional string type_name = 6;</code>
47 */
48 protected $type_name = null;
49 /**
50 * For extensions, this is the name of the type being extended. It is
51 * resolved in the same manner as type_name.
52 *
53 * Generated from protobuf field <code>optional string extendee = 2;</code>
54 */
55 protected $extendee = null;
56 /**
57 * For numeric types, contains the original text representation of the value.
58 * For booleans, "true" or "false".
59 * For strings, contains the default text contents (not escaped in any way).
60 * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
61 *
62 * Generated from protobuf field <code>optional string default_value = 7;</code>
63 */
64 protected $default_value = null;
65 /**
66 * If set, gives the index of a oneof in the containing type's oneof_decl
67 * list. This field is a member of that oneof.
68 *
69 * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
70 */
71 protected $oneof_index = null;
72 /**
73 * JSON name of this field. The value is set by protocol compiler. If the
74 * user has set a "json_name" option on this field, that option's value
75 * will be used. Otherwise, it's deduced from the field's name by converting
76 * it to camelCase.
77 *
78 * Generated from protobuf field <code>optional string json_name = 10;</code>
79 */
80 protected $json_name = null;
81 /**
82 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
83 */
84 protected $options = null;
85 /**
86 * If true, this is a proto3 "optional". When a proto3 field is optional, it
87 * tracks presence regardless of field type.
88 * When proto3_optional is true, this field must be belong to a oneof to
89 * signal to old proto3 clients that presence is tracked for this field. This
90 * oneof is known as a "synthetic" oneof, and this field must be its sole
91 * member (each proto3 optional field gets its own synthetic oneof). Synthetic
92 * oneofs exist in the descriptor only, and do not generate any API. Synthetic
93 * oneofs must be ordered after all "real" oneofs.
94 * For message fields, proto3_optional doesn't create any semantic change,
95 * since non-repeated message fields always track presence. However it still
96 * indicates the semantic detail of whether the user wrote "optional" or not.
97 * This can be useful for round-tripping the .proto file. For consistency we
98 * give message fields a synthetic oneof also, even though it is not required
99 * to track presence. This is especially important because the parser can't
100 * tell if a field is a message or an enum, so it must always create a
101 * synthetic oneof.
102 * Proto2 optional fields do not set this flag, because they already indicate
103 * optional with `LABEL_OPTIONAL`.
104 *
105 * Generated from protobuf field <code>optional bool proto3_optional = 17;</code>
106 */
107 protected $proto3_optional = null;
108
109 /**
110 * Constructor.
111 *
112 * @param array $data {
113 * Optional. Data for populating the Message object.
114 *
115 * @type string $name
116 * @type int $number
117 * @type int $label
118 * @type int $type
119 * If type_name is set, this need not be set. If both this and type_name
120 * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
121 * @type string $type_name
122 * For message and enum types, this is the name of the type. If the name
123 * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
124 * rules are used to find the type (i.e. first the nested types within this
125 * message are searched, then within the parent, on up to the root
126 * namespace).
127 * @type string $extendee
128 * For extensions, this is the name of the type being extended. It is
129 * resolved in the same manner as type_name.
130 * @type string $default_value
131 * For numeric types, contains the original text representation of the value.
132 * For booleans, "true" or "false".
133 * For strings, contains the default text contents (not escaped in any way).
134 * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
135 * @type int $oneof_index
136 * If set, gives the index of a oneof in the containing type's oneof_decl
137 * list. This field is a member of that oneof.
138 * @type string $json_name
139 * JSON name of this field. The value is set by protocol compiler. If the
140 * user has set a "json_name" option on this field, that option's value
141 * will be used. Otherwise, it's deduced from the field's name by converting
142 * it to camelCase.
143 * @type \Google\Protobuf\Internal\FieldOptions $options
144 * @type bool $proto3_optional
145 * If true, this is a proto3 "optional". When a proto3 field is optional, it
146 * tracks presence regardless of field type.
147 * When proto3_optional is true, this field must be belong to a oneof to
148 * signal to old proto3 clients that presence is tracked for this field. This
149 * oneof is known as a "synthetic" oneof, and this field must be its sole
150 * member (each proto3 optional field gets its own synthetic oneof). Synthetic
151 * oneofs exist in the descriptor only, and do not generate any API. Synthetic
152 * oneofs must be ordered after all "real" oneofs.
153 * For message fields, proto3_optional doesn't create any semantic change,
154 * since non-repeated message fields always track presence. However it still
155 * indicates the semantic detail of whether the user wrote "optional" or not.
156 * This can be useful for round-tripping the .proto file. For consistency we
157 * give message fields a synthetic oneof also, even though it is not required
158 * to track presence. This is especially important because the parser can't
159 * tell if a field is a message or an enum, so it must always create a
160 * synthetic oneof.
161 * Proto2 optional fields do not set this flag, because they already indicate
162 * optional with `LABEL_OPTIONAL`.
163 * }
164 */
165 public function __construct($data = NULL) {
166 \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
167 parent::__construct($data);
168 }
169
170 /**
171 * Generated from protobuf field <code>optional string name = 1;</code>
172 * @return string
173 */
174 public function getName()
175 {
176 return isset($this->name) ? $this->name : '';
177 }
178
179 public function hasName()
180 {
181 return isset($this->name);
182 }
183
184 public function clearName()
185 {
186 unset($this->name);
187 }
188
189 /**
190 * Generated from protobuf field <code>optional string name = 1;</code>
191 * @param string $var
192 * @return $this
193 */
194 public function setName($var)
195 {
196 GPBUtil::checkString($var, True);
197 $this->name = $var;
198
199 return $this;
200 }
201
202 /**
203 * Generated from protobuf field <code>optional int32 number = 3;</code>
204 * @return int
205 */
206 public function getNumber()
207 {
208 return isset($this->number) ? $this->number : 0;
209 }
210
211 public function hasNumber()
212 {
213 return isset($this->number);
214 }
215
216 public function clearNumber()
217 {
218 unset($this->number);
219 }
220
221 /**
222 * Generated from protobuf field <code>optional int32 number = 3;</code>
223 * @param int $var
224 * @return $this
225 */
226 public function setNumber($var)
227 {
228 GPBUtil::checkInt32($var);
229 $this->number = $var;
230
231 return $this;
232 }
233
234 /**
235 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
236 * @return int
237 */
238 public function getLabel()
239 {
240 return isset($this->label) ? $this->label : 0;
241 }
242
243 public function hasLabel()
244 {
245 return isset($this->label);
246 }
247
248 public function clearLabel()
249 {
250 unset($this->label);
251 }
252
253 /**
254 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
255 * @param int $var
256 * @return $this
257 */
258 public function setLabel($var)
259 {
260 GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto\Label::class);
261 $this->label = $var;
262
263 return $this;
264 }
265
266 /**
267 * If type_name is set, this need not be set. If both this and type_name
268 * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
269 *
270 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
271 * @return int
272 */
273 public function getType()
274 {
275 return isset($this->type) ? $this->type : 0;
276 }
277
278 public function hasType()
279 {
280 return isset($this->type);
281 }
282
283 public function clearType()
284 {
285 unset($this->type);
286 }
287
288 /**
289 * If type_name is set, this need not be set. If both this and type_name
290 * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
291 *
292 * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
293 * @param int $var
294 * @return $this
295 */
296 public function setType($var)
297 {
298 GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto\Type::class);
299 $this->type = $var;
300
301 return $this;
302 }
303
304 /**
305 * For message and enum types, this is the name of the type. If the name
306 * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
307 * rules are used to find the type (i.e. first the nested types within this
308 * message are searched, then within the parent, on up to the root
309 * namespace).
310 *
311 * Generated from protobuf field <code>optional string type_name = 6;</code>
312 * @return string
313 */
314 public function getTypeName()
315 {
316 return isset($this->type_name) ? $this->type_name : '';
317 }
318
319 public function hasTypeName()
320 {
321 return isset($this->type_name);
322 }
323
324 public function clearTypeName()
325 {
326 unset($this->type_name);
327 }
328
329 /**
330 * For message and enum types, this is the name of the type. If the name
331 * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
332 * rules are used to find the type (i.e. first the nested types within this
333 * message are searched, then within the parent, on up to the root
334 * namespace).
335 *
336 * Generated from protobuf field <code>optional string type_name = 6;</code>
337 * @param string $var
338 * @return $this
339 */
340 public function setTypeName($var)
341 {
342 GPBUtil::checkString($var, True);
343 $this->type_name = $var;
344
345 return $this;
346 }
347
348 /**
349 * For extensions, this is the name of the type being extended. It is
350 * resolved in the same manner as type_name.
351 *
352 * Generated from protobuf field <code>optional string extendee = 2;</code>
353 * @return string
354 */
355 public function getExtendee()
356 {
357 return isset($this->extendee) ? $this->extendee : '';
358 }
359
360 public function hasExtendee()
361 {
362 return isset($this->extendee);
363 }
364
365 public function clearExtendee()
366 {
367 unset($this->extendee);
368 }
369
370 /**
371 * For extensions, this is the name of the type being extended. It is
372 * resolved in the same manner as type_name.
373 *
374 * Generated from protobuf field <code>optional string extendee = 2;</code>
375 * @param string $var
376 * @return $this
377 */
378 public function setExtendee($var)
379 {
380 GPBUtil::checkString($var, True);
381 $this->extendee = $var;
382
383 return $this;
384 }
385
386 /**
387 * For numeric types, contains the original text representation of the value.
388 * For booleans, "true" or "false".
389 * For strings, contains the default text contents (not escaped in any way).
390 * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
391 *
392 * Generated from protobuf field <code>optional string default_value = 7;</code>
393 * @return string
394 */
395 public function getDefaultValue()
396 {
397 return isset($this->default_value) ? $this->default_value : '';
398 }
399
400 public function hasDefaultValue()
401 {
402 return isset($this->default_value);
403 }
404
405 public function clearDefaultValue()
406 {
407 unset($this->default_value);
408 }
409
410 /**
411 * For numeric types, contains the original text representation of the value.
412 * For booleans, "true" or "false".
413 * For strings, contains the default text contents (not escaped in any way).
414 * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
415 *
416 * Generated from protobuf field <code>optional string default_value = 7;</code>
417 * @param string $var
418 * @return $this
419 */
420 public function setDefaultValue($var)
421 {
422 GPBUtil::checkString($var, True);
423 $this->default_value = $var;
424
425 return $this;
426 }
427
428 /**
429 * If set, gives the index of a oneof in the containing type's oneof_decl
430 * list. This field is a member of that oneof.
431 *
432 * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
433 * @return int
434 */
435 public function getOneofIndex()
436 {
437 return isset($this->oneof_index) ? $this->oneof_index : 0;
438 }
439
440 public function hasOneofIndex()
441 {
442 return isset($this->oneof_index);
443 }
444
445 public function clearOneofIndex()
446 {
447 unset($this->oneof_index);
448 }
449
450 /**
451 * If set, gives the index of a oneof in the containing type's oneof_decl
452 * list. This field is a member of that oneof.
453 *
454 * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
455 * @param int $var
456 * @return $this
457 */
458 public function setOneofIndex($var)
459 {
460 GPBUtil::checkInt32($var);
461 $this->oneof_index = $var;
462
463 return $this;
464 }
465
466 /**
467 * JSON name of this field. The value is set by protocol compiler. If the
468 * user has set a "json_name" option on this field, that option's value
469 * will be used. Otherwise, it's deduced from the field's name by converting
470 * it to camelCase.
471 *
472 * Generated from protobuf field <code>optional string json_name = 10;</code>
473 * @return string
474 */
475 public function getJsonName()
476 {
477 return isset($this->json_name) ? $this->json_name : '';
478 }
479
480 public function hasJsonName()
481 {
482 return isset($this->json_name);
483 }
484
485 public function clearJsonName()
486 {
487 unset($this->json_name);
488 }
489
490 /**
491 * JSON name of this field. The value is set by protocol compiler. If the
492 * user has set a "json_name" option on this field, that option's value
493 * will be used. Otherwise, it's deduced from the field's name by converting
494 * it to camelCase.
495 *
496 * Generated from protobuf field <code>optional string json_name = 10;</code>
497 * @param string $var
498 * @return $this
499 */
500 public function setJsonName($var)
501 {
502 GPBUtil::checkString($var, True);
503 $this->json_name = $var;
504
505 return $this;
506 }
507
508 /**
509 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
510 * @return \Google\Protobuf\Internal\FieldOptions|null
511 */
512 public function getOptions()
513 {
514 return $this->options;
515 }
516
517 public function hasOptions()
518 {
519 return isset($this->options);
520 }
521
522 public function clearOptions()
523 {
524 unset($this->options);
525 }
526
527 /**
528 * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
529 * @param \Google\Protobuf\Internal\FieldOptions $var
530 * @return $this
531 */
532 public function setOptions($var)
533 {
534 GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class);
535 $this->options = $var;
536
537 return $this;
538 }
539
540 /**
541 * If true, this is a proto3 "optional". When a proto3 field is optional, it
542 * tracks presence regardless of field type.
543 * When proto3_optional is true, this field must be belong to a oneof to
544 * signal to old proto3 clients that presence is tracked for this field. This
545 * oneof is known as a "synthetic" oneof, and this field must be its sole
546 * member (each proto3 optional field gets its own synthetic oneof). Synthetic
547 * oneofs exist in the descriptor only, and do not generate any API. Synthetic
548 * oneofs must be ordered after all "real" oneofs.
549 * For message fields, proto3_optional doesn't create any semantic change,
550 * since non-repeated message fields always track presence. However it still
551 * indicates the semantic detail of whether the user wrote "optional" or not.
552 * This can be useful for round-tripping the .proto file. For consistency we
553 * give message fields a synthetic oneof also, even though it is not required
554 * to track presence. This is especially important because the parser can't
555 * tell if a field is a message or an enum, so it must always create a
556 * synthetic oneof.
557 * Proto2 optional fields do not set this flag, because they already indicate
558 * optional with `LABEL_OPTIONAL`.
559 *
560 * Generated from protobuf field <code>optional bool proto3_optional = 17;</code>
561 * @return bool
562 */
563 public function getProto3Optional()
564 {
565 return isset($this->proto3_optional) ? $this->proto3_optional : false;
566 }
567
568 public function hasProto3Optional()
569 {
570 return isset($this->proto3_optional);
571 }
572
573 public function clearProto3Optional()
574 {
575 unset($this->proto3_optional);
576 }
577
578 /**
579 * If true, this is a proto3 "optional". When a proto3 field is optional, it
580 * tracks presence regardless of field type.
581 * When proto3_optional is true, this field must be belong to a oneof to
582 * signal to old proto3 clients that presence is tracked for this field. This
583 * oneof is known as a "synthetic" oneof, and this field must be its sole
584 * member (each proto3 optional field gets its own synthetic oneof). Synthetic
585 * oneofs exist in the descriptor only, and do not generate any API. Synthetic
586 * oneofs must be ordered after all "real" oneofs.
587 * For message fields, proto3_optional doesn't create any semantic change,
588 * since non-repeated message fields always track presence. However it still
589 * indicates the semantic detail of whether the user wrote "optional" or not.
590 * This can be useful for round-tripping the .proto file. For consistency we
591 * give message fields a synthetic oneof also, even though it is not required
592 * to track presence. This is especially important because the parser can't
593 * tell if a field is a message or an enum, so it must always create a
594 * synthetic oneof.
595 * Proto2 optional fields do not set this flag, because they already indicate
596 * optional with `LABEL_OPTIONAL`.
597 *
598 * Generated from protobuf field <code>optional bool proto3_optional = 17;</code>
599 * @param bool $var
600 * @return $this
601 */
602 public function setProto3Optional($var)
603 {
604 GPBUtil::checkBool($var);
605 $this->proto3_optional = $var;
606
607 return $this;
608 }
609
610 }
611