![]() |
LibrePCB Developers Documentation
|
Database write functions for librepcb::WorkspaceLibraryDb. More...
#include <workspacelibrarydbwriter.h>
Collaboration diagram for WorkspaceLibraryDbWriter:Public Member Functions | |
| WorkspaceLibraryDbWriter ()=delete | |
| WorkspaceLibraryDbWriter (const WorkspaceLibraryDbWriter &other)=delete | |
| WorkspaceLibraryDbWriter (const FilePath &librariesRoot, SQLiteDatabase &db) | |
| ~WorkspaceLibraryDbWriter () noexcept | |
| void | createAllTables () |
| Create all tables to initialize the database. | |
| void | addInternalData (const QString &key, int value) |
| Add an integer value to the "internal" table. | |
| int | addLibrary (const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QByteArray &iconPng, const QString &manufacturer) |
| Add a library. | |
| void | updateLibrary (const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QByteArray &iconPng, const QString &manufacturer) |
| Update library metadata. | |
| template<typename ElementType > | |
| int | addElement (int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QString &generatedBy) |
| Add a library element. | |
| template<typename ElementType > | |
| int | addCategory (int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const std::optional< Uuid > &parent) |
| addElement() specialized for categories | |
| int | addDevice (int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QString &generatedBy, const Uuid &component, const Uuid &package) |
| addElement() specialized for devices | |
| int | addPart (int devId, const QString &mpn, const QString &manufacturer) |
| Add a part to a previously added device. | |
| int | addPartAttribute (int partId, const Attribute &attribute) |
| Add an attribute to a previously added part. | |
| int | addOrganization (int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QByteArray &logoPng, const QUrl &url, const QString &country, const QStringList &fabs, const QStringList &shipping, bool isSponsor, int priority) |
| addElement() specialized for organizations | |
| int | addOrganizationPcbDesignRules (int orgId, const Uuid &uuid, const QString &name, const QString &description, const QUrl &url, int maxLayers) |
| Add PCB design rules to a previously added organization. | |
| int | addOrganizationOutputJob (int orgId, WorkspaceLibraryDb::OutputJobKind kind, const Uuid &uuid, const QString &type, const QString &name) |
| Add an output job to a previously added organization. | |
| template<typename ElementType > | |
| void | removeElement (const FilePath &fp) |
| Remove a library element. | |
| template<typename ElementType > | |
| void | removeAllElements () |
| Remove all library elements of a specific type. | |
| template<typename ElementType > | |
| int | addTranslation (int elementId, const QString &locale, const std::optional< ElementName > &name, const std::optional< QString > &description, const std::optional< QString > &keywords) |
| Add a translation for a library element. | |
| template<typename ElementType > | |
| void | removeAllTranslations () |
| Remove all translations for a library element type. | |
| template<typename ElementType > | |
| int | addToCategory (int elementId, const Uuid &category) |
| Add a library element to a category. | |
| template<typename ElementType > | |
| int | addResource (int elementId, const QString &name, const QString &mediaType, const QUrl &url) |
| Add a resource for a library element. | |
| int | addAlternativeName (int pkgId, const ElementName &name, const SimpleString &reference) |
| Add an alternative name to a previously added package. | |
| WorkspaceLibraryDbWriter & | operator= (const WorkspaceLibraryDbWriter &rhs)=delete |
Static Public Member Functions | |
| template<typename ElementType > | |
| static QString | getElementTable () noexcept |
| Get the table name of an element type. | |
| template<typename ElementType > | |
| static QString | getCategoryTable () noexcept |
| Get the category table name of an element type. | |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getElementTable () noexcept |
| template<> | |
| QString | getCategoryTable () noexcept |
| template<> | |
| QString | getCategoryTable () noexcept |
| template<> | |
| QString | getCategoryTable () noexcept |
| template<> | |
| QString | getCategoryTable () noexcept |
Private Member Functions | |
| int | addElement (const QString &elementsTable, int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const QString &generatedBy) |
| int | addCategory (const QString &categoriesTable, int libId, const FilePath &fp, const Uuid &uuid, const Version &version, bool deprecated, const std::optional< Uuid > &parent) |
| void | removeElement (const QString &elementsTable, const FilePath &fp) |
| void | removeAllElements (const QString &elementsTable) |
| int | addTranslation (const QString &elementsTable, int elementId, const QString &locale, const std::optional< ElementName > &name, const std::optional< QString > &description, const std::optional< QString > &keywords) |
| void | removeAllTranslations (const QString &elementsTable) |
| int | addToCategory (const QString &elementsTable, int elementId, const Uuid &category) |
| int | addResource (const QString &elementsTable, int elementId, const QString &name, const QString &mediaType, const QUrl &url) |
| QString | filePathToString (const FilePath &fp) const noexcept |
Static Private Member Functions | |
| static QString | nonEmptyOrNull (const QString &s) noexcept |
| static QString | nonNull (const QString &s) noexcept |
Private Attributes | |
| FilePath | mLibrariesRoot |
| SQLiteDatabase & | mDb |
Database write functions for librepcb::WorkspaceLibraryDb.
|
delete |
|
delete |
| WorkspaceLibraryDbWriter | ( | const FilePath & | librariesRoot, |
| SQLiteDatabase & | db | ||
| ) |
|
noexcept |
| void createAllTables | ( | ) |
Create all tables to initialize the database.
This has to be done only once, after creating a new database.
Here is the call graph for this function:
Here is the caller graph for this function:| void addInternalData | ( | const QString & | key, |
| int | value | ||
| ) |
Add an integer value to the "internal" table.
| key | The key to add. |
| value | The value to add. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addLibrary | ( | const FilePath & | fp, |
| const Uuid & | uuid, | ||
| const Version & | version, | ||
| bool | deprecated, | ||
| const QByteArray & | iconPng, | ||
| const QString & | manufacturer | ||
| ) |
Add a library.
| fp | Filepath of the library. |
| uuid | UUID of the library. |
| version | Version of the library. |
| deprecated | Whether the library is deprecated or not. |
| iconPng | Icon as a PNG. |
| manufacturer | Name of the manufacturer of this library (optional). |
Here is the call graph for this function:
Here is the caller graph for this function:| void updateLibrary | ( | const FilePath & | fp, |
| const Uuid & | uuid, | ||
| const Version & | version, | ||
| bool | deprecated, | ||
| const QByteArray & | iconPng, | ||
| const QString & | manufacturer | ||
| ) |
Update library metadata.
| fp | Filepath of the library to update. |
| uuid | New UUID of the library. |
| version | New version of the library. |
| deprecated | Whether the library is deprecated or not. |
| iconPng | New icon as a PNG. |
| manufacturer | Name of the manufacturer of this library (optional). |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Add a library element.
| ElementType | Type of element to add. |
| libId | ID of the library containing this element. |
| fp | Filepath of the element. |
| uuid | UUID of the element. |
| version | Version of the element. |
| deprecated | Whether the element is deprecated or not. |
| generatedBy | The generator name if generated or imported. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
addElement() specialized for categories
| ElementType | Type of category to add. |
| libId | ID of the library containing this category. |
| fp | Filepath of the category. |
| uuid | UUID of the category. |
| version | Version of the category. |
| deprecated | Whether the category is deprecated or not. |
| parent | Parent of the category. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addDevice | ( | int | libId, |
| const FilePath & | fp, | ||
| const Uuid & | uuid, | ||
| const Version & | version, | ||
| bool | deprecated, | ||
| const QString & | generatedBy, | ||
| const Uuid & | component, | ||
| const Uuid & | package | ||
| ) |
addElement() specialized for devices
| libId | ID of the library containing this device. |
| fp | Filepath of the device. |
| uuid | UUID of the device. |
| version | Version of the device. |
| deprecated | Whether the device is deprecated or not. |
| generatedBy | The generator name if generated or imported. |
| component | Component UUID of the device. |
| package | Package UUID of the device. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addPart | ( | int | devId, |
| const QString & | mpn, | ||
| const QString & | manufacturer | ||
| ) |
Add a part to a previously added device.
| devId | ID of the device containing this part. |
| mpn | Manufacturer part number. |
| manufacturer | Manufacturer name. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addPartAttribute | ( | int | partId, |
| const Attribute & | attribute | ||
| ) |
Add an attribute to a previously added part.
| partId | ID of the part containing this attribute. |
| attribute | Attribute to add. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addOrganization | ( | int | libId, |
| const FilePath & | fp, | ||
| const Uuid & | uuid, | ||
| const Version & | version, | ||
| bool | deprecated, | ||
| const QByteArray & | logoPng, | ||
| const QUrl & | url, | ||
| const QString & | country, | ||
| const QStringList & | fabs, | ||
| const QStringList & | shipping, | ||
| bool | isSponsor, | ||
| int | priority | ||
| ) |
addElement() specialized for organizations
| libId | ID of the library containing this organization. |
| fp | Filepath of the organization. |
| uuid | UUID of the organization. |
| version | Version of the organization. |
| deprecated | Whether the organization is deprecated or not. |
| logoPng | Logo as a PNG. |
| url | Website URL. |
| country | Country code (e.g. "DE"). |
| fabs | Country codes of fabs (e.g. "DE"). |
| shipping | Shipping options (e.g. "worldwide"). |
| isSponsor | Is LibrePCB sponsor or not. |
| priority | Sort order priority. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addOrganizationPcbDesignRules | ( | int | orgId, |
| const Uuid & | uuid, | ||
| const QString & | name, | ||
| const QString & | description, | ||
| const QUrl & | url, | ||
| int | maxLayers | ||
| ) |
Add PCB design rules to a previously added organization.
| orgId | ID of the organization containing this design rules. |
| uuid | Design rules UUID. |
| name | Design rules name. |
| description | Design rules description. |
| url | Design rules URL. |
| maxLayers | Maximum number of layers. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addOrganizationOutputJob | ( | int | orgId, |
| WorkspaceLibraryDb::OutputJobKind | kind, | ||
| const Uuid & | uuid, | ||
| const QString & | type, | ||
| const QString & | name | ||
| ) |
Add an output job to a previously added organization.
| orgId | ID of the organization containing this output job. |
| kind | Kind of output job. |
| uuid | Job UUID. |
| type | Job type (e.g. "gerber_excellon"). |
| name | Job name. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Remove a library element.
| ElementType | Type of element to remove. |
| fp | Filepath of the element to remove. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Remove all library elements of a specific type.
| ElementType | Type of elements to remove. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Add a translation for a library element.
| ElementType | Type of element to add translations. |
| elementId | ID of the element to add translations. |
| locale | Locale of the translations. |
| name | Element name. |
| description | Eleemnt description. |
| keywords | Element keywords. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Remove all translations for a library element type.
| ElementType | Type of element to remove translationss. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Add a library element to a category.
| ElementType | Type of element to add to the category. |
| elementId | ID of the element to add to the category. |
| category | Category UUID. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Add a resource for a library element.
| ElementType | Type of element of the resource. |
| elementId | ID of the element of the resource. |
| name | Resource name |
| mediaType | Resource media type. |
| url | Resource URL. |
Here is the call graph for this function:
Here is the caller graph for this function:| int addAlternativeName | ( | int | pkgId, |
| const ElementName & | name, | ||
| const SimpleString & | reference | ||
| ) |
Add an alternative name to a previously added package.
| pkgId | ID of the package for this alternative name. |
| name | Alternative name (mandatory). |
| reference | Origin of the alternative name (optional). |
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticnoexcept |
Get the table name of an element type.
| ElementType | Type of element to get the table name of. |
|
staticnoexcept |
Get the category table name of an element type.
| ElementType | Type of element to get the category table name of. |
|
delete |
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
private |
Here is the call graph for this function:
|
privatenoexcept |
Here is the caller graph for this function:
|
staticprivatenoexcept |
Here is the caller graph for this function:
|
staticprivatenoexcept |
Here is the caller graph for this function:
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
private |
|
private |