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

Method writeString

Core/CodedOutputData.cpp:81–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void CodedOutputData::writeString(const string &value) {
82 size_t numberOfBytes = value.size();
83 this->writeRawVarint32((int32_t) numberOfBytes);
84 if (m_position + numberOfBytes > m_size) {
85 auto msg = "m_position: " + to_string(m_position) + ", numberOfBytes: " + to_string(numberOfBytes) +
86 ", m_size: " + to_string(m_size);
87 throw out_of_range(msg);
88 }
89 memcpy(m_ptr + m_position, ((uint8_t *) value.data()), numberOfBytes);
90 m_position += numberOfBytes;
91}
92
93size_t CodedOutputData::spaceLeft() {
94 if (m_size <= m_position) {

Callers 5

writeToParcelMethod · 0.80
writeToParcelMethod · 0.80
writeToParcelMethod · 0.80
writeToParcelMethod · 0.80
writeRootObjectMethod · 0.80

Calls 2

writeRawVarint32Method · 0.95
to_stringFunction · 0.50

Tested by 1

writeToParcelMethod · 0.64