LibrePCB Developers Documentation
cmpsigpindisplaytype.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_CMPSIGPINDISPLAYTYPE_H
21#define LIBREPCB_CORE_CMPSIGPINDISPLAYTYPE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28/*******************************************************************************
29 * Namespace / Forward Declarations
30 ******************************************************************************/
31namespace librepcb {
32
33/*******************************************************************************
34 * Class CmpSigPinDisplayType
35 ******************************************************************************/
36
41 Q_DECLARE_TR_FUNCTIONS(CmpSigPinDisplayType)
42
43public:
44 // Constructors / Destructor
45 CmpSigPinDisplayType() noexcept;
46 CmpSigPinDisplayType(const CmpSigPinDisplayType& other) noexcept;
47 ~CmpSigPinDisplayType() noexcept;
48
49 // Getters
50
57 const QString& toString() const noexcept { return mDisplayType; }
58
64 const QString& getNameTr() const noexcept { return mName; }
65
66 // Operator Overloadings
67 bool operator==(const CmpSigPinDisplayType& rhs) const noexcept;
68 bool operator!=(const CmpSigPinDisplayType& rhs) const noexcept {
69 return !(*this == rhs);
70 }
72
73 // Static Methods
74
84 static const CmpSigPinDisplayType& fromString(const QString& str);
85
91 static const QList<CmpSigPinDisplayType>& getAllTypes() noexcept;
92
94 static const CmpSigPinDisplayType& none() noexcept {
95 static CmpSigPinDisplayType type("none", tr("None (no text)"));
96 return type;
97 }
98
100 static const CmpSigPinDisplayType& pinName() noexcept {
101 static CmpSigPinDisplayType type("pin", tr("Symbol pin name"));
102 return type;
103 }
104
106 static const CmpSigPinDisplayType& componentSignal() noexcept {
107 static CmpSigPinDisplayType type("signal", tr("Component signal name"));
108 return type;
109 }
110
112 static const CmpSigPinDisplayType& netSignal() noexcept {
113 static CmpSigPinDisplayType type("net", tr("Schematic net name"));
114 return type;
115 }
116
117private: // Methods
118 CmpSigPinDisplayType(const QString& type, const QString& name) noexcept;
119
120private: // Data
121 QString mDisplayType;
122 QString mName;
123};
124
125/*******************************************************************************
126 * End of File
127 ******************************************************************************/
128
129} // namespace librepcb
130
131#endif
The CmpSigPinDisplayType clas.
Definition: cmpsigpindisplaytype.h:40
const QString & getNameTr() const noexcept
Get the name of the display type (human readable and translated)
Definition: cmpsigpindisplaytype.h:64
CmpSigPinDisplayType & operator=(const CmpSigPinDisplayType &rhs) noexcept
Definition: cmpsigpindisplaytype.cpp:65
const QString & toString() const noexcept
Serialize the display type to a string (e.g. to write it into a file)
Definition: cmpsigpindisplaytype.h:57
static const CmpSigPinDisplayType & netSignal() noexcept
display the name of the connected net signal
Definition: cmpsigpindisplaytype.h:112
static const CmpSigPinDisplayType & none() noexcept
None (no text)
Definition: cmpsigpindisplaytype.h:94
QString mName
human readable (translated)
Definition: cmpsigpindisplaytype.h:122
bool operator!=(const CmpSigPinDisplayType &rhs) const noexcept
Definition: cmpsigpindisplaytype.h:68
~CmpSigPinDisplayType() noexcept
Definition: cmpsigpindisplaytype.cpp:53
static const CmpSigPinDisplayType & pinName() noexcept
display the name of the symbol pin
Definition: cmpsigpindisplaytype.h:100
CmpSigPinDisplayType() noexcept
Definition: cmpsigpindisplaytype.cpp:39
QString mDisplayType
used for serialization (DO NOT MODIFY VALUES!)
Definition: cmpsigpindisplaytype.h:121
bool operator==(const CmpSigPinDisplayType &rhs) const noexcept
Definition: cmpsigpindisplaytype.cpp:60
static const QList< CmpSigPinDisplayType > & getAllTypes() noexcept
Get a list of all available display types.
Definition: cmpsigpindisplaytype.cpp:89
static const CmpSigPinDisplayType & fromString(const QString &str)
Deserialize a display type from a string.
Definition: cmpsigpindisplaytype.cpp:76
static const CmpSigPinDisplayType & componentSignal() noexcept
display the name of the component signal
Definition: cmpsigpindisplaytype.h:106
Definition: occmodel.cpp:77