xref: /aosp_15_r20/external/protobuf/php/src/Google/Protobuf/Enum.php (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1<?php
2# Generated by the protocol buffer compiler.  DO NOT EDIT!
3# source: google/protobuf/type.proto
4
5namespace Google\Protobuf;
6
7use Google\Protobuf\Internal\GPBType;
8use Google\Protobuf\Internal\RepeatedField;
9use Google\Protobuf\Internal\GPBUtil;
10
11/**
12 * Enum type definition.
13 *
14 * Generated from protobuf message <code>google.protobuf.Enum</code>
15 */
16class Enum extends \Google\Protobuf\Internal\Message
17{
18    /**
19     * Enum type name.
20     *
21     * Generated from protobuf field <code>string name = 1;</code>
22     */
23    protected $name = '';
24    /**
25     * Enum value definitions.
26     *
27     * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
28     */
29    private $enumvalue;
30    /**
31     * Protocol buffer options.
32     *
33     * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
34     */
35    private $options;
36    /**
37     * The source context.
38     *
39     * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
40     */
41    protected $source_context = null;
42    /**
43     * The source syntax.
44     *
45     * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
46     */
47    protected $syntax = 0;
48
49    /**
50     * Constructor.
51     *
52     * @param array $data {
53     *     Optional. Data for populating the Message object.
54     *
55     *     @type string $name
56     *           Enum type name.
57     *     @type array<\Google\Protobuf\EnumValue>|\Google\Protobuf\Internal\RepeatedField $enumvalue
58     *           Enum value definitions.
59     *     @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
60     *           Protocol buffer options.
61     *     @type \Google\Protobuf\SourceContext $source_context
62     *           The source context.
63     *     @type int $syntax
64     *           The source syntax.
65     * }
66     */
67    public function __construct($data = NULL) {
68        \GPBMetadata\Google\Protobuf\Type::initOnce();
69        parent::__construct($data);
70    }
71
72    /**
73     * Enum type name.
74     *
75     * Generated from protobuf field <code>string name = 1;</code>
76     * @return string
77     */
78    public function getName()
79    {
80        return $this->name;
81    }
82
83    /**
84     * Enum type name.
85     *
86     * Generated from protobuf field <code>string name = 1;</code>
87     * @param string $var
88     * @return $this
89     */
90    public function setName($var)
91    {
92        GPBUtil::checkString($var, True);
93        $this->name = $var;
94
95        return $this;
96    }
97
98    /**
99     * Enum value definitions.
100     *
101     * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
102     * @return \Google\Protobuf\Internal\RepeatedField
103     */
104    public function getEnumvalue()
105    {
106        return $this->enumvalue;
107    }
108
109    /**
110     * Enum value definitions.
111     *
112     * Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
113     * @param array<\Google\Protobuf\EnumValue>|\Google\Protobuf\Internal\RepeatedField $var
114     * @return $this
115     */
116    public function setEnumvalue($var)
117    {
118        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\EnumValue::class);
119        $this->enumvalue = $arr;
120
121        return $this;
122    }
123
124    /**
125     * Protocol buffer options.
126     *
127     * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
128     * @return \Google\Protobuf\Internal\RepeatedField
129     */
130    public function getOptions()
131    {
132        return $this->options;
133    }
134
135    /**
136     * Protocol buffer options.
137     *
138     * Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
139     * @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
140     * @return $this
141     */
142    public function setOptions($var)
143    {
144        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
145        $this->options = $arr;
146
147        return $this;
148    }
149
150    /**
151     * The source context.
152     *
153     * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
154     * @return \Google\Protobuf\SourceContext|null
155     */
156    public function getSourceContext()
157    {
158        return $this->source_context;
159    }
160
161    public function hasSourceContext()
162    {
163        return isset($this->source_context);
164    }
165
166    public function clearSourceContext()
167    {
168        unset($this->source_context);
169    }
170
171    /**
172     * The source context.
173     *
174     * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
175     * @param \Google\Protobuf\SourceContext $var
176     * @return $this
177     */
178    public function setSourceContext($var)
179    {
180        GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class);
181        $this->source_context = $var;
182
183        return $this;
184    }
185
186    /**
187     * The source syntax.
188     *
189     * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
190     * @return int
191     */
192    public function getSyntax()
193    {
194        return $this->syntax;
195    }
196
197    /**
198     * The source syntax.
199     *
200     * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
201     * @param int $var
202     * @return $this
203     */
204    public function setSyntax($var)
205    {
206        GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
207        $this->syntax = $var;
208
209        return $this;
210    }
211
212}
213
214