LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WorkspaceLibraryDb Class Referencefinal

The WorkspaceLibraryDb class. More...

#include <workspacelibrarydb.h>

Inherits QObject.

+ Collaboration diagram for WorkspaceLibraryDb:

Signals

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

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
 
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 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< 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
 
void getDeviceMetadata (const FilePath &devDir, Uuid *pkgUuid=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
 
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
 
QSet< UuidgetComponentsBySearchKeyword (const QString &keyword) const
 
void startLibraryRescan () noexcept
 Rescan the whole library directory and update the SQLite database. More...
 
WorkspaceLibraryDboperator= (const WorkspaceLibraryDb &rhs)=delete
 
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
 

Private Member Functions

void getElementTranslations (const QString &table, const QString &idRow, const FilePath &elemDir, const QStringList &localeOrder, QString *name, QString *desc, QString *keywords) 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
 
QSet< UuidgetElementsByCategory (const QString &tablename, const QString &idrowname, const tl::optional< Uuid > &categoryUuid) 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
 
QScopedPointer< SQLiteDatabasemDb
 the SQLite database "cache.sqlite" More...
 
QScopedPointer
< WorkspaceLibraryScanner
mLibraryScanner
 

Static Private Attributes

static const int sCurrentDbVersion = 1
 

Detailed Description

The WorkspaceLibraryDb class.

Constructor & Destructor Documentation

WorkspaceLibraryDb ( )
delete
WorkspaceLibraryDb ( const WorkspaceLibraryDb other)
delete
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 ( )
noexcept

Member Function Documentation

QMultiMap< Version, FilePath > getComponentCategories ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QMultiMap< Version, FilePath > getPackageCategories ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QMultiMap< Version, FilePath > getSymbols ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QMultiMap< Version, FilePath > getPackages ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QMultiMap< Version, FilePath > getComponents ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QMultiMap< Version, FilePath > getDevices ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestComponentCategory ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestPackageCategory ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestSymbol ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestPackage ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestComponent ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getLatestDevice ( const Uuid uuid) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QList<FilePath> getLibraryElements ( const FilePath lib) const
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:

void getDeviceMetadata ( const FilePath devDir,
Uuid pkgUuid = nullptr 
) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

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:

QList< Uuid > getComponentCategoryParents ( const Uuid category) const

+ Here is the call graph for this function:

QList< Uuid > getPackageCategoryParents ( const Uuid category) const

+ Here is the call graph for this function:

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:

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:

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:

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:

QSet< Uuid > getDevicesOfComponent ( const Uuid component) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QSet< Uuid > getComponentsBySearchKeyword ( const QString &  keyword) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void startLibraryRescan ( )
noexcept

Rescan the whole library directory and update the SQLite database.

+ Here is the caller graph for this function:

WorkspaceLibraryDb& operator= ( const WorkspaceLibraryDb rhs)
delete
void scanStarted ( )
signal

+ Here is the caller graph for this function:

void scanProgressUpdate ( int  percent)
signal

+ Here is the caller graph for this function:

void scanSucceeded ( int  elementCount)
signal

+ Here is the caller graph for this function:

void scanFailed ( QString  errorMsg)
signal

+ Here is the caller graph for this function:

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:

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:

FilePath getLatestVersionFilePath ( const QMultiMap< Version, FilePath > &  list) const
privatenoexcept

+ Here is the caller graph for this function:

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:

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:

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:

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:

int getLibraryId ( const FilePath lib) const
private

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QList< FilePath > getLibraryElements ( const FilePath lib,
const QString &  tablename 
) const
private

+ Here is the call graph for this function:

void createAllTables ( )
private

+ Here is the caller graph for this function:

void setDbVersion ( int  version)
private

+ Here is the caller graph for this function:

int getDbVersion ( ) const
privatenoexcept

+ Here is the caller graph for this function:

QList<FilePath> getLibraryElements ( const FilePath lib) const
QList<FilePath> getLibraryElements ( const FilePath lib) const
QList<FilePath> getLibraryElements ( const FilePath lib) const
QList<FilePath> getLibraryElements ( const FilePath lib) const
QList<FilePath> getLibraryElements ( const FilePath lib) const
QList<FilePath> getLibraryElements ( const FilePath lib) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const
void getElementTranslations ( const FilePath elemDir,
const QStringList &  localeOrder,
QString *  name,
QString *  desc,
QString *  keywords 
) const

Member Data Documentation

Workspace& mWorkspace
private
QScopedPointer<SQLiteDatabase> mDb
private

the SQLite database "cache.sqlite"

QScopedPointer<WorkspaceLibraryScanner> mLibraryScanner
private
const int sCurrentDbVersion = 1
staticprivate

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