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

Method writePreparedItems

Core/MiniPBCoder.cpp:187–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187MMBuffer MiniPBCoder::writePreparedItems(size_t index) {
188 try {
189 PBEncodeItem *oItem = (index < m_encodeItems->size()) ? &(*m_encodeItems)[index] : nullptr;
190 if (oItem && oItem->compiledSize > 0) {
191 m_outputBuffer = new MMBuffer(oItem->compiledSize);
192 m_outputData = new CodedOutputData(m_outputBuffer->getPtr(), m_outputBuffer->length());
193
194 writeRootObject();
195 }
196
197 return std::move(*m_outputBuffer);
198 } catch (const std::exception &exception) {
199 MMKVError("%s", exception.what());
200 return MMBuffer();
201 } catch (...) {
202 MMKVError("encode fail");
203 return MMBuffer();
204 }
205}
206
207MMBuffer MiniPBCoder::encodeDataWithObject(const MMBuffer &obj) {
208 try {

Callers

nothing calls this directly

Calls 1

MMBufferFunction · 0.70

Tested by

no test coverage detected