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

Method prepareObjectForEncode

Core/MiniPBCoder.cpp:135–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135size_t MiniPBCoder::prepareObjectForEncode(const MMBuffer &buffer) {
136 m_encodeItems->push_back(PBEncodeItem());
137 PBEncodeItem *encodeItem = &(m_encodeItems->back());
138 size_t index = m_encodeItems->size() - 1;
139 {
140 encodeItem->type = PBEncodeItemType_Data;
141 encodeItem->value.bufferValue = &buffer;
142 encodeItem->valueSize = static_cast<uint32_t>(buffer.length());
143 }
144 encodeItem->compiledSize = pbRawVarint32Size(encodeItem->valueSize) + encodeItem->valueSize;
145
146 return index;
147}
148
149size_t MiniPBCoder::prepareObjectForEncode(const MMKVVector &vec) {
150 m_encodeItems->push_back(PBEncodeItem());

Callers

nothing calls this directly

Calls 6

pbInt32SizeFunction · 0.85
pbUInt32SizeFunction · 0.85
pbInt64SizeFunction · 0.85
pbUInt64SizeFunction · 0.85
PBEncodeItemClass · 0.70
pbRawVarint32SizeFunction · 0.70

Tested by

no test coverage detected