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