Пример #1
0
void JSDictionary::convertValue(ExecState* exec, JSValue value, ArrayValue& result)
{
    if (value.isUndefinedOrNull())
        return;

    result = ArrayValue(exec, value);
}
Пример #2
0
//////////////////////////////////////////////////////////////////////////
// serialiseArray
//virtual
Json::Value SeJsonWriter::serialiseArray( void* pData, const ReField* pField, BcU32 ParentFlags )
{
	Json::Value ArrayValue( Json::arrayValue );
	auto pFieldValueType = pField->getValueType();
	auto pReadIterator = pField->newReadIterator( pField->getData< void >( pData ) );

	// Iterate over values and serialise individually.
	while( pReadIterator->isValid() )
	{
		void* pValueData = pReadIterator->getValue();

		// Only serialise class types.
		Json::Value ClassValue;
		if( ( pField->getValueFlags() & bcRFF_SIMPLE_DEREF ) == 0 )
		{
			ClassValue = serialiseClass( pValueData, static_cast< const ReClass* >( pFieldValueType ), ParentFlags, false ); 
		}
		else
		{
			void* pPointerValueData = *reinterpret_cast< void** >( pValueData );
			ClassValue = serialisePointer( pPointerValueData, static_cast< const ReClass* >( pFieldValueType ), ParentFlags );
		}

		ArrayValue.append( ClassValue );

		pReadIterator->next();
	}

	delete pReadIterator;

	return ArrayValue;
}
Пример #3
0
static void ArrayInitializer(void)
{
	Int32 label,size=0;
	
	label = vm_genI(op_pushint,0);
	vm_gen0(op_newarray);

	SkipToken(tLBRACK);
	size = ArrayValue(size);
	
	while( Token==tCOMMA )
	{
		SkipToken(tCOMMA);
		size = ArrayValue(size);
	}
	
	SkipToken(tRBRACK);
	vm_patch(label,size);
}
Пример #4
0
bool Dictionary::get(const String& key, ArrayValue& value) const
{
    v8::Local<v8::Value> v8Value;
    if (!getKey(key, v8Value))
        return false;

    if (!v8Value->IsArray())
        return false;

    value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value));
    return true;
}
Пример #5
0
bool Dictionary::get(const String& key, ArrayValue& value) const
{
    v8::Local<v8::Value> v8Value;
    if (!getKey(key, v8Value))
        return false;

    if (!v8Value->IsArray())
        return false;

    ASSERT(m_isolate);
    ASSERT(m_isolate == v8::Isolate::GetCurrent());
    value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value), m_isolate);
    return true;
}
bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, ArrayValue& value)
{
    v8::Local<v8::Value> v8Value;
    if (!dictionary.get(key, v8Value))
        return false;

    if (!v8Value->IsArray())
        return false;

    ASSERT(dictionary.isolate());
    ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent());
    value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value), dictionary.isolate());
    return true;
}