示例#1
0
bool VJSStorageClass::_SetProperty (XBOX::VJSParms_setProperty &ioParms, VJSStorageObject *inStorageObject)
{
	xbox_assert(inStorageObject != NULL);
 
	XBOX::VString	name;

	if (!ioParms.GetPropertyName(name))

		return true;

	if (name.EqualToUSASCIICString("length")) 

		return true;

	sLONG	i;

	for (i = 0; i < kNumberMethods; i++)
	{
		if (name.EqualToUSASCIICString(kMethodNames[i]))

			return true;
	}
	inStorageObject->SetKeyValue(name, ioParms.GetPropertyValue());
	return true;
}
示例#2
0
void VJSStorageClass::_HasProperty (XBOX::VJSParms_hasProperty &ioParms, VJSStorageObject *inStorageObject)
{
	xbox_assert(inStorageObject != NULL);

	XBOX::VString	name;

	if (!ioParms.GetPropertyName(name))

		ioParms.ReturnFalse();

	else {

		if (inStorageObject->HasKey(name)
		|| name.EqualToUSASCIICString("length"))

			ioParms.ReturnTrue();

		else {

			sLONG	i;
		
			for (i = 0; i < kNumberMethods; i++) 

				if (name.EqualToUSASCIICString(kMethodNames[i])) 

					ioParms.ReturnTrue();

			ioParms.ReturnFalse();

		}

	}
}
示例#3
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);

		}

	}
}