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