LibrePCB Developers Documentation
Loading...
Searching...
No Matches
tagmatcher.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_CORE_TAGMATCHER_H
21#define LIBREPCB_CORE_TAGMATCHER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/tag.h"
27
28#include <QtCore>
29
30#include <set>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class TagMatcher
39 ******************************************************************************/
40
45 Q_DECLARE_TR_FUNCTIONS(TagMatcher)
46
47public:
48 // Constructors / Destructor
49 TagMatcher() noexcept;
50 TagMatcher(const TagMatcher& other) = delete;
51 ~TagMatcher() noexcept;
52
53 // General Methods
54 int addOption(const QSet<Tag>& tags) noexcept;
55 int findFirstMatch(const QVector<Tag>& preferredTags) noexcept;
56
57 // Operator Overloadings
58 TagMatcher& operator=(const TagMatcher& rhs) = delete;
59
60private:
61 bool applyFilter(std::set<int>& filtered, const Tag& tag) const noexcept;
62
63 QVector<QSet<Tag>> mOptions;
64};
65
66/*******************************************************************************
67 * End of File
68 ******************************************************************************/
69
70} // namespace librepcb
71
72#endif
Helper class to find the best option for given preferred tags.
Definition tagmatcher.h:44
TagMatcher(const TagMatcher &other)=delete
QVector< QSet< Tag > > mOptions
Definition tagmatcher.h:63
TagMatcher() noexcept
Definition tagmatcher.cpp:34
bool applyFilter(std::set< int > &filtered, const Tag &tag) const noexcept
Definition tagmatcher.cpp:63
~TagMatcher() noexcept
Definition tagmatcher.cpp:37
int addOption(const QSet< Tag > &tags) noexcept
Definition tagmatcher.cpp:44
int findFirstMatch(const QVector< Tag > &preferredTags) noexcept
Definition tagmatcher.cpp:50
Definition occmodel.cpp:77
type_safe::constrained_type< QString, TagConstraint, TagVerifier > Tag
Definition tag.h:82
Definition uuid.h:186