PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/protobuf/php/src/Google/Protobuf/Field.php

https://github.com/chromium/chromium
PHP | 381 lines | 122 code | 36 blank | 223 comment | 0 complexity | 51acadfeb22515ca9f66079df655ae16 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0, BSD-3-Clause
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: google/protobuf/type.proto
  4. namespace Google\Protobuf;
  5. use Google\Protobuf\Internal\GPBType;
  6. use Google\Protobuf\Internal\RepeatedField;
  7. use Google\Protobuf\Internal\GPBUtil;
  8. /**
  9. * A single field of a message type.
  10. *
  11. * Generated from protobuf message <code>google.protobuf.Field</code>
  12. */
  13. class Field extends \Google\Protobuf\Internal\Message
  14. {
  15. /**
  16. * The field type.
  17. *
  18. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  19. */
  20. private $kind = 0;
  21. /**
  22. * The field cardinality.
  23. *
  24. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  25. */
  26. private $cardinality = 0;
  27. /**
  28. * The field number.
  29. *
  30. * Generated from protobuf field <code>int32 number = 3;</code>
  31. */
  32. private $number = 0;
  33. /**
  34. * The field name.
  35. *
  36. * Generated from protobuf field <code>string name = 4;</code>
  37. */
  38. private $name = '';
  39. /**
  40. * The field type URL, without the scheme, for message or enumeration
  41. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  42. *
  43. * Generated from protobuf field <code>string type_url = 6;</code>
  44. */
  45. private $type_url = '';
  46. /**
  47. * The index of the field type in `Type.oneofs`, for message or enumeration
  48. * types. The first type has index 1; zero means the type is not in the list.
  49. *
  50. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  51. */
  52. private $oneof_index = 0;
  53. /**
  54. * Whether to use alternative packed wire representation.
  55. *
  56. * Generated from protobuf field <code>bool packed = 8;</code>
  57. */
  58. private $packed = false;
  59. /**
  60. * The protocol buffer options.
  61. *
  62. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  63. */
  64. private $options;
  65. /**
  66. * The field JSON name.
  67. *
  68. * Generated from protobuf field <code>string json_name = 10;</code>
  69. */
  70. private $json_name = '';
  71. /**
  72. * The string value of the default value of this field. Proto2 syntax only.
  73. *
  74. * Generated from protobuf field <code>string default_value = 11;</code>
  75. */
  76. private $default_value = '';
  77. /**
  78. * Constructor.
  79. *
  80. * @param array $data {
  81. * Optional. Data for populating the Message object.
  82. *
  83. * @type int $kind
  84. * The field type.
  85. * @type int $cardinality
  86. * The field cardinality.
  87. * @type int $number
  88. * The field number.
  89. * @type string $name
  90. * The field name.
  91. * @type string $type_url
  92. * The field type URL, without the scheme, for message or enumeration
  93. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  94. * @type int $oneof_index
  95. * The index of the field type in `Type.oneofs`, for message or enumeration
  96. * types. The first type has index 1; zero means the type is not in the list.
  97. * @type bool $packed
  98. * Whether to use alternative packed wire representation.
  99. * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
  100. * The protocol buffer options.
  101. * @type string $json_name
  102. * The field JSON name.
  103. * @type string $default_value
  104. * The string value of the default value of this field. Proto2 syntax only.
  105. * }
  106. */
  107. public function __construct($data = NULL) {
  108. \GPBMetadata\Google\Protobuf\Type::initOnce();
  109. parent::__construct($data);
  110. }
  111. /**
  112. * The field type.
  113. *
  114. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  115. * @return int
  116. */
  117. public function getKind()
  118. {
  119. return $this->kind;
  120. }
  121. /**
  122. * The field type.
  123. *
  124. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  125. * @param int $var
  126. * @return $this
  127. */
  128. public function setKind($var)
  129. {
  130. GPBUtil::checkEnum($var, \Google\Protobuf\Field_Kind::class);
  131. $this->kind = $var;
  132. return $this;
  133. }
  134. /**
  135. * The field cardinality.
  136. *
  137. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  138. * @return int
  139. */
  140. public function getCardinality()
  141. {
  142. return $this->cardinality;
  143. }
  144. /**
  145. * The field cardinality.
  146. *
  147. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  148. * @param int $var
  149. * @return $this
  150. */
  151. public function setCardinality($var)
  152. {
  153. GPBUtil::checkEnum($var, \Google\Protobuf\Field_Cardinality::class);
  154. $this->cardinality = $var;
  155. return $this;
  156. }
  157. /**
  158. * The field number.
  159. *
  160. * Generated from protobuf field <code>int32 number = 3;</code>
  161. * @return int
  162. */
  163. public function getNumber()
  164. {
  165. return $this->number;
  166. }
  167. /**
  168. * The field number.
  169. *
  170. * Generated from protobuf field <code>int32 number = 3;</code>
  171. * @param int $var
  172. * @return $this
  173. */
  174. public function setNumber($var)
  175. {
  176. GPBUtil::checkInt32($var);
  177. $this->number = $var;
  178. return $this;
  179. }
  180. /**
  181. * The field name.
  182. *
  183. * Generated from protobuf field <code>string name = 4;</code>
  184. * @return string
  185. */
  186. public function getName()
  187. {
  188. return $this->name;
  189. }
  190. /**
  191. * The field name.
  192. *
  193. * Generated from protobuf field <code>string name = 4;</code>
  194. * @param string $var
  195. * @return $this
  196. */
  197. public function setName($var)
  198. {
  199. GPBUtil::checkString($var, True);
  200. $this->name = $var;
  201. return $this;
  202. }
  203. /**
  204. * The field type URL, without the scheme, for message or enumeration
  205. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  206. *
  207. * Generated from protobuf field <code>string type_url = 6;</code>
  208. * @return string
  209. */
  210. public function getTypeUrl()
  211. {
  212. return $this->type_url;
  213. }
  214. /**
  215. * The field type URL, without the scheme, for message or enumeration
  216. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  217. *
  218. * Generated from protobuf field <code>string type_url = 6;</code>
  219. * @param string $var
  220. * @return $this
  221. */
  222. public function setTypeUrl($var)
  223. {
  224. GPBUtil::checkString($var, True);
  225. $this->type_url = $var;
  226. return $this;
  227. }
  228. /**
  229. * The index of the field type in `Type.oneofs`, for message or enumeration
  230. * types. The first type has index 1; zero means the type is not in the list.
  231. *
  232. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  233. * @return int
  234. */
  235. public function getOneofIndex()
  236. {
  237. return $this->oneof_index;
  238. }
  239. /**
  240. * The index of the field type in `Type.oneofs`, for message or enumeration
  241. * types. The first type has index 1; zero means the type is not in the list.
  242. *
  243. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  244. * @param int $var
  245. * @return $this
  246. */
  247. public function setOneofIndex($var)
  248. {
  249. GPBUtil::checkInt32($var);
  250. $this->oneof_index = $var;
  251. return $this;
  252. }
  253. /**
  254. * Whether to use alternative packed wire representation.
  255. *
  256. * Generated from protobuf field <code>bool packed = 8;</code>
  257. * @return bool
  258. */
  259. public function getPacked()
  260. {
  261. return $this->packed;
  262. }
  263. /**
  264. * Whether to use alternative packed wire representation.
  265. *
  266. * Generated from protobuf field <code>bool packed = 8;</code>
  267. * @param bool $var
  268. * @return $this
  269. */
  270. public function setPacked($var)
  271. {
  272. GPBUtil::checkBool($var);
  273. $this->packed = $var;
  274. return $this;
  275. }
  276. /**
  277. * The protocol buffer options.
  278. *
  279. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  280. * @return \Google\Protobuf\Internal\RepeatedField
  281. */
  282. public function getOptions()
  283. {
  284. return $this->options;
  285. }
  286. /**
  287. * The protocol buffer options.
  288. *
  289. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  290. * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
  291. * @return $this
  292. */
  293. public function setOptions($var)
  294. {
  295. $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
  296. $this->options = $arr;
  297. return $this;
  298. }
  299. /**
  300. * The field JSON name.
  301. *
  302. * Generated from protobuf field <code>string json_name = 10;</code>
  303. * @return string
  304. */
  305. public function getJsonName()
  306. {
  307. return $this->json_name;
  308. }
  309. /**
  310. * The field JSON name.
  311. *
  312. * Generated from protobuf field <code>string json_name = 10;</code>
  313. * @param string $var
  314. * @return $this
  315. */
  316. public function setJsonName($var)
  317. {
  318. GPBUtil::checkString($var, True);
  319. $this->json_name = $var;
  320. return $this;
  321. }
  322. /**
  323. * The string value of the default value of this field. Proto2 syntax only.
  324. *
  325. * Generated from protobuf field <code>string default_value = 11;</code>
  326. * @return string
  327. */
  328. public function getDefaultValue()
  329. {
  330. return $this->default_value;
  331. }
  332. /**
  333. * The string value of the default value of this field. Proto2 syntax only.
  334. *
  335. * Generated from protobuf field <code>string default_value = 11;</code>
  336. * @param string $var
  337. * @return $this
  338. */
  339. public function setDefaultValue($var)
  340. {
  341. GPBUtil::checkString($var, True);
  342. $this->default_value = $var;
  343. return $this;
  344. }
  345. }