LibrePCB Developers Documentation
junction.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_JUNCTION_H
21 #define LIBREPCB_CORE_JUNCTION_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../serialization/serializableobjectlist.h"
27 #include "../types/point.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class Junction
38  ******************************************************************************/
39 
47 class Junction final {
48  Q_DECLARE_TR_FUNCTIONS(Junction)
49 
50 public:
51  // Signals
52  enum class Event {
55  };
58 
59  // Constructors / Destructor
60  Junction() = delete;
61  Junction(const Junction& other) noexcept;
62  Junction(const Uuid& uuid, const Junction& other) noexcept;
63  Junction(const Uuid& uuid, const Point& position) noexcept;
64  explicit Junction(const SExpression& node);
65  ~Junction() noexcept;
66 
67  // Getters
68  const Uuid& getUuid() const noexcept { return mUuid; }
69  const Point& getPosition() const noexcept { return mPosition; }
70 
71  // Setters
72  bool setUuid(const Uuid& uuid) noexcept;
73  bool setPosition(const Point& position) noexcept;
74 
75  // General Methods
76 
82  void serialize(SExpression& root) const;
83 
84  // Operator Overloadings
85  bool operator==(const Junction& rhs) const noexcept;
86  bool operator!=(const Junction& rhs) const noexcept {
87  return !(*this == rhs);
88  }
89  Junction& operator=(const Junction& rhs) noexcept;
90 
91 private: // Data
94 };
95 
96 /*******************************************************************************
97  * Class JunctionList
98  ******************************************************************************/
99 
101  static constexpr const char* tagname = "junction";
102 };
103 using JunctionList =
105 
106 /*******************************************************************************
107  * End of File
108  ******************************************************************************/
109 
110 } // namespace librepcb
111 
112 #endif
bool operator==(const Junction &rhs) const noexcept
Definition: junction.cpp:95
Definition: junction.h:100
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: junction.cpp:86
The Junction class represents the connection point between netlines or traces.
Definition: junction.h:47
Definition: occmodel.cpp:76
Junction & operator=(const Junction &rhs) noexcept
Definition: junction.cpp:101
Uuid mUuid
Definition: junction.h:92
Point mPosition
Definition: junction.h:93
bool setUuid(const Uuid &uuid) noexcept
Definition: junction.cpp:62
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
Event
Definition: junction.h:52
Signal< Junction, Event > onEdited
Definition: junction.h:56
const Uuid & getUuid() const noexcept
Definition: junction.h:68
Slot< Junction, Event > OnEditedSlot
Definition: junction.h:57
bool setPosition(const Point &position) noexcept
Definition: junction.cpp:72
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
bool operator!=(const Junction &rhs) const noexcept
Definition: junction.h:86
~Junction() noexcept
Definition: junction.cpp:55
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:56
The Slot class is used to receive signals from non-QObject derived classes.
Definition: signalslot.h:36
The SExpression class.
Definition: sexpression.h:66
const Point & getPosition() const noexcept
Definition: junction.h:69