ArrayObject* HTTPFormClass::convertForm(std::vector<FormEntry>& vec)
	{
		AvmCore *core = this->core();
		ArrayObject *out = this->toplevel()->arrayClass->newArray();

		for (std::vector<FormEntry>::iterator it=vec.begin(); it!=vec.end(); it++)
		{
	    	ArrayObject* arr;
	    	Stringp key = core->internStringUTF8((*it).name.data(), (*it).name.length());
	    	Stringp value = core->internStringUTF8((*it).value.data(), (*it).value.length());
	    	//we have it, append
	    	if (out->hasStringProperty(key))
	    	{
	    		arr = (ArrayObject*) core->atomToScriptObject(out->getStringProperty(key));
		    	arr->setUintProperty(arr->get_length(), value->atom());
	    	}
	    	//create array
	    	else
	    	{
		    	arr = this->toplevel()->arrayClass->newArray();
		    	arr->setUintProperty(0, value->atom());
		    	out->setStringProperty(key, arr->atom());
	    	}
		}
		return out;
	}
Example #2
0
	static Atom twoInts(ScriptObject *obj, unsigned int high, unsigned int low) {
		Atom highatom = obj->core()->uintToAtom(high);
		Atom lowatom = obj->core()->uintToAtom(low);
		ArrayObject *ret = obj->toplevel()->arrayClass()->newArray(2);
		ret->setUintProperty(0, highatom);
		ret->setUintProperty(1, lowatom);
		return ret->atom();
	}
	Atom RegExpObject::AS3_exec(Stringp subject)
	{
		if (!subject)
		{
			subject = core()->knull;
		}
		UsesUTF8String utf8Subject(subject);
		ArrayObject *result = _exec(subject, utf8Subject);
		return result ? result->atom() : nullStringAtom;
	}