Ejemplo n.º 1
0
 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;
     }
   }
 }
Ejemplo n.º 2
0
 std::string FabricResourceWrapper::getStringMember( size_t index ) const
 {
   RC::ConstHandle<RT::StringDesc> stringDesc = m_rtManager->getStringDesc();
   const void* extension = m_desc->getImmutableMemberData( m_resource, index );
   return std::string( stringDesc->getValueData( extension ), stringDesc->getValueLength( extension ) );
 }