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

The ProjectLibrary class. More...

#include <projectlibrary.h>

Inherits QObject.

+ Collaboration diagram for ProjectLibrary:

Public Member Functions

 ProjectLibrary (const FilePath &libDir, bool restore, bool readOnly)
 
 ~ProjectLibrary () noexcept
 
const QHash< Uuid,
library::Symbol * > & 
getSymbols () const noexcept
 
const QHash< Uuid,
library::Package * > & 
getPackages () const noexcept
 
const QHash< Uuid,
library::Component * > & 
getComponents () const noexcept
 
const QHash< Uuid,
library::Device * > & 
getDevices () const noexcept
 
library::SymbolgetSymbol (const Uuid &uuid) const noexcept
 
library::PackagegetPackage (const Uuid &uuid) const noexcept
 
library::ComponentgetComponent (const Uuid &uuid) const noexcept
 
library::DevicegetDevice (const Uuid &uuid) const noexcept
 
QHash< Uuid, library::Device * > getDevicesOfComponent (const Uuid &compUuid) const noexcept
 
void addSymbol (library::Symbol &s)
 
void addPackage (library::Package &p)
 
void addComponent (library::Component &c)
 
void addDevice (library::Device &d)
 
void removeSymbol (library::Symbol &s)
 
void removePackage (library::Package &p)
 
void removeComponent (library::Component &c)
 
void removeDevice (library::Device &d)
 
bool save (bool toOriginal, QStringList &errors) noexcept
 

Private Member Functions

 ProjectLibrary ()
 
 ProjectLibrary (const ProjectLibrary &other)
 
ProjectLibraryoperator= (const ProjectLibrary &rhs)
 
QSet
< library::LibraryBaseElement * > 
getCurrentElements () const noexcept
 
template<typename ElementType >
void loadElements (const FilePath &directory, const QString &type, QHash< Uuid, ElementType * > &elementList)
 
template<typename ElementType >
void addElement (ElementType &element, QHash< Uuid, ElementType * > &elementList)
 
template<typename ElementType >
void removeElement (ElementType &element, QHash< Uuid, ElementType * > &elementList)
 

Private Attributes

FilePath mLibraryPath
 the "library" directory of the project More...
 
FilePath mBackupPath
 same as mLibraryPath, but with trailing "~" More...
 
FilePath mTmpDir
 path to a temporary directory More...
 
QHash< Uuid, library::Symbol * > mSymbols
 
QHash< Uuid, library::Package * > mPackages
 
QHash< Uuid, library::Component * > mComponents
 
QHash< Uuid, library::Device * > mDevices
 
QSet
< library::LibraryBaseElement * > 
mAllElements
 
QSet
< library::LibraryBaseElement * > 
mLoadedElements
 
QSet
< library::LibraryBaseElement * > 
mSavedToTemporary
 
QSet
< library::LibraryBaseElement * > 
mSavedToOriginal
 

Detailed Description

The ProjectLibrary class.

Todo:
Adding and removing elements is very provisional. It does not really work together with the automatic backup/restore feature of projects.

Constructor & Destructor Documentation

ProjectLibrary ( const FilePath libDir,
bool  restore,
bool  readOnly 
)
explicit

+ Here is the call graph for this function:

~ProjectLibrary ( )
noexcept

+ Here is the call graph for this function:

ProjectLibrary ( )
private
ProjectLibrary ( const ProjectLibrary other)
private

Member Function Documentation

const QHash<Uuid, library::Symbol*>& getSymbols ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QHash<Uuid, library::Package*>& getPackages ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QHash<Uuid, library::Component*>& getComponents ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QHash<Uuid, library::Device*>& getDevices ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

library::Symbol* getSymbol ( const Uuid uuid) const
inlinenoexcept

+ Here is the caller graph for this function:

library::Package* getPackage ( const Uuid uuid) const
inlinenoexcept

+ Here is the caller graph for this function:

library::Component* getComponent ( const Uuid uuid) const
inlinenoexcept

+ Here is the caller graph for this function:

library::Device* getDevice ( const Uuid uuid) const
inlinenoexcept

+ Here is the caller graph for this function:

QHash< Uuid, library::Device * > getDevicesOfComponent ( const Uuid compUuid) const
noexcept

+ Here is the call graph for this function:

void addSymbol ( library::Symbol s)
void addPackage ( library::Package p)
void addComponent ( library::Component c)
void addDevice ( library::Device d)
void removeSymbol ( library::Symbol s)
void removePackage ( library::Package p)
void removeComponent ( library::Component c)
void removeDevice ( library::Device d)
bool save ( bool  toOriginal,
QStringList &  errors 
)
noexcept

+ Here is the call graph for this function:

ProjectLibrary& operator= ( const ProjectLibrary rhs)
private
QSet< LibraryBaseElement * > getCurrentElements ( ) const
privatenoexcept
void loadElements ( const FilePath directory,
const QString &  type,
QHash< Uuid, ElementType * > &  elementList 
)
private

+ Here is the call graph for this function:

void addElement ( ElementType &  element,
QHash< Uuid, ElementType * > &  elementList 
)
private

+ Here is the call graph for this function:

void removeElement ( ElementType &  element,
QHash< Uuid, ElementType * > &  elementList 
)
private

Member Data Documentation

FilePath mLibraryPath
private

the "library" directory of the project

FilePath mBackupPath
private

same as mLibraryPath, but with trailing "~"

FilePath mTmpDir
private

path to a temporary directory

QHash<Uuid, library::Symbol*> mSymbols
private
QHash<Uuid, library::Package*> mPackages
private
QHash<Uuid, library::Component*> mComponents
private
QHash<Uuid, library::Device*> mDevices
private
QSet<library::LibraryBaseElement*> mAllElements
private
QSet<library::LibraryBaseElement*> mLoadedElements
private
QSet<library::LibraryBaseElement*> mSavedToTemporary
private
QSet<library::LibraryBaseElement*> mSavedToOriginal
private

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