| 3676 | } |
| 3677 | |
| 3678 | bool CJsonObject::AddNullAsFirst() |
| 3679 | { |
| 3680 | cJSON* pFocusData = NULL; |
| 3681 | if (m_pJsonData != NULL) |
| 3682 | { |
| 3683 | pFocusData = m_pJsonData; |
| 3684 | } |
| 3685 | else if (m_pExternJsonDataRef != NULL) |
| 3686 | { |
| 3687 | pFocusData = m_pExternJsonDataRef; |
| 3688 | } |
| 3689 | else |
| 3690 | { |
| 3691 | m_pJsonData = cJSON_CreateArray(); |
| 3692 | pFocusData = m_pJsonData; |
| 3693 | } |
| 3694 | |
| 3695 | if (pFocusData == NULL) |
| 3696 | { |
| 3697 | m_strErrMsg = "json data is null!"; |
| 3698 | return(false); |
| 3699 | } |
| 3700 | if (pFocusData->type != cJSON_Array) |
| 3701 | { |
| 3702 | m_strErrMsg = "not a json array! json object?"; |
| 3703 | return(false); |
| 3704 | } |
| 3705 | cJSON* pJsonStruct = cJSON_CreateNull(); |
| 3706 | if (pJsonStruct == NULL) |
| 3707 | { |
| 3708 | return(false); |
| 3709 | } |
| 3710 | int iArraySizeBeforeAdd = cJSON_GetArraySize(pFocusData); |
| 3711 | cJSON_AddItemToArrayHead(pFocusData, pJsonStruct); |
| 3712 | int iArraySizeAfterAdd = cJSON_GetArraySize(pFocusData); |
| 3713 | if (iArraySizeAfterAdd == iArraySizeBeforeAdd) |
| 3714 | { |
| 3715 | return(false); |
| 3716 | } |
| 3717 | return(true); |
| 3718 | } |
| 3719 | |
| 3720 | bool CJsonObject::Delete(int iWhich) |
| 3721 | { |
nothing calls this directly
no test coverage detected