void DictImpl::encodeJSON( void const *data, JSON::Encoder &encoder ) const { RC::ConstHandle<StringImpl> keyImplAsStringImpl; if ( isString( m_keyImpl->getType() ) ) keyImplAsStringImpl = RC::ConstHandle<StringImpl>::StaticCast( m_keyImpl ); JSON::ObjectEncoder objectEncoder = encoder.makeObject(); bits_t const *bits = *reinterpret_cast<bits_t const * const *>( data ); if ( bits ) { node_t *node = bits->firstNode; while ( node ) { void const *keyData = immutableKeyData( node ); void const *valueData = immutableValueData( node ); if ( keyImplAsStringImpl ) { JSON::Encoder memberEncoder = objectEncoder.makeMember( keyImplAsStringImpl->getValueData( keyData ), keyImplAsStringImpl->getValueLength( keyData ) ); m_valueImpl->encodeJSON( valueData, memberEncoder ); } else { Util::SimpleString encodedKey; { JSON::Encoder encodedKeyEncoder( &encodedKey ); m_keyImpl->encodeJSON( keyData, encodedKeyEncoder ); } JSON::Encoder memberEncoder = objectEncoder.makeMember( encodedKey ); m_valueImpl->encodeJSON( valueData, memberEncoder ); } node = node->bitsNextNode; } } }
void MethodOp::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_expr->appendJSON( jsonObjectEncoder.makeMember( "expr" ), includeLocation ); jsonObjectEncoder.makeMember( "methodName" ).makeString( m_name ); m_args->appendJSON( jsonObjectEncoder.makeMember( "args" ), includeLocation ); }
void CreateArrayGenerator::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_count->appendJSON( jsonObjectEncoder.makeMember( "count" ), includeLocation ); jsonObjectEncoder.makeMember( "operatorName" ).makeString( m_operatorName ); m_shared->appendJSON( jsonObjectEncoder.makeMember( "shared" ), includeLocation ); }
void ContainerLoop::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Statement::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_dictExpr->appendJSON( jsonObjectEncoder.makeMember( "dictExpr" ), includeLocation ); jsonObjectEncoder.makeMember( "keyName" ).makeString( m_keyName ); if ( m_valueName.length() > 0 ) jsonObjectEncoder.makeMember( "valueName" ).makeString( m_valueName ); m_body->appendJSON( jsonObjectEncoder.makeMember( "body" ), includeLocation ); }
void ProducerWrapper::toJSON( JSON::Encoder &jsonEncoder ) const { JSON::ObjectEncoder jsonObjectEncoder = jsonEncoder.makeObject(); { JSON::Encoder typeNameEncoder = jsonObjectEncoder.makeMember( "kind" ); typeNameEncoder.makeString( getKind() ); } toJSONImpl( jsonObjectEncoder ); }
void Inst::jsonDesc( JSON::Encoder &resultEncoder ) const { JSON::ObjectEncoder resultObjectEncoder = resultEncoder.makeObject(); { JSON::Encoder memberEncoder = resultObjectEncoder.makeMember( "code", 4 ); memberEncoder.makeString( m_code ); } { JSON::Encoder memberEncoder = resultObjectEncoder.makeMember( "jsConstants", 11 ); memberEncoder.makeString( m_jsConstants ); } }
void ArrayCacheWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const { { JSON::Encoder inputEncoder = objectEncoder.makeMember( "input" ); m_inputArrayProducer->toJSON( inputEncoder ); } }
JSONProduceAsyncUserdata( RC::Handle<ValueProducerWrapper> const &valueProducerWrapper_, int32_t serial ) : valueProducerWrapper( valueProducerWrapper_ ) , notifyJSONArg( new Util::SimpleString ) , notifyJSONArgEncoder( notifyJSONArg ) , notifyJSONArgObjectEncoder( notifyJSONArgEncoder.makeObject() ) { notifyJSONArgObjectEncoder.makeMember( "serial" ).makeInteger( serial ); }
void ArrayTransformWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const { { JSON::Encoder jg = objectEncoder.makeMember( "input" ); m_inputArrayProducer->toJSON( jg ); } { JSON::Encoder jg = objectEncoder.makeMember( "operator" ); m_operator->toJSON( jg ); } if ( m_sharedValueProducer ) { JSON::Encoder jg = objectEncoder.makeMember( "shared" ); m_sharedValueProducer->toJSON( jg ); } }
void ResourceLoadNode::onProgress( char const *mimeType, size_t done, size_t total, void *userData ) { if( (size_t)userData != m_streamGeneration ) return; size_t prevSize = m_fabricResourceStreamData.getDataSize(); if ( total < prevSize ) m_fabricResourceStreamData.resizeData( total ); if( done < total ) { std::vector<std::string> src; src.push_back( "DG" ); src.push_back( getName() ); Util::SimpleString json; { JSON::Encoder jsonEncoder( &json ); JSON::ObjectEncoder jsonObjectEncoder = jsonEncoder.makeObject(); { JSON::Encoder memberEncoder = jsonObjectEncoder.makeMember( "received", 8 ); memberEncoder.makeInteger( done ); } { JSON::Encoder memberEncoder = jsonObjectEncoder.makeMember( "total", 5 ); memberEncoder.makeInteger( total ); } } getContext()->jsonNotify( src, "resourceLoadProgress", 20, &json ); } else { m_fabricResourceStreamData.setMIMEType( mimeType ); m_inProgress = false;//[JeromeCG 20111221] Important: set m_inProgress to false since setResourceData's notifications can trigger an evaluation setResourceData( NULL, true ); } }
void ConstString::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); jsonObjectEncoder.makeMember( "value" ).makeString( m_value ); }
void ReturnStatement::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Statement::appendJSONMembers( jsonObjectEncoder, includeLocation ); if ( m_expr ) m_expr->appendJSON( jsonObjectEncoder.makeMember( "expr" ), includeLocation ); }
void ConstValueWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const { JSON::Encoder jg = objectEncoder.makeMember( "data" ); m_unwrapped->getValueDesc()->encodeJSON( m_unwrapped->getImmutableData(), jg ); }
void MemberDecl::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Node::appendJSONMembers( jsonObjectEncoder, includeLocation ); jsonObjectEncoder.makeMember( "name" ).makeString( m_name ); jsonObjectEncoder.makeMember( "type" ).makeString( m_type ); }
void AssignOpImpl::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { FunctionBase::appendJSONMembers( jsonObjectEncoder, includeLocation ); jsonObjectEncoder.makeMember( "op" ).makeString( CG::assignOpUserName( m_assignOpType ) ); m_rhs->appendJSON( jsonObjectEncoder.makeMember( "rhs" ), includeLocation ); }
void IndexOp::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_expr->appendJSON( jsonObjectEncoder.makeMember( "expr" ), includeLocation ); m_indexExpr->appendJSON( jsonObjectEncoder.makeMember( "indexExpr" ), includeLocation ); }
void GlobalConstDecl::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Global::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_constDecl->appendJSON( jsonObjectEncoder.makeMember( "constDecl" ), includeLocation ); }
void CreateConstValue::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_child->appendJSON( jsonObjectEncoder.makeMember( "child" ), includeLocation ); }
void SlicedArrayDesc::jsonDesc( JSON::ObjectEncoder &resultObjectEncoder ) const { ArrayDesc::jsonDesc( resultObjectEncoder ); resultObjectEncoder.makeMember( "internalType" ).makeString( "slicedArray" ); resultObjectEncoder.makeMember( "memberType" ).makeString( getMemberDesc()->getUserName() ); }
void VarDeclStatement::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Statement::appendJSONMembers( jsonObjectEncoder, includeLocation ); jsonObjectEncoder.makeMember( "baseType" ).makeString( m_baseType ); m_varDecls->appendJSON( jsonObjectEncoder.makeMember( "varDecls" ), includeLocation ); }
void FixedArrayDesc::jsonDesc( JSON::ObjectEncoder &resultObjectEncoder ) const { ArrayDesc::jsonDesc( resultObjectEncoder ); resultObjectEncoder.makeMember( "internalType" ).makeString( "fixedArray" ); resultObjectEncoder.makeMember( "numMembers" ).makeInteger( getNumMembers() ); }
void CreateValueCache::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const { Expr::appendJSONMembers( jsonObjectEncoder, includeLocation ); m_input->appendJSON( jsonObjectEncoder.makeMember( "input" ), includeLocation ); }