ObjectPtr ArchiveXML::FromString( const tstring& xml, const Class* searchClass ) { if ( searchClass == NULL ) { searchClass = Reflect::GetClass<Object>(); } ArchiveXML archive; archive.m_SearchClass = searchClass; tstringstream strStream; strStream << xml; archive.m_Stream = new Reflect::TCharStream(&strStream, false); archive.Read(); std::vector< ObjectPtr >::iterator itr = archive.m_Objects.begin(); std::vector< ObjectPtr >::iterator end = archive.m_Objects.end(); for ( ; itr != end; ++itr ) { if ((*itr)->IsClass(searchClass)) { return *itr; } } return NULL; }
void ArchiveXML::FromString( const tstring& xml, std::vector< ObjectPtr >& objects ) { ArchiveXML archive; tstringstream strStream; strStream << xml; archive.m_Stream = new Reflect::TCharStream( &strStream, false ); archive.Read(); objects = archive.m_Objects; }