| 673 | } |
| 674 | |
| 675 | bool CJsonObject::Get(const std::string& strKey, CJsonObject& oJsonObject) const |
| 676 | { |
| 677 | cJSON* pJsonStruct = NULL; |
| 678 | if (m_pJsonData != NULL) |
| 679 | { |
| 680 | if (m_pJsonData->type == cJSON_Object) |
| 681 | { |
| 682 | pJsonStruct = cJSON_GetObjectItem(m_pJsonData, strKey.c_str()); |
| 683 | } |
| 684 | } |
| 685 | else if (m_pExternJsonDataRef != NULL) |
| 686 | { |
| 687 | if(m_pExternJsonDataRef->type == cJSON_Object) |
| 688 | { |
| 689 | pJsonStruct = cJSON_GetObjectItem(m_pExternJsonDataRef, strKey.c_str()); |
| 690 | } |
| 691 | } |
| 692 | if (pJsonStruct == NULL) |
| 693 | { |
| 694 | return(false); |
| 695 | } |
| 696 | char* pJsonString = cJSON_Print(pJsonStruct); |
| 697 | std::string strJsonData = pJsonString; |
| 698 | free(pJsonString); |
| 699 | if (oJsonObject.Parse(strJsonData)) |
| 700 | { |
| 701 | return(true); |
| 702 | } |
| 703 | else |
| 704 | { |
| 705 | return(false); |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | bool CJsonObject::Get(const std::string& strKey, std::string& strValue) const |
| 710 | { |
no test coverage detected