MCPcopy Create free account
hub / github.com/Tencent/MMKV / getEncodeData

Method getEncodeData

Core/MiniPBCoder.cpp:604–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602
603#ifdef MMKV_HAS_CPP20
604MMBuffer MiniPBCoder::getEncodeData(const std::vector<bool> &value) {
605 auto valueLength = static_cast<uint32_t>(value.size() * pbBoolSize());
606 auto size = pbRawVarint32Size(valueLength) + valueLength;
607 auto buffer = MMBuffer(size);
608 CodedOutputData output(buffer.getPtr(), size);
609 output.writeUInt32(valueLength);
610
611 for (auto single : value) {
612 output.writeBool(single);
613 }
614 return buffer;
615}
616
617MMBuffer MiniPBCoder::getEncodeData(const std::span<const float> &value) {
618 auto valueLength = static_cast<uint32_t>(value.size() * pbFloatSize());

Callers 1

encodeDataWithObjectFunction · 0.80

Calls 9

pbBoolSizeFunction · 0.85
pbFloatSizeFunction · 0.85
pbDoubleSizeFunction · 0.85
writeUInt32Method · 0.80
writeBoolMethod · 0.80
writeFloatMethod · 0.80
writeDoubleMethod · 0.80
pbRawVarint32SizeFunction · 0.70
MMBufferFunction · 0.70

Tested by

no test coverage detected