Example #1
0
VJSValue VJSObject::GetProperty( const VString& inPropertyName, JS4D::ExceptionRef *outException) const
{
	JSStringRef jsName = JS4D::VStringToString( inPropertyName);
	JSValueRef valueRef = JSObjectGetProperty( fContext, fObject, jsName, outException);
	JSStringRelease( jsName);
	return VJSValue( fContext, valueRef);
}
void VJSImage::_getMeta( XBOX::VJSParms_getProperty& ioParms, VJSPictureContainer* inPict)
{
	VPicture* pic = inPict->GetPict();
	if (inPict->MetaInfoInited())
	{
		ioParms.ReturnValue(VJSValue(ioParms.GetContextRef(), inPict->GetMetaInfo()));
	}
	else if (pic != nil)
	{
		/*
		const VPictureData* picdata = pic->RetainNthPictData(1);
		if (picdata != nil)
		*/
		{
			//const VValueBag* metadata = picdata->RetainMetadatas();
			const VValueBag* metadata = inPict->RetainMetaBag();
			if (metadata != nil)
			{
				VString jsons;
				metadata->GetJSONString(jsons, JSON_UniqueSubElementsAreNotArrays);
				VJSJSON json(ioParms.GetContextRef());
				metadata->Release();

				VJSValue result(json.Parse(jsons));

				if (!result.IsUndefined())
				{
	#if 0
					// plante pour l'instant, il faut que je comprenne
					inPict->SetMetaInfo(result, ioParms.GetContextRef());
					ioParms.ReturnValue(VJSValue(ioParms.GetContextRef(), inPict->GetMetaInfo()));
	#else
					ioParms.ReturnValue(VJSValue(ioParms.GetContextRef(), result));
	#endif
				}
				else
					ioParms.ReturnNullValue();
			}
			//picdata->Release();
		}
	}
}
Example #3
0
VJSValue VJSArray::GetValueAt( size_t inIndex, JS4D::ExceptionRef *outException) const
{
	return VJSValue( fContext, JSObjectGetPropertyAtIndex( fContext, fObject, inIndex, outException));
}