Exemple #1
0
bool VJSONObject::SetProperty( const VString& inName, const VJSONValue& inValue)
{
    bool ok = true;
    try
    {
        if (inValue.IsUndefined())
            fMap.erase( inName);
        else
        {
            std::pair<MapType::iterator,bool> i = fMap.insert( MapType::value_type( inName, inValue));
            if (!i.second)
                i.first->second = inValue;

            VJSONGraph::Connect( &fGraph, inValue);
        }
    }
    catch(...)
    {
        ok = false;
    }
    return ok;
}
bool VJSONObject::SetProperty( const VString& inName, const VJSONValue& inValue)
{
	bool ok;
	EJSONStatus status = EJSON_unhandled;

	if (fImpl != NULL)
	{
		status = fImpl->IJSON_SetProperty( this, inName, inValue);
		ok = (status == EJSON_ok);
	}

	if (status == EJSON_unhandled)
	{
		try
		{
			ok = true;
			if (inValue.IsUndefined())
				fMap.erase( inName);
			else
			{
				std::pair<MapType::iterator,bool> i = fMap.insert( MapType::value_type( inName, std::pair<VJSONValue,size_t>(inValue,fMap.size())));
				if (!i.second)
				{
					i.first->second.first = inValue;
				}
					
				VJSONGraph::Connect( &fGraph, inValue);
			}
		}
		catch(...)
		{
			ok = false;
		}
	}
	
	return ok;
}