LibrePCB Developers Documentation
schematicselectionquery.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_PROJECT_SCHEMATICSELECTIONQUERY_H
21 #define LIBREPCB_PROJECT_SCHEMATICSELECTIONQUERY_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 
30 /*******************************************************************************
31  * Namespace / Forward Declarations
32  ******************************************************************************/
33 namespace librepcb {
34 namespace project {
35 
36 class SI_Symbol;
37 class SI_SymbolPin;
38 class SI_NetSegment;
39 class SI_NetLine;
40 class SI_NetPoint;
41 class SI_NetLabel;
42 
43 /*******************************************************************************
44  * Class SchematicSelectionQuery
45  ******************************************************************************/
46 
50 class SchematicSelectionQuery final : public QObject {
51  Q_OBJECT
52 
53 public:
54  // Constructors / Destructor
55  SchematicSelectionQuery() = delete;
56  SchematicSelectionQuery(const SchematicSelectionQuery& other) = delete;
57  SchematicSelectionQuery(const QList<SI_Symbol*>& symbols,
58  const QList<SI_NetSegment*>& netsegments,
59  QObject* parent = nullptr);
60  ~SchematicSelectionQuery() noexcept;
61 
62  // Getters
63  const QSet<SI_Symbol*>& getSymbols() const noexcept { return mResultSymbols; }
64  const QSet<SI_NetPoint*>& getNetPoints() const noexcept {
65  return mResultNetPoints;
66  }
67  const QSet<SI_NetLine*>& getNetLines() const noexcept {
68  return mResultNetLines;
69  }
70  const QSet<SI_NetLabel*>& getNetLabels() const noexcept {
71  return mResultNetLabels;
72  }
73  int getResultCount() const noexcept;
74  bool isResultEmpty() const noexcept { return (getResultCount() == 0); }
75 
76  // General Methods
77  void addSelectedSymbols() noexcept;
78  void addSelectedNetPoints() noexcept;
79  void addSelectedNetLines() noexcept;
80  void addSelectedNetLabels() noexcept;
81  void addNetPointsOfNetLines() noexcept;
82  void addNetLinesOfSymbolPins() noexcept;
83 
84  // Operator Overloadings
86  delete;
87 
88 private:
89  // references to the Schematic object
90  const QList<SI_Symbol*>& mSymbols;
91  const QList<SI_NetSegment*>& mNetSegments;
92 
93  // query result
94  QSet<SI_Symbol*> mResultSymbols;
95  QSet<SI_NetPoint*> mResultNetPoints;
96  QSet<SI_NetLine*> mResultNetLines;
97  QSet<SI_NetLabel*> mResultNetLabels;
98 };
99 
100 /*******************************************************************************
101  * End of File
102  ******************************************************************************/
103 
104 } // namespace project
105 } // namespace librepcb
106 
107 #endif // LIBREPCB_PROJECT_SCHEMATICSELECTIONQUERY_H
const QList< SI_Symbol * > & mSymbols
Definition: schematicselectionquery.h:90
void addSelectedNetLines() noexcept
Definition: schematicselectionquery.cpp:85
void addSelectedNetPoints() noexcept
Definition: schematicselectionquery.cpp:75
~SchematicSelectionQuery() noexcept
Definition: schematicselectionquery.cpp:51
The SchematicSelectionQuery class.
Definition: schematicselectionquery.h:50
SchematicSelectionQuery & operator=(const SchematicSelectionQuery &rhs)=delete
QSet< SI_Symbol * > mResultSymbols
Definition: schematicselectionquery.h:94
Definition: airwiresbuilder.cpp:32
const QSet< SI_NetLine * > & getNetLines() const noexcept
Definition: schematicselectionquery.h:67
QSet< SI_NetLine * > mResultNetLines
Definition: schematicselectionquery.h:96
const QSet< SI_NetLabel * > & getNetLabels() const noexcept
Definition: schematicselectionquery.h:70
QSet< SI_NetPoint * > mResultNetPoints
Definition: schematicselectionquery.h:95
const QSet< SI_Symbol * > & getSymbols() const noexcept
Definition: schematicselectionquery.h:63
void addSelectedNetLabels() noexcept
Definition: schematicselectionquery.cpp:95
const QSet< SI_NetPoint * > & getNetPoints() const noexcept
Definition: schematicselectionquery.h:64
void addSelectedSymbols() noexcept
Definition: schematicselectionquery.cpp:67
bool isResultEmpty() const noexcept
Definition: schematicselectionquery.h:74
int getResultCount() const noexcept
Definition: schematicselectionquery.cpp:58
QSet< SI_NetLabel * > mResultNetLabels
Definition: schematicselectionquery.h:97
void addNetLinesOfSymbolPins() noexcept
Definition: schematicselectionquery.cpp:114
void addNetPointsOfNetLines() noexcept
Definition: schematicselectionquery.cpp:105
const QList< SI_NetSegment * > & mNetSegments
Definition: schematicselectionquery.h:91