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

Method Delete

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

Source from the content-addressed store, hash-verified

1636}
1637
1638bool CJsonObject::Delete(const std::string& strKey)
1639{
1640 cJSON* pFocusData = NULL;
1641 if (m_pJsonData == NULL)
1642 {
1643 pFocusData = m_pExternJsonDataRef;
1644 }
1645 else
1646 {
1647 pFocusData = m_pJsonData;
1648 }
1649 if (pFocusData == NULL)
1650 {
1651 m_strErrMsg = "json data is null!";
1652 return(false);
1653 }
1654 if (pFocusData->type != cJSON_Object)
1655 {
1656 m_strErrMsg = "not a json object! json array?";
1657 return(false);
1658 }
1659 cJSON_DeleteItemFromObject(pFocusData, strKey.c_str());
1660#if __cplusplus < 201101L
1661 std::map<std::string, CJsonObject*>::iterator iter = m_mapJsonObjectRef.find(strKey);
1662#else
1663 auto iter = m_mapJsonObjectRef.find(strKey);
1664#endif
1665 if (iter != m_mapJsonObjectRef.end())
1666 {
1667 if (iter->second != NULL)
1668 {
1669 delete (iter->second);
1670 iter->second = NULL;
1671 }
1672 m_mapJsonObjectRef.erase(iter);
1673 }
1674 m_pKeyTravers = pFocusData;
1675 return(true);
1676}
1677
1678bool CJsonObject::Replace(const std::string& strKey, const CJsonObject& oJsonObject)
1679{

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected