function Message::fieldDataOnlyByteSize
@ignore
2 calls to Message::fieldDataOnlyByteSize()
- Message::fieldByteSize in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
- Message::serializeRepeatedFieldToStream in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - @ignore
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 1607
Class
- Message
- Parent class of all proto messages. Users should not instantiate this class or extend this class or its child classes by their own. See the comment of specific functions for more details.
Namespace
Google\Protobuf\InternalCode
private function fieldDataOnlyByteSize($field, $value) {
$size = 0;
switch ($field->getType()) {
case GPBType::BOOL:
$size += 1;
break;
case GPBType::FLOAT:
case GPBType::FIXED32:
case GPBType::SFIXED32:
$size += 4;
break;
case GPBType::DOUBLE:
case GPBType::FIXED64:
case GPBType::SFIXED64:
$size += 8;
break;
case GPBType::INT32:
case GPBType::ENUM:
$size += GPBWire::varint32Size($value, true);
break;
case GPBType::UINT32:
$size += GPBWire::varint32Size($value);
break;
case GPBType::UINT64:
case GPBType::INT64:
$size += GPBWire::varint64Size($value);
break;
case GPBType::SINT32:
$size += GPBWire::sint32Size($value);
break;
case GPBType::SINT64:
$size += GPBWire::sint64Size($value);
break;
case GPBType::STRING:
case GPBType::BYTES:
$size += strlen($value);
$size += GPBWire::varint32Size($size);
break;
case GPBType::MESSAGE:
$size += $value->byteSize();
$size += GPBWire::varint32Size($size);
break;
case GPBType::GROUP:
// TODO: Add support.
user_error("Unsupported type.");
break;
default:
user_error("Unsupported type.");
return 0;
}
return $size;
}