LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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 <QtCore>
27
28#include <optional>
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 std::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 std::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:127
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The WorkspaceLibraryDb class.
Definition workspacelibrarydb.h:58
Helper class to extract a category tree from librepcb::WorkspaceLibraryDb.
Definition categorytreebuilder.h:50
QStringList buildTree(const std::optional< Uuid > &category, bool *success=nullptr) const
Build the parents tree for a specific category.
Definition categorytreebuilder.cpp:59
const WorkspaceLibraryDb & mDb
Definition categorytreebuilder.h:89
const bool mNulloptIsRootCategory
Definition categorytreebuilder.h:91
CategoryTreeBuilder(const CategoryTreeBuilder &other)=delete
~CategoryTreeBuilder() noexcept
Definition categorytreebuilder.cpp:51
const QStringList & mLocaleOrder
Definition categorytreebuilder.h:90
bool getParentNames(const std::optional< Uuid > &category, QStringList &names, QSet< FilePath > &filePaths) const
Definition categorytreebuilder.cpp:75
Definition occmodel.cpp:76
Definition uuid.h:186