CAtomDicti *DecodeDicti( const string &x, unsigned long iStart ) { unsigned long i = iStart + 1; CAtomDicti *pDicti = new CAtomDicti( ); while( i < x.size( ) && x[i] != 'e' ) { CAtom *pKey = Decode( x, i ); if( pKey && dynamic_cast<CAtomString *>( pKey ) ) { i += pKey->EncodedLength( ); string strKey = pKey->toString( ); delete pKey; if( i < x.size( ) ) { CAtom *pValue = Decode( x, i ); if( pValue ) { i += pValue->EncodedLength( ); pDicti->setItem( strKey, pValue ); } else { UTIL_LogPrint( "error decoding dictionary - error decoding value, discarding dictionary\n" ); delete pDicti; return NULL; } } } else { UTIL_LogPrint( "error decoding dictionary - error decoding key, discarding dictionary\n" ); delete pDicti; return NULL; } } return pDicti; }
CAtomList *DecodeList( const string &x, unsigned long iStart ) { unsigned long i = iStart + 1; CAtomList *pList = new CAtomList( ); while( i < x.size( ) && x[i] != 'e' ) { CAtom *pAtom = Decode( x, i ); if( pAtom ) { i += pAtom->EncodedLength( ); pList->addItem( pAtom ); } else { UTIL_LogPrint( "error decoding list - error decoding list item, discarding list\n" ); delete pList; return NULL; } } return pList; }