static cbnode_t* bufferGetLine(CBuffer* cb, uint idx) { cbnode_t* node = NULL; assert(cb); if(!(cb->numLines == 0 || idx >= cb->numLines)) { rebuildIndex(cb); node = cb->index[idx]; } return node; }
/** ***************************************************************************/ Terminal::Extension::Extension() : IExtension("Terminal"), dirtyFlag_(false) { qDebug("[%s] Initialize extension", name_); QString iconPath = XdgIconLookup::instance()->themeIconPath("terminal", QIcon::themeName()); iconPath_ = iconPath.isNull() ? ":calc" : iconPath; connect(&watcher_, &QFileSystemWatcher::directoryChanged, [this](){ dirtyFlag_ = true; }); rebuildIndex(); qDebug("[%s] Extension initialized", name_); }
bool OsmAnd::TileDB::openIndex() { QMutexLocker scopeLock(&_indexMutex); bool ok; bool shouldRebuild = indexFilename.isEmpty() || !QFile(indexFilename).exists(); _indexDb.setDatabaseName(indexFilename.isEmpty() ? ":memory:" : indexFilename); ok = _indexDb.open(); if(!ok) { LogPrintf(LogSeverityLevel::Error, "Failed to open TileDB index from '%s': %s", qPrintable(indexFilename), qPrintable(_indexDb.lastError().text())); return false; } if(shouldRebuild) rebuildIndex(); return true; }
/** ***************************************************************************/ void Terminal::Extension::teardownSession() { if ( dirtyFlag_ ) // Build rebuild the chache rebuildIndex(); }