| 660 | } |
| 661 | |
| 662 | bool CJsonObject::Get(const std::string& strKey, CJsonObject& oJsonObject) const |
| 663 | { |
| 664 | cJSON* pJsonStruct = NULL; |
| 665 | if (m_pJsonData != NULL) |
| 666 | { |
| 667 | if (m_pJsonData->type == cJSON_Object) |
| 668 | { |
| 669 | pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); |
| 670 | } |
| 671 | } |
| 672 | else if (m_pExternJsonDataRef != NULL) |
| 673 | { |
| 674 | if(m_pExternJsonDataRef->type == cJSON_Object) |
| 675 | { |
| 676 | pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); |
| 677 | } |
| 678 | } |
| 679 | if (pJsonStruct == NULL) |
| 680 | { |
| 681 | return(false); |
| 682 | } |
| 683 | char* pJsonString = cJSON_Print(pJsonStruct); |
| 684 | std::string strJsonData = pJsonString; |
| 685 | free(pJsonString); |
| 686 | if (oJsonObject.Parse(strJsonData)) |
| 687 | { |
| 688 | return(true); |
| 689 | } |
| 690 | else |
| 691 | { |
| 692 | return(false); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | bool CJsonObject::Get(const std::string& strKey, std::string& strValue) const |
| 697 | { |
no test coverage detected