Exemple #1
0
void ElementArraySerializer::Deserialize(Archive& archive)
{
    // if we are referring to a real field, clear its contents
    m_Data->clear();

    archive.Deserialize(m_Data.Ref());
}
void SimpleElementMapSerializer<KeyT>::Deserialize(Archive& archive)
{
    V_Element components;
    archive.Deserialize(components, ArchiveFlags::Sparse);

    if (components.size() % 2 != 0)
    {
        throw Reflect::DataFormatException( TXT( "Unmatched map objects" ) );
    }

    // if we are referring to a real field, clear its contents
    m_Data->clear();

    V_Element::iterator itr = components.begin();
    V_Element::iterator end = components.end();
    for ( ; itr != end; ++itr )
    {
        Serializer* key = ObjectCast<Serializer>(*itr);
        Element* value = *(++itr);
        if ( key && value )
        {
            KeyT k;
            Serializer::GetValue( key, k );
            m_Data.Ref()[ k ] = value;
        }
    }
}
Exemple #3
0
void SimpleSetSerializer<DataT, DataSer>::Deserialize(Archive& archive)
{
    V_Element components;
    archive.Deserialize(components);

    // if we are referring to a real field, clear its contents
    m_Data->clear();

    V_Element::iterator itr = components.begin();
    V_Element::iterator end = components.end();
    for ( ; itr != end; ++itr )
    {
        DataSer* data = ObjectCast<DataSer>(*itr);
        if (!data)
        {
            throw LogisticException( TXT( "Set value type has changed, this is unpossible" ) );
        }

        m_Data->insert(data->m_Data.Get());
    }
}