Esempio n. 1
0
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));
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
void VJSSession::_getExpiration( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession)
{
	VTime exp;
	inSession->GetExpiration(exp);
	VJSValue exptime(ioParms.GetContext());
	exptime.SetVValue(exp);
	ioParms.ReturnValue(exptime);
}
Esempio n. 4
0
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();
	}
}
Esempio n. 5
0
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();
}
void VJSImage::_getHeight( XBOX::VJSParms_getProperty& ioParms, VJSPictureContainer* inPict)
{
	VPicture* pic = inPict->GetPict();
	if (pic == nil)
	{
		ioParms.ReturnNumber(0);
	}
	else
	{
		ioParms.ReturnNumber(pic->GetHeight());
	}
}
Esempio n. 7
0
void VJSUser::_getID( XBOX::VJSParms_getProperty& ioParms, CUAGUser* inUser)
{
	VUUID id;
	inUser->GetID(id);
	VString s;
	s.FromVUUID(id);
	ioParms.ReturnString(s);
}
Esempio n. 8
0
void VJSGroup::_getID( XBOX::VJSParms_getProperty& ioParms, CUAGGroup* inGroup)
{
	VUUID id;
	inGroup->GetID(id);
	VString s;
	s.FromVUUID(id);
	ioParms.ReturnString(s);
}
Esempio n. 9
0
void VJSSession::_getID( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession)
{
	VString s;
	VUUID xid;
	inSession->GetID(xid);
	xid.GetString(s);
	ioParms.ReturnString(s);
}
void VJSXMLHttpRequest::_GetStatusText(XBOX::VJSParms_getProperty& ioParms, XMLHttpRequest* inXhr)
{
    if(inXhr)
    {
        XBOX::VString value;
        XBOX::VError res=inXhr->GetStatusText(&value);
        ioParms.ReturnVValue(value);

        //Don't throw any error here, but returns an empty string.
    }
    else
        XBOX::vThrowError(VE_XHRQ_JS_BINDING_ERROR);
}
void VJSXMLHttpRequest::_GetResponseText(XBOX::VJSParms_getProperty& ioParms, XMLHttpRequest* inXhr)
{
    if(inXhr)
    {
        XBOX::VString value;
        XBOX::VError res=inXhr->GetResponseText(&value);

        //returns an empty string on error
        ioParms.ReturnString(value);
    }
    else
        XBOX::vThrowError(VE_XHRQ_JS_BINDING_ERROR);
}
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 VJSXMLHttpRequest::_GetReadyState(XBOX::VJSParms_getProperty& ioParms, XMLHttpRequest* inXhr)
{
    if(inXhr)
    {
        XBOX::VError res;
        XBOX::VLong value;

        res=inXhr->GetReadyState(&value); //Should never fails...
        ioParms.ReturnVValue(value);

        if(res!=XBOX::VE_OK)
            XBOX::vThrowError(res);
    }
    else
        XBOX::vThrowError(VE_XHRQ_JS_BINDING_ERROR);
}
Esempio n. 14
0
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);

		}

	}
}
Esempio n. 15
0
void VJSSession::_getLifeTime( XBOX::VJSParms_getProperty& ioParms, CUAGSession* inSession)
{
	ioParms.ReturnNumber(inSession->GetLifeTime());
}
Esempio n. 16
0
void VJSUser::_getFullName( XBOX::VJSParms_getProperty& ioParms, CUAGUser* inUser)
{
	VString s;
	inUser->GetFullName(s);
	ioParms.ReturnString(s);
}
Esempio n. 17
0
void VJSGroup::_getFullName( XBOX::VJSParms_getProperty& ioParms, CUAGGroup* inGroup)
{
	VString s;
	inGroup->GetFullName(s);
	ioParms.ReturnString(s);
}