MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / Clear

Method Clear

common/map_sdk/transmission/src/CJsonObject.cpp:260–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260void CJsonObject::Clear() {
261 m_pExternJsonDataRef = NULL;
262 if (m_pJsonData != NULL) {
263 cJSON_Delete(m_pJsonData);
264 m_pJsonData = NULL;
265 }
266 for (std::map<unsigned int, CJsonObject*>::iterator iter = m_mapJsonArrayRef.begin(); iter != m_mapJsonArrayRef.end();
267 ++iter) {
268 if (iter->second != NULL) {
269 delete (iter->second);
270 iter->second = NULL;
271 }
272 }
273 m_mapJsonArrayRef.clear();
274 for (std::map<std::string, CJsonObject*>::iterator iter = m_mapJsonObjectRef.begin();
275 iter != m_mapJsonObjectRef.end(); ++iter) {
276 if (iter->second != NULL) {
277 delete (iter->second);
278 iter->second = NULL;
279 }
280 }
281 m_mapJsonObjectRef.clear();
282}
283
284bool CJsonObject::IsEmpty() const {
285 if (m_pJsonData != NULL) {

Callers

nothing calls this directly

Calls 4

cJSON_DeleteFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected