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

The WorkspaceLibraryScanner class. More...

#include <workspacelibraryscanner.h>

Inherits QThread.

+ Collaboration diagram for WorkspaceLibraryScanner:

Signals

void started ()
 
void progressUpdate (int percent)
 
void succeeded (int elementCount)
 
void failed (QString errorMsg)
 

Public Member Functions

 WorkspaceLibraryScanner (Workspace &ws) noexcept
 
 WorkspaceLibraryScanner (const WorkspaceLibraryScanner &other)=delete
 
 ~WorkspaceLibraryScanner () noexcept
 
WorkspaceLibraryScanneroperator= (const WorkspaceLibraryScanner &rhs)=delete
 
template<>
QVariant optionalToVariant (const tl::optional< QString > &opt) noexcept
 
template<>
QVariant optionalToVariant (const tl::optional< ElementName > &opt) noexcept
 

Private Member Functions

void run () noexceptoverride
 
void clearAllTables (SQLiteDatabase &db)
 
int addLibraryToDb (SQLiteDatabase &db, const QSharedPointer< library::Library > &lib)
 
template<typename ElementType >
int addCategoriesToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 
template<typename ElementType >
int addElementsToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 
int addDevicesToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 

Static Private Member Functions

template<typename T >
static QVariant optionalToVariant (const T &opt) noexcept
 

Private Attributes

WorkspacemWorkspace
 
volatile bool mAbort
 

Detailed Description

The WorkspaceLibraryScanner class.

Warning
Be very careful with dependencies to other objects as the run() method is executed in a separate thread! Keep the number of dependencies as small as possible and consider thread synchronization and object lifetimes.
Todo:
Don't really sure that the run() method is 100% thread save ;) Maybe it would be better to put the whole library scanning code into this class instead of having references to objects from the library and workspace namespaces. This way it would be easier to guarantee thread safety.
Author
ubruhin
Date
2016-09-06

Constructor & Destructor Documentation

WorkspaceLibraryScanner ( Workspace ws)
explicitnoexcept
~WorkspaceLibraryScanner ( )
noexcept

Member Function Documentation

WorkspaceLibraryScanner& operator= ( const WorkspaceLibraryScanner rhs)
delete
void started ( )
signal

+ Here is the caller graph for this function:

void progressUpdate ( int  percent)
signal

+ Here is the caller graph for this function:

void succeeded ( int  elementCount)
signal

+ Here is the caller graph for this function:

void failed ( QString  errorMsg)
signal

+ Here is the caller graph for this function:

void run ( )
overrideprivatenoexcept

+ Here is the call graph for this function:

void clearAllTables ( SQLiteDatabase db)
private

+ Here is the call graph for this function:

int addLibraryToDb ( SQLiteDatabase db,
const QSharedPointer< library::Library > &  lib 
)
private

+ Here is the call graph for this function:

int addCategoriesToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

int addElementsToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

int addDevicesToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

static QVariant optionalToVariant ( const T &  opt)
staticprivatenoexcept
QVariant optionalToVariant ( const tl::optional< QString > &  opt)
noexcept
QVariant optionalToVariant ( const tl::optional< ElementName > &  opt)
noexcept

Member Data Documentation

Workspace& mWorkspace
private
volatile bool mAbort
private

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