Lines Matching refs:field
99 foreach ($this->desc->getField() as $field) {
100 $setter = $field->getSetter();
101 if ($field->isMap()) {
102 $message_type = $field->getMessageType();
128 } else if ($field->getLabel() === GPBLabel::REPEATED) {
129 switch ($field->getType()) {
133 $field->getType(),
134 $field->getMessageType()->getClass());
139 $field->getType(),
140 $field->getEnumType()->getClass());
144 $repeated_field = new RepeatedField($field->getType());
148 } else if ($field->getOneofIndex() !== -1) {
149 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
152 } else if ($field->getLabel() === GPBLabel::OPTIONAL &&
154 switch ($field->getType()) {
172 foreach ($desc->getField() as $field) {
173 $setter = $field->getSetter();
174 $defaultValue = $this->defaultValue($field);
181 $field = $this->desc->getFieldByName($member);
182 $oneof_index = $field->getOneofIndex();
186 $wrapper = $this->readOneof($field->getNumber());
198 $field = $this->desc->getFieldByName($member);
201 $desc = $field->getMessageType();
207 $oneof_index = $field->getOneofIndex();
211 $this->writeOneof($field->getNumber(), $wrapped_value);
217 $field = $this->desc->getFieldByNumber($number);
218 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
224 return $this->defaultValue($field);
230 $field = $this->desc->getFieldByNumber($number);
231 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
239 $field = $this->desc->getFieldByNumber($number);
240 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
244 $oneof_field->setFieldName($field->getName());
255 $field = $this->desc->getFieldByNumber($number);
256 return $field->getName();
262 private function defaultValue($field) argument
266 switch ($field->getType()) {
362 private static function parseFieldFromStreamNoTag($input, $field, &$value) argument
364 switch ($field->getType()) {
424 if ($field->isMap()) {
425 $value = new MapEntry($field->getMessageType());
427 $klass = $field->getMessageType()->getClass();
488 private function parseFieldFromStream($tag, $input, $field) argument
492 if (is_null($field)) {
495 GPBWire::getWireType($field->getType())) {
497 } elseif ($field->isPackable() &&
510 self::parseFieldFromStreamNoTag($input, $field, $value);
518 $getter = $field->getGetter();
520 self::parseFieldFromStreamNoTag($input, $field, $value);
521 $this->appendHelper($field, $value);
529 if ($field->isMap()) {
530 $this->kvUpdateHelper($field, $value->getKey(), $value->getValue());
531 } else if ($field->isRepeated()) {
532 $this->appendHelper($field, $value);
534 $setter = $field->getSetter();
546 foreach ($this->desc->getField() as $field) {
547 $setter = $field->getSetter();
548 if ($field->isMap()) {
549 $message_type = $field->getMessageType();
575 } else if ($field->getLabel() === GPBLabel::REPEATED) {
576 switch ($field->getType()) {
580 $field->getType(),
581 $field->getMessageType()->getClass());
586 $field->getType(),
587 $field->getEnumType()->getClass());
591 $repeated_field = new RepeatedField($field->getType());
595 } else if ($field->getOneofIndex() !== -1) {
596 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
599 } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
600 switch ($field->getType()) {
627 switch ($field->getType()) {
636 switch ($field->getType()) {
656 foreach ($this->desc->getField() as $field) {
657 if ($field->getType() != GPBType::MESSAGE) {
660 if ($field->isMap()) {
661 $value_field = $field->getMessageType()->getFieldByNumber(2);
665 $getter = $field->getGetter();
670 } else if ($field->getLabel() === GPBLabel::REPEATED) {
671 $getter = $field->getGetter();
676 } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
677 $getter = $field->getGetter();
706 foreach ($this->desc->getField() as $field) {
707 $setter = $field->getSetter();
708 $getter = $field->getGetter();
709 if ($field->isMap()) {
711 $value_field = $field->getMessageType()->getFieldByNumber(2);
718 $this->kvUpdateHelper($field, $key, $copy);
720 $this->kvUpdateHelper($field, $key, $value);
724 } else if ($field->getLabel() === GPBLabel::REPEATED) {
727 if ($field->getType() == GPBType::MESSAGE) {
728 $klass = $field->getMessageType()->getClass();
731 $this->appendHelper($field, $copy);
733 $this->appendHelper($field, $tmp);
737 } else if ($field->getLabel() === GPBLabel::OPTIONAL) {
738 if($msg->$getter() !== $this->defaultValue($field)) {
740 if ($field->getType() == GPBType::MESSAGE) {
742 $klass = $field->getMessageType()->getClass();
804 $field = $this->desc->getFieldByNumber($number);
806 $this->parseFieldFromStream($tag, $input, $field);
812 $field, argument
816 switch ($field->getType()) {
818 $klass = $field->getMessageType()->getClass();
823 return $this->defaultValue($field);
828 } else if ($field->isTimestamp()) {
830 return $this->defaultValue($field);
845 return $this->defaultValue($field);
856 return $this->defaultValue($field);
867 return $this->defaultValue($field);
872 $enum_value = $field->getEnumType()->getValueByName($value);
876 return $this->defaultValue($field);
883 return $this->defaultValue($field);
895 return $this->defaultValue($field);
908 return $this->defaultValue($field);
928 return $this->defaultValue($field);
944 return $this->defaultValue($field);
966 return $this->defaultValue($field);
985 return $this->defaultValue($field);
1007 return $this->defaultValue($field);
1056 $field = $this->desc->getFieldByName($key);
1057 if (is_null($field)) {
1061 $setter = $field->getSetter();
1062 if ($field->isMap()) {
1063 $valueField = $field->getMessageType()->getFieldByName('value');
1067 } elseif ($field->isWrapperType()) {
1068 $class = $field->getMessageType()->getClass();
1069 if ($field->isRepeated()) {
1239 $field = $this->desc->getFieldByJsonName($key);
1240 if (is_null($field)) {
1241 $field = $this->desc->getFieldByName($key);
1242 if (is_null($field)) {
1246 if ($field->isMap()) {
1250 $key_field = $field->getMessageType()->getFieldByNumber(1);
1251 $value_field = $field->getMessageType()->getFieldByNumber(2);
1266 self::kvUpdateHelper($field, $proto_key, $proto_value);
1268 } else if ($field->isRepeated()) {
1279 $field,
1281 self::appendHelper($field, $proto_value);
1284 $setter = $field->getSetter();
1287 $field,
1289 if ($field->getType() === GPBType::MESSAGE) {
1293 $getter = $field->getGetter();
1333 private function serializeSingularFieldToStream($field, &$output) argument
1335 if (!$this->existField($field)) {
1338 $getter = $field->getGetter();
1340 if (!GPBWire::serializeFieldToStream($value, $field, true, $output)) {
1349 private function serializeRepeatedFieldToStream($field, &$output) argument
1351 $getter = $field->getGetter();
1358 $packed = $field->getPacked();
1362 GPBWire::makeTag($field->getNumber(), GPBType::STRING))) {
1367 $size += $this->fieldDataOnlyByteSize($field, $value);
1377 $field,
1389 private function serializeMapFieldToStream($field, $output) argument
1391 $getter = $field->getGetter();
1399 $map_entry = new MapEntry($field->getMessageType());
1404 $field,
1416 private function serializeFieldToStream(&$output, $field) argument
1418 if ($field->isMap()) {
1419 return $this->serializeMapFieldToStream($field, $output);
1420 } elseif ($field->isRepeated()) {
1421 return $this->serializeRepeatedFieldToStream($field, $output);
1423 return $this->serializeSingularFieldToStream($field, $output);
1430 private function serializeFieldToJsonStream(&$output, $field) argument
1432 $getter = $field->getGetter();
1435 $values, $field, $output, !GPBUtil::hasSpecialJsonMapping($this));
1444 foreach ($fields as $field) {
1445 if (!$this->serializeFieldToStream($output, $field)) {
1475 foreach ($value_fields as $field) {
1476 if ($value_msg->existField($field)) {
1478 if (!$value_msg->serializeFieldToJsonStream($output, $field)) {
1501 $field = $this->desc->getField()[1];
1502 if (!$this->existField($field)) {
1505 if (!$this->serializeFieldToJsonStream($output, $field)) {
1510 $field = $this->desc->getField()[1];
1511 if (!$this->existField($field)) {
1514 if (!$this->serializeFieldToJsonStream($output, $field)) {
1524 foreach ($fields as $field) {
1525 if ($this->existField($field) ||
1532 if (!$this->serializeFieldToJsonStream($output, $field)) {
1569 private function existField($field) argument
1571 $getter = $field->getGetter();
1576 } else if ($field->getOneofIndex() !== -1) {
1579 $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()];
1581 return $this->$oneof_name->getNumber() === $field->getNumber();
1585 if ($field->isMap()) {
1587 } elseif ($field->isRepeated()) {
1590 return $values !== $this->defaultValue($field);
1597 private function repeatedFieldDataOnlyByteSize($field) argument
1601 $getter = $field->getGetter();
1605 $size += $count * GPBWire::tagSize($field);
1607 $size += $this->singularFieldDataOnlyByteSize($field);
1615 private function fieldDataOnlyByteSize($field, $value) argument
1619 switch ($field->getType()) {
1674 private function fieldDataOnlyJsonByteSize($field, $value) argument
1678 switch ($field->getType()) {
1726 $enum_desc = $field->getEnumType();
1769 user_error("Unsupported type " . $field->getType());
1779 private function fieldByteSize($field) argument
1782 if ($field->isMap()) {
1783 $getter = $field->getGetter();
1787 $size += $count * GPBWire::tagSize($field);
1788 $message_type = $field->getMessageType();
1808 } elseif ($field->isRepeated()) {
1809 $getter = $field->getGetter();
1813 if ($field->getPacked()) {
1816 $data_size += $this->fieldDataOnlyByteSize($field, $value);
1818 $size += GPBWire::tagSize($field);
1822 $size += $count * GPBWire::tagSize($field);
1824 $size += $this->fieldDataOnlyByteSize($field, $value);
1828 } elseif ($this->existField($field)) {
1829 $size += GPBWire::tagSize($field);
1830 $getter = $field->getGetter();
1832 $size += $this->fieldDataOnlyByteSize($field, $value);
1840 private function fieldJsonByteSize($field) argument
1844 if ($field->isMap()) {
1845 $getter = $field->getGetter();
1851 $size += strlen($field->getJsonName()); // size for field name
1855 $getter = $field->getGetter();
1856 $map_entry = $field->getMessageType();
1880 } elseif ($field->isRepeated()) {
1881 $getter = $field->getGetter();
1887 $size += strlen($field->getJsonName()); // size for field name
1891 $getter = $field->getGetter();
1893 $size += $this->fieldDataOnlyJsonByteSize($field, $value);
1896 } elseif ($this->existField($field) || GPBUtil::hasJsonValue($this)) {
1899 $size += strlen($field->getJsonName()); // size for field name
1901 $getter = $field->getGetter();
1903 $size += $this->fieldDataOnlyJsonByteSize($field, $value);
1916 foreach ($fields as $field) {
1917 $size += $this->fieldByteSize($field);
1923 private function appendHelper($field, $append_value) argument
1925 $getter = $field->getGetter();
1926 $setter = $field->getSetter();
1936 private function kvUpdateHelper($field, $update_key, $update_value) argument
1938 $getter = $field->getGetter();
1939 $setter = $field->getSetter();
1985 $field = $this->desc->getField()[1];
1986 if ($this->existField($field)) {
1987 $field_size = $this->fieldJsonByteSize($field);
1994 $field = $this->desc->getField()[1];
1995 if ($this->existField($field)) {
1996 $field_size = $this->fieldJsonByteSize($field);
2010 foreach ($fields as $field) {
2011 $field_size = $this->fieldJsonByteSize($field);