Ejemplo n.º 1
0
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;
		}
	}
Ejemplo n.º 2
0
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;
		}
	}