int DemosDataSource::GetNumRows( const String& table ) { // table name represents a relative demo path with a trailing "/": // "/" represents the root path inside the demo directory // "tutorials/" represents tutorials subdirectory, etc // if we haven't yet traversed the queried path, do it now if( demoPaths.find( table ) == demoPaths.end() ) { std::string pathStr( table.CString() ); // chop off the trailing "/" if( pathStr.find_last_of( "/" ) + 1 == pathStr.length() ) { pathStr = pathStr.substr( 0, pathStr.length() - 1 ); } // the helper will start sending updates the next frame demoPaths[table] = DemosDataSourceHelper( pathStr, demoExtension ); } if( !lastQueryTable.Empty() ) { // reset cache on directory change if( lastQueryTable != table ) { demoPaths.erase( demoPaths.find( lastQueryTable ) ); NotifyRowChange( lastQueryTable ); } } lastQueryTable = table; const DemosDataSourceHelper &demoPath = demoPaths[table]; return demoPath.GetUpdateIndex(); }
void ItemViewModel::refresh(int rowIndex) { NotifyRowChange("items", rowIndex, 1); }