string EncodeList( const CAtomList &x ) { vector<CAtom *> *pv = x.getValuePtr( ); string strDest; strDest += "l"; for( vector<CAtom *> :: iterator i = pv->begin( ); i != pv->end( ); i++ ) { if( dynamic_cast<CAtomInt *>( *i ) ) strDest += EncodeInt( *dynamic_cast<CAtomInt *>( *i ) ); else if( dynamic_cast<CAtomLong *>( *i ) ) strDest += EncodeLong( *dynamic_cast<CAtomLong *>( *i ) ); else if( dynamic_cast<CAtomString *>( *i ) ) strDest += EncodeString( *dynamic_cast<CAtomString *>( *i ) ); else if( dynamic_cast<CAtomList *>( *i ) ) strDest += EncodeList( *dynamic_cast<CAtomList *>( *i ) ); else if( dynamic_cast<CAtomDicti *>( *i ) ) strDest += EncodeDicti( *dynamic_cast<CAtomDicti *>( *i ) ); } strDest += "e"; return strDest; }
CAtomList :: CAtomList( const CAtomList &c ) { // copy constructor vector<CAtom *> *pvecList = c.getValuePtr( ); for( vector<CAtom *> :: iterator itAtom = pvecList->begin( ); itAtom != pvecList->end( ); itAtom++ ) { if( dynamic_cast<CAtomInt *>( *itAtom ) ) addItem( new CAtomInt( *dynamic_cast<CAtomInt *>( *itAtom ) ) ); else if( dynamic_cast<CAtomLong *>( *itAtom ) ) addItem( new CAtomLong( *dynamic_cast<CAtomLong *>( *itAtom ) ) ); else if( dynamic_cast<CAtomString *>( *itAtom ) ) addItem( new CAtomString( *dynamic_cast<CAtomString *>( *itAtom ) ) ); else if( dynamic_cast<CAtomList *>( *itAtom ) ) addItem( new CAtomList( *dynamic_cast<CAtomList *>( *itAtom ) ) ); else if( dynamic_cast<CAtomDicti *>( *itAtom ) ) addItem( new CAtomDicti( *dynamic_cast<CAtomDicti *>( *itAtom ) ) ); else UTIL_LogPrint( ( gmapLANG_CFG["atomlist_copy_warning"] + "\n" ).c_str( ) ); } }
CAtomList :: CAtomList( const CAtomList &c ) { // copy constructor vector<CAtom *> *pvecList = c.getValuePtr( ); for( vector<CAtom *> :: iterator i = pvecList->begin( ); i != pvecList->end( ); i++ ) { if( dynamic_cast<CAtomInt *>( *i ) ) addItem( new CAtomInt( *dynamic_cast<CAtomInt *>( *i ) ) ); else if( dynamic_cast<CAtomLong *>( *i ) ) addItem( new CAtomLong( *dynamic_cast<CAtomLong *>( *i ) ) ); else if( dynamic_cast<CAtomString *>( *i ) ) addItem( new CAtomString( *dynamic_cast<CAtomString *>( *i ) ) ); else if( dynamic_cast<CAtomList *>( *i ) ) addItem( new CAtomList( *dynamic_cast<CAtomList *>( *i ) ) ); else if( dynamic_cast<CAtomDicti *>( *i ) ) addItem( new CAtomDicti( *dynamic_cast<CAtomDicti *>( *i ) ) ); else UTIL_LogPrint( "error copying list - found invalid atom, ignoring\n" ); } }