| 528 | } |
| 529 | |
| 530 | void CJsonObject::Clear() |
| 531 | { |
| 532 | m_pExternJsonDataRef = NULL; |
| 533 | m_pKeyTravers = NULL; |
| 534 | if (m_pJsonData != NULL) |
| 535 | { |
| 536 | cJSON_Delete(m_pJsonData); |
| 537 | m_pJsonData = NULL; |
| 538 | } |
| 539 | #if __cplusplus < 201101L |
| 540 | for (std::map<unsigned int, CJsonObject*>::iterator iter = m_mapJsonArrayRef.begin(); |
| 541 | iter != m_mapJsonArrayRef.end(); ++iter) |
| 542 | #else |
| 543 | for (auto iter = m_mapJsonArrayRef.begin(); iter != m_mapJsonArrayRef.end(); ++iter) |
| 544 | #endif |
| 545 | { |
| 546 | if (iter->second != NULL) |
| 547 | { |
| 548 | delete (iter->second); |
| 549 | iter->second = NULL; |
| 550 | } |
| 551 | } |
| 552 | m_mapJsonArrayRef.clear(); |
| 553 | m_array_iter = m_mapJsonArrayRef.end(); |
| 554 | #if __cplusplus < 201101L |
| 555 | for (std::map<std::string, CJsonObject*>::iterator iter = m_mapJsonObjectRef.begin(); |
| 556 | iter != m_mapJsonObjectRef.end(); ++iter) |
| 557 | #else |
| 558 | for (auto iter = m_mapJsonObjectRef.begin(); iter != m_mapJsonObjectRef.end(); ++iter) |
| 559 | #endif |
| 560 | { |
| 561 | if (iter->second != NULL) |
| 562 | { |
| 563 | delete (iter->second); |
| 564 | iter->second = NULL; |
| 565 | } |
| 566 | } |
| 567 | m_mapJsonObjectRef.clear(); |
| 568 | m_object_iter = m_mapJsonObjectRef.end(); |
| 569 | } |
| 570 | |
| 571 | bool CJsonObject::IsEmpty() const |
| 572 | { |
| 573 | if (m_pJsonData != NULL) |
| 574 | { |
| 575 | return(false); |
| 576 | } |
| 577 | else if (m_pExternJsonDataRef != NULL) |
| 578 | { |
| 579 | return(false); |
| 580 | } |
| 581 | return(true); |
| 582 | } |
| 583 | |
| 584 | bool CJsonObject::IsArray() const |
| 585 | { |
| 586 | cJSON* pFocusData = NULL; |
| 587 | if (m_pJsonData != NULL) |
nothing calls this directly
no test coverage detected