Skip to content

Commit 2806d29

Browse files
committed
[kicad:model] Added const ref to complex types getters
1 parent 59accec commit 2806d29

8 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/kicad/model/drawtext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Draw::TypeDraw DrawText::type() const
4040
return TypeDrawText;
4141
}
4242

43-
QString DrawText::text() const
43+
const QString &DrawText::text() const
4444
{
4545
return _text;
4646
}

src/kicad/model/drawtext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class KICAD_EXPORT DrawText : public Draw
3232

3333
TypeDraw type() const override;
3434

35-
QString text() const;
35+
const QString &text() const;
3636
void setText(const QString &text);
3737

3838
enum Direction

src/kicad/model/lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Lib::~Lib()
6363
* @brief Lib name getter
6464
* @return name
6565
*/
66-
QString Lib::name() const
66+
const QString &Lib::name() const
6767
{
6868
return _name;
6969
}

src/kicad/model/lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class KICAD_EXPORT Lib
3232
Lib(const Lib &other);
3333
~Lib();
3434

35-
QString name() const;
35+
const QString &name() const;
3636
void setName(const QString &name);
3737

3838
Component *component(int i) const;

src/kicad/model/pad.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void Pad::setName(const QString &name)
3535
_name = name;
3636
}
3737

38-
QPointF Pad::pos() const
38+
const QPointF &Pad::pos() const
3939
{
4040
return _pos;
4141
}
@@ -45,7 +45,7 @@ void Pad::setPos(const QPointF &pos)
4545
_pos = pos;
4646
}
4747

48-
QSizeF Pad::size() const
48+
const QSizeF &Pad::size() const
4949
{
5050
return _size;
5151
}
@@ -81,7 +81,7 @@ void Pad::setShape(const Shape &shape)
8181
_shape = shape;
8282
}
8383

84-
QSizeF Pad::sizeIncrease() const
84+
const QSizeF &Pad::sizeIncrease() const
8585
{
8686
return _sizeIncrease;
8787
}
@@ -101,7 +101,7 @@ void Pad::setDrillDiameter(double drillDiameter)
101101
_drillDiameter = drillDiameter;
102102
}
103103

104-
QPointF Pad::drillOffset() const
104+
const QPointF &Pad::drillOffset() const
105105
{
106106
return _drillOffset;
107107
}

src/kicad/model/pad.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ class KICAD_EXPORT Pad
8383
void setName(const QString &name);
8484

8585
// pad
86-
QPointF pos() const;
86+
const QPointF &pos() const;
8787
void setPos(const QPointF &pos);
8888

89-
QSizeF size() const;
89+
const QSizeF &size() const;
9090
void setSize(const QSizeF &size);
9191

9292
Shape shape() const;
9393
QString shapeString() const;
9494
void setShape(const Shape &shape);
9595

96-
QSizeF sizeIncrease() const;
96+
const QSizeF &sizeIncrease() const;
9797
void setSizeIncrease(const QSizeF &sizeIncrease);
9898

9999
double angle() const;
@@ -103,7 +103,7 @@ class KICAD_EXPORT Pad
103103
double drillDiameter() const;
104104
void setDrillDiameter(double drillDiameter);
105105

106-
QPointF drillOffset() const;
106+
const QPointF &drillOffset() const;
107107
void setDrillOffset(const QPointF &drillOffset);
108108

109109
// attributes

src/kicad/model/pin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Pin::Pin(const Pin &other)
6666
_textPadSize = other._textPadSize;
6767
}
6868

69-
QString Pin::name() const
69+
const QString &Pin::name() const
7070
{
7171
return _name;
7272
}
@@ -76,7 +76,7 @@ void Pin::setName(const QString &name)
7676
_name = name;
7777
}
7878

79-
QPoint Pin::pos() const
79+
const QPoint &Pin::pos() const
8080
{
8181
return _pos;
8282
}
@@ -137,7 +137,7 @@ void Pin::setAngle(int angle)
137137
_angle = angle;
138138
}
139139

140-
QString Pin::padName() const
140+
const QString &Pin::padName() const
141141
{
142142
return _padName;
143143
}
@@ -180,7 +180,7 @@ QString Pin::pinTypeDesc(PinType pinType)
180180
return QLatin1String("");
181181
}
182182

183-
void Pin::setPinType(const Pin::PinType &pinType)
183+
void Pin::setPinType(PinType pinType)
184184
{
185185
_pinType = pinType;
186186
}
@@ -277,7 +277,7 @@ void Pin::setLength(int length)
277277
}
278278
}
279279

280-
QString Pin::className() const
280+
const QString &Pin::className() const
281281
{
282282
return _className;
283283
}

src/kicad/model/pin.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ class KICAD_EXPORT Pin
7171
NonLogic
7272
};
7373

74-
QString name() const;
74+
const QString &name() const;
7575
void setName(const QString &name);
7676

77-
QPoint pos() const;
77+
const QPoint &pos() const;
7878
void setPos(const QPoint &pos);
7979
void setPos(int x, int y);
8080

@@ -83,12 +83,12 @@ class KICAD_EXPORT Pin
8383
Direction direction() const;
8484
void setDirection(Pin::Direction direction);
8585

86-
QString padName() const;
86+
const QString &padName() const;
8787
void setPadName(const QString &padname);
8888

8989
PinType pinType() const;
9090
static QString pinTypeDesc(Pin::PinType pinType);
91-
void setPinType(const PinType &pinType);
91+
void setPinType(PinType pinType);
9292

9393
ElectricalType electricalType() const;
9494
static QString electricalTypeDesc(Pin::ElectricalType electricalType);
@@ -106,13 +106,13 @@ class KICAD_EXPORT Pin
106106
int length() const;
107107
void setLength(int length);
108108

109-
QString className() const;
109+
const QString &className() const;
110110
void setClassName(const QString &className);
111111

112112
Component *component() const;
113113
void setComponent(Component *component);
114114

115-
friend bool operator<(const Pin &pin1, const Pin &pin);
115+
friend bool operator<(const Pin &pin1, const Pin &pin2);
116116
friend bool operator==(const Pin &pin1, const Pin &pin2);
117117

118118
private:

0 commit comments

Comments
 (0)