LibrePCB Developers Documentation
CategoryTreeBuilder< ElementType > Class Template Referencefinal

Helper class to extract a category tree from librepcb::WorkspaceLibraryDb. More...

#include <categorytreebuilder.h>

+ Collaboration diagram for CategoryTreeBuilder< ElementType >:

Public Member Functions

 CategoryTreeBuilder ()=delete
 
 CategoryTreeBuilder (const CategoryTreeBuilder &other)=delete
 
 CategoryTreeBuilder (const WorkspaceLibraryDb &db, const QStringList &localeOrder, bool nulloptIsRootCategory) noexcept
 
 ~CategoryTreeBuilder () noexcept
 
QStringList buildTree (const tl::optional< Uuid > &category, bool *success=nullptr) const
 Build the parents tree for a specific category. More...
 
CategoryTreeBuilderoperator= (const CategoryTreeBuilder &rhs)=delete
 

Private Member Functions

bool getParentNames (const tl::optional< Uuid > &category, QStringList &names, QSet< FilePath > &filePaths) const
 

Private Attributes

const WorkspaceLibraryDbmDb
 
const QStringList & mLocaleOrder
 
const bool mNulloptIsRootCategory
 

Detailed Description

template<typename ElementType>
class librepcb::editor::CategoryTreeBuilder< ElementType >

Helper class to extract a category tree from librepcb::WorkspaceLibraryDb.

Constructor & Destructor Documentation

◆ CategoryTreeBuilder() [1/3]

CategoryTreeBuilder ( )
delete

◆ CategoryTreeBuilder() [2/3]

CategoryTreeBuilder ( const CategoryTreeBuilder< ElementType > &  other)
delete

◆ CategoryTreeBuilder() [3/3]

CategoryTreeBuilder ( const WorkspaceLibraryDb db,
const QStringList &  localeOrder,
bool  nulloptIsRootCategory 
)
noexcept

◆ ~CategoryTreeBuilder()

Member Function Documentation

◆ buildTree()

QStringList buildTree ( const tl::optional< Uuid > &  category,
bool *  success = nullptr 
) const

Build the parents tree for a specific category.

Parameters
categoryThe category to get the tree from. If tl::nullopt, it is assumed to represent the root category.
successIf not sullptr, this is set to whether the tree was successfully built or not.
Returns
All category names. The top level category comes first (root category if nulloptIsRootCategory=true passed to the constructor), then down the tree, with the passed category as the last element. In case of invalid categories, the returned list is either empty or contains error messages.
Exceptions
Incase of database errors.
+ Here is the caller graph for this function:

◆ operator=()

CategoryTreeBuilder & operator= ( const CategoryTreeBuilder< ElementType > &  rhs)
delete

◆ getParentNames()

bool getParentNames ( const tl::optional< Uuid > &  category,
QStringList &  names,
QSet< FilePath > &  filePaths 
) const
private
+ Here is the call graph for this function:

Member Data Documentation

◆ mDb

const WorkspaceLibraryDb& mDb
private

◆ mLocaleOrder

const QStringList& mLocaleOrder
private

◆ mNulloptIsRootCategory

const bool mNulloptIsRootCategory
private

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