Skip to content

Commit 78224c7

Browse files
committed
ui: mark some Plate and View constructors explicit
1 parent c9465fc commit 78224c7

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

include/sdr/ui/plate.hpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,26 @@ struct PlateStyle {
3434

3535
class Plate {
3636
public:
37-
Plate(int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, Vec2 p = { 0.0f, 0.0f })
37+
explicit Plate(int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP,
38+
Vec2 p = { 0.0f, 0.0f })
3839
: align_(a), pos_(p)
3940
{}
4041

41-
Plate(PlateStyle s,
42-
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, Vec2 p = { 0.0f, 0.0f })
42+
explicit Plate(PlateStyle s,
43+
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP,
44+
Vec2 p = { 0.0f, 0.0f })
4345
: style_(s), align_(a), pos_(p)
4446
{}
4547

46-
Plate(StringView l,
47-
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, Vec2 p = { 0.0f, 0.0f })
48+
explicit Plate(StringView l,
49+
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP,
50+
Vec2 p = { 0.0f, 0.0f })
4851
: label_(l.to_string()), align_(a), pos_(p)
4952
{}
5053

51-
Plate(StringView l, PlateStyle s,
52-
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, Vec2 p = { 0.0f, 0.0f })
54+
explicit Plate(StringView l, PlateStyle s,
55+
int a = NVG_ALIGN_LEFT | NVG_ALIGN_TOP,
56+
Vec2 p = { 0.0f, 0.0f })
5357
: label_(l.to_string()), style_(s), align_(a), pos_(p)
5458
{}
5559

include/sdr/ui/view.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,21 @@ class View {
9696
IsometricFitMax,
9797
};
9898

99-
View(Vec2 size = { 1.0f, 1.0f },
100-
Vec2 center = { 0.0f, 0.0f },
101-
Vec2 zoom_rate = { 1.1f, 1.1f })
99+
explicit View(Vec2 size = { 1.0f, 1.0f },
100+
Vec2 center = { 0.0f, 0.0f },
101+
Vec2 zoom_rate = { 1.1f, 1.1f })
102102
: iso(NonIsometric), size_(size), center_(center), rate(zoom_rate)
103103
{}
104104

105-
View(IsometricMode mode,
106-
Vec2 size = { 1.0f, 1.0f },
107-
Vec2 center = { 0.0f, 0.0f },
108-
Vec2 zoom_rate = { 1.1f, 1.1f })
105+
explicit View(IsometricMode mode,
106+
Vec2 size,
107+
Vec2 center = { 0.0f, 0.0f },
108+
Vec2 zoom_rate = { 1.1f, 1.1f })
109109
: iso(mode), size_(size), center_(center), rate(zoom_rate)
110110
{}
111111

112+
View(IsometricMode mode) : View(mode, { 1.0f, 1.0f }) {}
113+
112114
View(View const&) = default;
113115
View(View&&) = default;
114116

0 commit comments

Comments
 (0)