void VJSSession::_getStorage( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession) { VString s; VJSSessionStorageObject* storage = inSession->GetStorageObject(); if (storage != nil) ioParms.ReturnValue(VJSStorageClass::CreateInstance(ioParms.GetContext(), storage)); }
void VJSSession::_getExpiration( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession) { VTime exp; inSession->GetExpiration(exp); VJSValue exptime(ioParms.GetContext()); exptime.SetVValue(exp); ioParms.ReturnValue(exptime); }
void VJSSession::_getUser( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession) { VString s; CUAGUser* user = inSession->RetainUser(); if (user != nil) ioParms.ReturnValue(user->CreateJSUserObject(ioParms.GetContext())); QuickReleaseRefCountable(user); }
void VJSUser::_getStorage( XBOX::VJSParms_getProperty& ioParms, CUAGUser* inUser) { VJSSessionStorageObject* storage = inUser->RetainStorageObject(); if (storage != nil) { ioParms.ReturnValue(VJSStorageClass::CreateInstance(ioParms.GetContext(), storage)); storage->Release(); } }
void VJSStorageClass::_GetProperty (XBOX::VJSParms_getProperty &ioParms, VJSStorageObject *inStorageObject) { xbox_assert(inStorageObject != NULL); XBOX::VString name; if (!ioParms.GetPropertyName(name)) ioParms.ReturnNullValue(); else if (name.EqualToUSASCIICString("length")) { XBOX::VJSValue length(ioParms.GetContext()); length.SetNumber(inStorageObject->NumberKeysValues()); ioParms.ReturnValue(length); } else { XBOX::VJSValue value(ioParms.GetContext()); value.SetNull(); sLONG i; for (i = 0; i < kNumberMethods; i++) if (name.EqualToUSASCIICString(kMethodNames[i])) { ioParms.ForwardToParent(); break; } if (i == kNumberMethods) { inStorageObject->GetKeyValue(name, &value); ioParms.ReturnValue(value); } } }
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(); } } }
void VJSDirectory::_getInternalStore( XBOX::VJSParms_getProperty& ioParms, CUAGDirectory* inDirectory) { CDB4DBase* base = inDirectory->RetainAndExposeDB(); if (base != NULL) { ioParms.ReturnValue(base->CreateJSDatabaseObject(ioParms.GetContext())); ReleaseRefCountable( &base); // sc 20/06/2012 } else ioParms.ReturnNullValue(); }