LibrePCB Developers Documentation
WorkspaceLibraryDb Class Referencefinal

The WorkspaceLibraryDb class. More...

#include <workspacelibrarydb.h>

Inherits QObject.

+ Collaboration diagram for WorkspaceLibraryDb:

Signals

void scanStarted ()
 
void scanLibraryListUpdated (int libraryCount)
 
void scanProgressUpdate (int percent)
 
void scanSucceeded (int elementCount)
 
void scanFailed (QString errorMsg)
 
void scanFinished ()
 

Public Member Functions

 WorkspaceLibraryDb ()=delete
 
 WorkspaceLibraryDb (const WorkspaceLibraryDb &other)=delete
 
 WorkspaceLibraryDb (Workspace &ws)
 Constructor to open the library database of an existing workspace. More...
 
 ~WorkspaceLibraryDb () noexcept
 
const FilePathgetFilePath () const noexcept
 
QMultiMap< Version, FilePathgetLibraries () const
 
QMultiMap< Version, FilePathgetLibraries (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetComponentCategories (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetPackageCategories (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetSymbols (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetPackages (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetComponents (const Uuid &uuid) const
 
QMultiMap< Version, FilePathgetDevices (const Uuid &uuid) const
 
FilePath getLatestLibrary (const Uuid &uuid) const
 
FilePath getLatestComponentCategory (const Uuid &uuid) const
 
FilePath getLatestPackageCategory (const Uuid &uuid) const
 
FilePath getLatestSymbol (const Uuid &uuid) const
 
FilePath getLatestPackage (const Uuid &uuid) const
 
FilePath getLatestComponent (const Uuid &uuid) const
 
FilePath getLatestDevice (const Uuid &uuid) const
 
template<typename ElementType >
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<typename ElementType >
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<typename ElementType >
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name=nullptr, QString *desc=nullptr, QString *keywords=nullptr) const
 
template<typename ElementType >
void getElementMetadata (const FilePath elemDir, Uuid *uuid=nullptr, Version *version=nullptr) const
 
void getLibraryMetadata (const FilePath libDir, QPixmap *icon=nullptr) const
 
void getDeviceMetadata (const FilePath &devDir, Uuid *pkgUuid=nullptr, Uuid *cmpUuid=nullptr) const
 
QSet< UuidgetComponentCategoryChilds (const tl::optional< Uuid > &parent) const
 
QSet< UuidgetPackageCategoryChilds (const tl::optional< Uuid > &parent) const
 
QList< UuidgetComponentCategoryParents (const Uuid &category) const
 
QList< UuidgetPackageCategoryParents (const Uuid &category) const
 
void getComponentCategoryElementCount (const tl::optional< Uuid > &category, int *categories, int *symbols, int *components, int *devices) const
 
void getPackageCategoryElementCount (const tl::optional< Uuid > &category, int *categories, int *packages) const
 
QSet< UuidgetSymbolsByCategory (const tl::optional< Uuid > &category) const
 
QSet< UuidgetPackagesByCategory (const tl::optional< Uuid > &category) const
 
QSet< UuidgetComponentsByCategory (const tl::optional< Uuid > &category) const
 
QSet< UuidgetDevicesByCategory (const tl::optional< Uuid > &category) const
 
QSet< UuidgetDevicesOfComponent (const Uuid &component) const
 
void startLibraryRescan () noexcept
 Rescan the whole library directory and update the SQLite database. More...
 
WorkspaceLibraryDboperator= (const WorkspaceLibraryDb &rhs)=delete
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< UuidgetElementsBySearchKeyword (const QString &keyword) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
QList< FilePathgetLibraryElements (const FilePath &lib) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementTranslations (const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 
template<>
void getElementMetadata (const FilePath elemDir, Uuid *uuid, Version *version) const
 

Private Member Functions

void getElementTranslations (const QString &table, const QString &idRow, const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) const
 
void getElementMetadata (const QString &table, const FilePath elemDir, Uuid *uuid, Version *version) const
 
QMultiMap< Version, FilePathgetElementFilePathsFromDb (const QString &tablename, const Uuid &uuid) const
 
FilePath getLatestVersionFilePath (const QMultiMap< Version, FilePath > &list) const noexcept
 
QSet< UuidgetCategoryChilds (const QString &tablename, const tl::optional< Uuid > &categoryUuid) const
 
QList< UuidgetCategoryParents (const QString &tablename, const Uuid &category) const
 
tl::optional< UuidgetCategoryParent (const QString &tablename, const Uuid &category) const
 
int getCategoryChildCount (const QString &tablename, const tl::optional< Uuid > &category) const
 
int getCategoryElementCount (const QString &tablename, const QString &idrowname, const tl::optional< Uuid > &category) const
 
QSet< UuidgetElementsByCategory (const QString &tablename, const QString &idrowname, const tl::optional< Uuid > &categoryUuid) const
 
QList< UuidgetElementsBySearchKeyword (const QString &tablename, const QString &idrowname, const QString &keyword) const
 
int getLibraryId (const FilePath &lib) const
 
QList< FilePathgetLibraryElements (const FilePath &lib, const QString &tablename) const
 
void createAllTables ()
 
void setDbVersion (int version)
 
int getDbVersion () const noexcept
 

Private Attributes

WorkspacemWorkspace
 
FilePath mFilePath
 path to the SQLite database More...
 
QScopedPointer< SQLiteDatabasemDb
 the SQLite database More...
 
QScopedPointer< WorkspaceLibraryScannermLibraryScanner
 

Static Private Attributes

static const int sCurrentDbVersion = 2
 

Detailed Description

The WorkspaceLibraryDb class.

Constructor & Destructor Documentation

◆ WorkspaceLibraryDb() [1/3]

WorkspaceLibraryDb ( )
delete

◆ WorkspaceLibraryDb() [2/3]

WorkspaceLibraryDb ( const WorkspaceLibraryDb other)
delete

◆ WorkspaceLibraryDb() [3/3]

WorkspaceLibraryDb ( Workspace ws)
explicit

Constructor to open the library database of an existing workspace.

Parameters
wsThe workspace object
Exceptions
ExceptionIf the library could not be opened, this constructor throws an exception.
+ Here is the call graph for this function:

◆ ~WorkspaceLibraryDb()

~WorkspaceLibraryDb ( )
noexcept

Member Function Documentation

◆ getFilePath()

const FilePath& getFilePath ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ getLibraries() [1/2]

QMultiMap< Version, FilePath > getLibraries ( ) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLibraries() [2/2]

QMultiMap< Version, FilePath > getLibraries ( const Uuid uuid) const
+ Here is the call graph for this function:

◆ getComponentCategories()

QMultiMap< Version, FilePath > getComponentCategories ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackageCategories()

QMultiMap< Version, FilePath > getPackageCategories ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSymbols()

QMultiMap< Version, FilePath > getSymbols ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackages()

QMultiMap< Version, FilePath > getPackages ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponents()

QMultiMap< Version, FilePath > getComponents ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDevices()

QMultiMap< Version, FilePath > getDevices ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestLibrary()

FilePath getLatestLibrary ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestComponentCategory()

FilePath getLatestComponentCategory ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestPackageCategory()

FilePath getLatestPackageCategory ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestSymbol()

FilePath getLatestSymbol ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestPackage()

FilePath getLatestPackage ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestComponent()

FilePath getLatestComponent ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestDevice()

FilePath getLatestDevice ( const Uuid uuid) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementsBySearchKeyword() [1/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the caller graph for this function:

◆ getLibraryElements() [1/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the caller graph for this function:

◆ getElementTranslations() [1/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name = nullptr,
QString *  desc = nullptr,
QString *  keywords = nullptr 
) const
+ Here is the caller graph for this function:

◆ getElementMetadata() [1/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid = nullptr,
Version version = nullptr 
) const
+ Here is the caller graph for this function:

◆ getLibraryMetadata()

void getLibraryMetadata ( const FilePath  libDir,
QPixmap *  icon = nullptr 
) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceMetadata()

void getDeviceMetadata ( const FilePath devDir,
Uuid pkgUuid = nullptr,
Uuid cmpUuid = nullptr 
) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentCategoryChilds()

QSet< Uuid > getComponentCategoryChilds ( const tl::optional< Uuid > &  parent) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackageCategoryChilds()

QSet< Uuid > getPackageCategoryChilds ( const tl::optional< Uuid > &  parent) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentCategoryParents()

QList< Uuid > getComponentCategoryParents ( const Uuid category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackageCategoryParents()

QList< Uuid > getPackageCategoryParents ( const Uuid category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentCategoryElementCount()

void getComponentCategoryElementCount ( const tl::optional< Uuid > &  category,
int *  categories,
int *  symbols,
int *  components,
int *  devices 
) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackageCategoryElementCount()

void getPackageCategoryElementCount ( const tl::optional< Uuid > &  category,
int *  categories,
int *  packages 
) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSymbolsByCategory()

QSet< Uuid > getSymbolsByCategory ( const tl::optional< Uuid > &  category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPackagesByCategory()

QSet< Uuid > getPackagesByCategory ( const tl::optional< Uuid > &  category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentsByCategory()

QSet< Uuid > getComponentsByCategory ( const tl::optional< Uuid > &  category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDevicesByCategory()

QSet< Uuid > getDevicesByCategory ( const tl::optional< Uuid > &  category) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDevicesOfComponent()

QSet< Uuid > getDevicesOfComponent ( const Uuid component) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startLibraryRescan()

void startLibraryRescan ( )
noexcept

Rescan the whole library directory and update the SQLite database.

+ Here is the caller graph for this function:

◆ operator=()

WorkspaceLibraryDb& operator= ( const WorkspaceLibraryDb rhs)
delete
+ Here is the caller graph for this function:

◆ scanStarted

void scanStarted ( )
signal
+ Here is the caller graph for this function:

◆ scanLibraryListUpdated

void scanLibraryListUpdated ( int  libraryCount)
signal
+ Here is the caller graph for this function:

◆ scanProgressUpdate

void scanProgressUpdate ( int  percent)
signal
+ Here is the caller graph for this function:

◆ scanSucceeded

void scanSucceeded ( int  elementCount)
signal
+ Here is the caller graph for this function:

◆ scanFailed

void scanFailed ( QString  errorMsg)
signal
+ Here is the caller graph for this function:

◆ scanFinished

void scanFinished ( )
signal
+ Here is the caller graph for this function:

◆ getElementTranslations() [2/9]

void getElementTranslations ( const QString &  table,
const QString &  idRow,
const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
private
+ Here is the call graph for this function:

◆ getElementMetadata() [2/9]

void getElementMetadata ( const QString &  table,
const FilePath  elemDir,
Uuid uuid,
Version version 
) const
private
+ Here is the call graph for this function:

◆ getElementFilePathsFromDb()

QMultiMap< Version, FilePath > getElementFilePathsFromDb ( const QString &  tablename,
const Uuid uuid 
) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLatestVersionFilePath()

FilePath getLatestVersionFilePath ( const QMultiMap< Version, FilePath > &  list) const
privatenoexcept
+ Here is the caller graph for this function:

◆ getCategoryChilds()

QSet< Uuid > getCategoryChilds ( const QString &  tablename,
const tl::optional< Uuid > &  categoryUuid 
) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCategoryParents()

QList< Uuid > getCategoryParents ( const QString &  tablename,
const Uuid category 
) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCategoryParent()

tl::optional< Uuid > getCategoryParent ( const QString &  tablename,
const Uuid category 
) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCategoryChildCount()

int getCategoryChildCount ( const QString &  tablename,
const tl::optional< Uuid > &  category 
) const
private
+ Here is the caller graph for this function:

◆ getCategoryElementCount()

int getCategoryElementCount ( const QString &  tablename,
const QString &  idrowname,
const tl::optional< Uuid > &  category 
) const
private
+ Here is the caller graph for this function:

◆ getElementsByCategory()

QSet< Uuid > getElementsByCategory ( const QString &  tablename,
const QString &  idrowname,
const tl::optional< Uuid > &  categoryUuid 
) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementsBySearchKeyword() [2/9]

QList< Uuid > getElementsBySearchKeyword ( const QString &  tablename,
const QString &  idrowname,
const QString &  keyword 
) const
private
+ Here is the call graph for this function:

◆ getLibraryId()

int getLibraryId ( const FilePath lib) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLibraryElements() [2/8]

QList< FilePath > getLibraryElements ( const FilePath lib,
const QString &  tablename 
) const
private
+ Here is the call graph for this function:

◆ createAllTables()

void createAllTables ( )
private
+ Here is the caller graph for this function:

◆ setDbVersion()

void setDbVersion ( int  version)
private
+ Here is the caller graph for this function:

◆ getDbVersion()

int getDbVersion ( ) const
privatenoexcept
+ Here is the caller graph for this function:

◆ getElementsBySearchKeyword() [3/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [4/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [5/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [6/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [7/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [8/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getElementsBySearchKeyword() [9/9]

QList<Uuid> getElementsBySearchKeyword ( const QString &  keyword) const
+ Here is the call graph for this function:

◆ getLibraryElements() [3/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getLibraryElements() [4/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getLibraryElements() [5/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getLibraryElements() [6/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getLibraryElements() [7/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getLibraryElements() [8/8]

QList<FilePath> getLibraryElements ( const FilePath lib) const
+ Here is the call graph for this function:

◆ getElementTranslations() [3/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [4/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [5/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [6/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [7/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [8/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementTranslations() [9/9]

void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [3/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [4/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [5/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [6/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [7/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [8/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

◆ getElementMetadata() [9/9]

void getElementMetadata ( const FilePath  elemDir,
Uuid uuid,
Version version 
) const
+ Here is the call graph for this function:

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mFilePath

FilePath mFilePath
private

path to the SQLite database

◆ mDb

QScopedPointer<SQLiteDatabase> mDb
private

the SQLite database

◆ mLibraryScanner

QScopedPointer<WorkspaceLibraryScanner> mLibraryScanner
private

◆ sCurrentDbVersion

const int sCurrentDbVersion = 2
staticprivate

The documentation for this class was generated from the following files: