MCPcopy Create free account
hub / github.com/commontk/CTK / findResourcesPath

Method findResourcesPath

Libs/PluginFramework/ctkPluginStorageSQL.cpp:662–701  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

660
661//----------------------------------------------------------------------------
662QStringList ctkPluginStorageSQL::findResourcesPath(int archiveKey, const QString& path) const
663{
664 QSqlDatabase database = getConnection();
665 QSqlQuery query(database);
666
667 QString statement = "SELECT SUBSTR(ResourcePath,?) FROM PluginResources WHERE K=? AND SUBSTR(ResourcePath,1,?)=?";
668
669 QString resourcePath = path.startsWith('/') ? path : QString("/") + path;
670 if (!resourcePath.endsWith('/'))
671 resourcePath += "/";
672
673 QList<QVariant> bindValues;
674 bindValues.append(resourcePath.size()+1);
675 bindValues.append(archiveKey);
676 bindValues.append(resourcePath.size());
677 bindValues.append(resourcePath);
678
679 executeQuery(&query, statement, bindValues);
680
681 QSet<QString> paths;
682 while (query.next())
683 {
684 QString currPath = query.value(EBindIndex).toString();
685 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
686 QStringList components = currPath.split('/', Qt::SkipEmptyParts);
687 #else
688 QStringList components = currPath.split('/', QString::SkipEmptyParts);
689 #endif
690 if (components.size() == 1)
691 {
692 paths << components.front();
693 }
694 else if (components.size() == 2)
695 {
696 paths << components.front() + "/";
697 }
698 }
699
700 return ctk::qSetToQStringList(paths);
701}
702
703//----------------------------------------------------------------------------
704void ctkPluginStorageSQL::executeQuery(QSqlQuery *query, const QString &statement, const QList<QVariant> &bindValues) const

Callers 2

findResourceEntriesMethod · 0.45
getResourceListMethod · 0.45

Calls 4

QStringClass · 0.50
sizeMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected