• 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    private $name = '';
24    private $has_name = false;
25    /**
26     * Generated from protobuf field <code>optional int32 number = 3;</code>
27     */
28    private $number = 0;
29    private $has_number = false;
30    /**
31     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
32     */
33    private $label = 0;
34    private $has_label = false;
35    /**
36     * If type_name is set, this need not be set.  If both this and type_name
37     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
38     *
39     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
40     */
41    private $type = 0;
42    private $has_type = false;
43    /**
44     * For message and enum types, this is the name of the type.  If the name
45     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
46     * rules are used to find the type (i.e. first the nested types within this
47     * message are searched, then within the parent, on up to the root
48     * namespace).
49     *
50     * Generated from protobuf field <code>optional string type_name = 6;</code>
51     */
52    private $type_name = '';
53    private $has_type_name = false;
54    /**
55     * For extensions, this is the name of the type being extended.  It is
56     * resolved in the same manner as type_name.
57     *
58     * Generated from protobuf field <code>optional string extendee = 2;</code>
59     */
60    private $extendee = '';
61    private $has_extendee = false;
62    /**
63     * For numeric types, contains the original text representation of the value.
64     * For booleans, "true" or "false".
65     * For strings, contains the default text contents (not escaped in any way).
66     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
67     * TODO(kenton):  Base-64 encode?
68     *
69     * Generated from protobuf field <code>optional string default_value = 7;</code>
70     */
71    private $default_value = '';
72    private $has_default_value = false;
73    /**
74     * If set, gives the index of a oneof in the containing type's oneof_decl
75     * list.  This field is a member of that oneof.
76     *
77     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
78     */
79    private $oneof_index = 0;
80    private $has_oneof_index = false;
81    /**
82     * JSON name of this field. The value is set by protocol compiler. If the
83     * user has set a "json_name" option on this field, that option's value
84     * will be used. Otherwise, it's deduced from the field's name by converting
85     * it to camelCase.
86     *
87     * Generated from protobuf field <code>optional string json_name = 10;</code>
88     */
89    private $json_name = '';
90    private $has_json_name = false;
91    /**
92     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
93     */
94    private $options = null;
95    private $has_options = false;
96
97    /**
98     * Constructor.
99     *
100     * @param array $data {
101     *     Optional. Data for populating the Message object.
102     *
103     *     @type string $name
104     *     @type int $number
105     *     @type int $label
106     *     @type int $type
107     *           If type_name is set, this need not be set.  If both this and type_name
108     *           are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
109     *     @type string $type_name
110     *           For message and enum types, this is the name of the type.  If the name
111     *           starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
112     *           rules are used to find the type (i.e. first the nested types within this
113     *           message are searched, then within the parent, on up to the root
114     *           namespace).
115     *     @type string $extendee
116     *           For extensions, this is the name of the type being extended.  It is
117     *           resolved in the same manner as type_name.
118     *     @type string $default_value
119     *           For numeric types, contains the original text representation of the value.
120     *           For booleans, "true" or "false".
121     *           For strings, contains the default text contents (not escaped in any way).
122     *           For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
123     *           TODO(kenton):  Base-64 encode?
124     *     @type int $oneof_index
125     *           If set, gives the index of a oneof in the containing type's oneof_decl
126     *           list.  This field is a member of that oneof.
127     *     @type string $json_name
128     *           JSON name of this field. The value is set by protocol compiler. If the
129     *           user has set a "json_name" option on this field, that option's value
130     *           will be used. Otherwise, it's deduced from the field's name by converting
131     *           it to camelCase.
132     *     @type \Google\Protobuf\Internal\FieldOptions $options
133     * }
134     */
135    public function __construct($data = NULL) {
136        \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
137        parent::__construct($data);
138    }
139
140    /**
141     * Generated from protobuf field <code>optional string name = 1;</code>
142     * @return string
143     */
144    public function getName()
145    {
146        return $this->name;
147    }
148
149    /**
150     * Generated from protobuf field <code>optional string name = 1;</code>
151     * @param string $var
152     * @return $this
153     */
154    public function setName($var)
155    {
156        GPBUtil::checkString($var, True);
157        $this->name = $var;
158        $this->has_name = true;
159
160        return $this;
161    }
162
163    public function hasName()
164    {
165        return $this->has_name;
166    }
167
168    /**
169     * Generated from protobuf field <code>optional int32 number = 3;</code>
170     * @return int
171     */
172    public function getNumber()
173    {
174        return $this->number;
175    }
176
177    /**
178     * Generated from protobuf field <code>optional int32 number = 3;</code>
179     * @param int $var
180     * @return $this
181     */
182    public function setNumber($var)
183    {
184        GPBUtil::checkInt32($var);
185        $this->number = $var;
186        $this->has_number = true;
187
188        return $this;
189    }
190
191    public function hasNumber()
192    {
193        return $this->has_number;
194    }
195
196    /**
197     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
198     * @return int
199     */
200    public function getLabel()
201    {
202        return $this->label;
203    }
204
205    /**
206     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
207     * @param int $var
208     * @return $this
209     */
210    public function setLabel($var)
211    {
212        GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class);
213        $this->label = $var;
214        $this->has_label = true;
215
216        return $this;
217    }
218
219    public function hasLabel()
220    {
221        return $this->has_label;
222    }
223
224    /**
225     * If type_name is set, this need not be set.  If both this and type_name
226     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
227     *
228     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
229     * @return int
230     */
231    public function getType()
232    {
233        return $this->type;
234    }
235
236    /**
237     * If type_name is set, this need not be set.  If both this and type_name
238     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
239     *
240     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
241     * @param int $var
242     * @return $this
243     */
244    public function setType($var)
245    {
246        GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class);
247        $this->type = $var;
248        $this->has_type = true;
249
250        return $this;
251    }
252
253    public function hasType()
254    {
255        return $this->has_type;
256    }
257
258    /**
259     * For message and enum types, this is the name of the type.  If the name
260     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
261     * rules are used to find the type (i.e. first the nested types within this
262     * message are searched, then within the parent, on up to the root
263     * namespace).
264     *
265     * Generated from protobuf field <code>optional string type_name = 6;</code>
266     * @return string
267     */
268    public function getTypeName()
269    {
270        return $this->type_name;
271    }
272
273    /**
274     * For message and enum types, this is the name of the type.  If the name
275     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
276     * rules are used to find the type (i.e. first the nested types within this
277     * message are searched, then within the parent, on up to the root
278     * namespace).
279     *
280     * Generated from protobuf field <code>optional string type_name = 6;</code>
281     * @param string $var
282     * @return $this
283     */
284    public function setTypeName($var)
285    {
286        GPBUtil::checkString($var, True);
287        $this->type_name = $var;
288        $this->has_type_name = true;
289
290        return $this;
291    }
292
293    public function hasTypeName()
294    {
295        return $this->has_type_name;
296    }
297
298    /**
299     * For extensions, this is the name of the type being extended.  It is
300     * resolved in the same manner as type_name.
301     *
302     * Generated from protobuf field <code>optional string extendee = 2;</code>
303     * @return string
304     */
305    public function getExtendee()
306    {
307        return $this->extendee;
308    }
309
310    /**
311     * For extensions, this is the name of the type being extended.  It is
312     * resolved in the same manner as type_name.
313     *
314     * Generated from protobuf field <code>optional string extendee = 2;</code>
315     * @param string $var
316     * @return $this
317     */
318    public function setExtendee($var)
319    {
320        GPBUtil::checkString($var, True);
321        $this->extendee = $var;
322        $this->has_extendee = true;
323
324        return $this;
325    }
326
327    public function hasExtendee()
328    {
329        return $this->has_extendee;
330    }
331
332    /**
333     * For numeric types, contains the original text representation of the value.
334     * For booleans, "true" or "false".
335     * For strings, contains the default text contents (not escaped in any way).
336     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
337     * TODO(kenton):  Base-64 encode?
338     *
339     * Generated from protobuf field <code>optional string default_value = 7;</code>
340     * @return string
341     */
342    public function getDefaultValue()
343    {
344        return $this->default_value;
345    }
346
347    /**
348     * For numeric types, contains the original text representation of the value.
349     * For booleans, "true" or "false".
350     * For strings, contains the default text contents (not escaped in any way).
351     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
352     * TODO(kenton):  Base-64 encode?
353     *
354     * Generated from protobuf field <code>optional string default_value = 7;</code>
355     * @param string $var
356     * @return $this
357     */
358    public function setDefaultValue($var)
359    {
360        GPBUtil::checkString($var, True);
361        $this->default_value = $var;
362        $this->has_default_value = true;
363
364        return $this;
365    }
366
367    public function hasDefaultValue()
368    {
369        return $this->has_default_value;
370    }
371
372    /**
373     * If set, gives the index of a oneof in the containing type's oneof_decl
374     * list.  This field is a member of that oneof.
375     *
376     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
377     * @return int
378     */
379    public function getOneofIndex()
380    {
381        return $this->oneof_index;
382    }
383
384    /**
385     * If set, gives the index of a oneof in the containing type's oneof_decl
386     * list.  This field is a member of that oneof.
387     *
388     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
389     * @param int $var
390     * @return $this
391     */
392    public function setOneofIndex($var)
393    {
394        GPBUtil::checkInt32($var);
395        $this->oneof_index = $var;
396        $this->has_oneof_index = true;
397
398        return $this;
399    }
400
401    public function hasOneofIndex()
402    {
403        return $this->has_oneof_index;
404    }
405
406    /**
407     * JSON name of this field. The value is set by protocol compiler. If the
408     * user has set a "json_name" option on this field, that option's value
409     * will be used. Otherwise, it's deduced from the field's name by converting
410     * it to camelCase.
411     *
412     * Generated from protobuf field <code>optional string json_name = 10;</code>
413     * @return string
414     */
415    public function getJsonName()
416    {
417        return $this->json_name;
418    }
419
420    /**
421     * JSON name of this field. The value is set by protocol compiler. If the
422     * user has set a "json_name" option on this field, that option's value
423     * will be used. Otherwise, it's deduced from the field's name by converting
424     * it to camelCase.
425     *
426     * Generated from protobuf field <code>optional string json_name = 10;</code>
427     * @param string $var
428     * @return $this
429     */
430    public function setJsonName($var)
431    {
432        GPBUtil::checkString($var, True);
433        $this->json_name = $var;
434        $this->has_json_name = true;
435
436        return $this;
437    }
438
439    public function hasJsonName()
440    {
441        return $this->has_json_name;
442    }
443
444    /**
445     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
446     * @return \Google\Protobuf\Internal\FieldOptions
447     */
448    public function getOptions()
449    {
450        return $this->options;
451    }
452
453    /**
454     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
455     * @param \Google\Protobuf\Internal\FieldOptions $var
456     * @return $this
457     */
458    public function setOptions($var)
459    {
460        GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class);
461        $this->options = $var;
462        $this->has_options = true;
463
464        return $this;
465    }
466
467    public function hasOptions()
468    {
469        return $this->has_options;
470    }
471
472}
473
474