LibrePCB Developers Documentation
categorytreebuilder.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_CATEGORYTREEBUILDER_H
21#define LIBREPCB_EDITOR_CATEGORYTREEBUILDER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <optional/tl/optional.hpp>
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class FilePath;
36class Uuid;
37class WorkspaceLibraryDb;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class CategoryTreeBuilder
43 ******************************************************************************/
44
49template <typename ElementType>
51 Q_DECLARE_TR_FUNCTIONS(CategoryTreeBuilder)
52
53public:
54 // Constructors / Destructor
58 const QStringList& localeOrder,
59 bool nulloptIsRootCategory) noexcept;
60 ~CategoryTreeBuilder() noexcept;
61
62 // General Methods
63
78 QStringList buildTree(const tl::optional<Uuid>& category,
79 bool* success = nullptr) const;
80
81 // Operator Overloadings
82 CategoryTreeBuilder& operator=(const CategoryTreeBuilder& rhs) = delete;
83
84private: // Methods
85 bool getParentNames(const tl::optional<Uuid>& category, QStringList& names,
86 QSet<FilePath>& filePaths) const;
87
88private: // Data
90 const QStringList& mLocaleOrder;
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:58
Helper class to extract a category tree from librepcb::WorkspaceLibraryDb.
Definition: categorytreebuilder.h:50
const WorkspaceLibraryDb & mDb
Definition: categorytreebuilder.h:89
const bool mNulloptIsRootCategory
Definition: categorytreebuilder.h:91
bool getParentNames(const tl::optional< Uuid > &category, QStringList &names, QSet< FilePath > &filePaths) const
Definition: categorytreebuilder.cpp:75
QStringList buildTree(const tl::optional< Uuid > &category, bool *success=nullptr) const
Build the parents tree for a specific category.
Definition: categorytreebuilder.cpp:59
CategoryTreeBuilder(const CategoryTreeBuilder &other)=delete
~CategoryTreeBuilder() noexcept
Definition: categorytreebuilder.cpp:51
const QStringList & mLocaleOrder
Definition: categorytreebuilder.h:90
Definition: occmodel.cpp:77
Definition: uuid.h:183