bool CJSONValue::FindElement (const CString &sKey, CJSONValue *retValue) const // FindElement // // Finds a field in a structure { switch (m_iType) { case typeObject: { ObjectType *pObj = (ObjectType *)m_pValue; CJSONValue *pValue = pObj->GetAt(sKey); if (pValue == NULL) return false; if (retValue) *retValue = *pValue; return true; } default: return false; } }
const CJSONValue &CJSONValue::GetElement (const CString &sKey) const // GetElement // // Returns the element by key { switch (m_iType) { case typeObject: { ObjectType *pObj = (ObjectType *)m_pValue; CJSONValue *pValue = pObj->GetAt(sKey); if (pValue == NULL) return g_NullValue; return *pValue; } default: return g_NullValue; } }