MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / AddNull

Method AddNull

eval/LANE_evaluation/lane2d/src/CJsonObject.cpp:1591–1636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1589#endif
1590
1591bool CJsonObject::AddNull(const std::string& strKey)
1592{
1593 cJSON* pFocusData = NULL;
1594 if (m_pJsonData != NULL)
1595 {
1596 pFocusData = m_pJsonData;
1597 }
1598 else if (m_pExternJsonDataRef != NULL)
1599 {
1600 pFocusData = m_pExternJsonDataRef;
1601 }
1602 else
1603 {
1604 m_pJsonData = cJSON_CreateObject();
1605 m_pKeyTravers = m_pJsonData;
1606 pFocusData = m_pJsonData;
1607 }
1608
1609 if (pFocusData == NULL)
1610 {
1611 m_strErrMsg = "json data is null!";
1612 return(false);
1613 }
1614 if (pFocusData->type != cJSON_Object)
1615 {
1616 m_strErrMsg = "not a json object! json array?";
1617 return(false);
1618 }
1619 if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) != NULL)
1620 {
1621 m_strErrMsg = "key exists!";
1622 return(false);
1623 }
1624 cJSON* pJsonStruct = cJSON_CreateNull();
1625 if (pJsonStruct == NULL)
1626 {
1627 return(false);
1628 }
1629 cJSON_AddItemToObject(pFocusData, strKey.c_str(), pJsonStruct);
1630 if (cJSON_GetObjectItem(pFocusData, strKey.c_str()) == NULL)
1631 {
1632 return(false);
1633 }
1634 m_pKeyTravers = pFocusData;
1635 return(true);
1636}
1637
1638bool CJsonObject::Delete(const std::string& strKey)
1639{

Callers

nothing calls this directly

Calls 7

cJSON_CreateObjectFunction · 0.85
cJSON_GetObjectItemFunction · 0.85
cJSON_CreateNullFunction · 0.85
cJSON_AddItemToObjectFunction · 0.85
cJSON_CreateArrayFunction · 0.85
cJSON_GetArraySizeFunction · 0.85
cJSON_AddItemToArrayFunction · 0.85

Tested by

no test coverage detected