Skip to content

Commit d210fd8

Browse files
committed
explicit constructors for all widgets
1 parent 765451c commit d210fd8

17 files changed

+78
-33
lines changed

src/Basic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,14 @@ namespace PhWidgets
406406
Constructs a Basic widget by ID.
407407
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
408408
*/
409-
Basic(int abn);
409+
explicit Basic(int abn);
410410

411411
//! (constructor)
412412
/*!
413413
Constructs a Basic widget by pointer to widget.
414414
@param[in] wdg pointer to Photon widget.
415415
*/
416-
Basic(PtWidget_t *wdg);
416+
explicit Basic(PtWidget_t *wdg);
417417

418418
//! (copy constructor)
419419
/*!

src/Button.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ namespace PhWidgets
146146
Constructs a Button widget by ID.
147147
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
148148
*/
149-
Button(int abn);
149+
explicit Button(int abn);
150150

151151
//! (constructor)
152152
/*!
153153
Constructs a Button widget by pointer to widget.
154154
@param[in] wdg pointer to Photon widget.
155155
*/
156-
Button(PtWidget_t *wdg);
156+
explicit Button(PtWidget_t *wdg);
157157

158158
//! (copy constructor)
159159
/*!

src/Compound.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ namespace PhWidgets
3939
Constructs a Compound widget by ID.
4040
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
4141
*/
42-
Compound(int abn);
42+
explicit Compound(int abn);
4343

4444
//! (constructor)
4545
/*!
4646
Constructs a Compound widget by pointer to widget.
4747
@param[in] wdg pointer to Photon widget.
4848
*/
49-
Compound(PtWidget_t *wdg);
49+
explicit Compound(PtWidget_t *wdg);
5050

5151
//! @name Properties
5252
//! Properties are used to simplify use of widget resources.

src/Container.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,14 @@ namespace PhWidgets
342342
Constructs a Container widget by ID.
343343
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
344344
*/
345-
Container(int abn);
345+
explicit Container(int abn);
346346

347347
//! (constructor)
348348
/*!
349349
Constructs a Container widget by pointer to widget.
350350
@param[in] wdg pointer to Photon widget.
351351
*/
352-
Container(PtWidget_t *wdg);
352+
explicit Container(PtWidget_t *wdg);
353353

354354
//! (copy constructor)
355355
/*!

src/Disjoint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ namespace PhWidgets
128128
Constructs a Disjoint widget by ID.
129129
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
130130
*/
131-
Disjoint(int abn);
131+
explicit Disjoint(int abn);
132132

133133
//! (constructor)
134134
/*!
135135
Constructs a Disjoint widget by pointer to widget.
136136
@param[in] wdg pointer to Photon widget.
137137
*/
138-
Disjoint(PtWidget_t *wdg);
138+
explicit Disjoint(PtWidget_t *wdg);
139139

140140
//! (copy constructor)
141141
/*!

src/Graphic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ namespace PhWidgets
333333
Constructs a Graphic by ID.
334334
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
335335
*/
336-
Graphic(int abn);
336+
explicit Graphic(int abn);
337337

338338
//! (constructor)
339339
/*!
340340
Constructs a Graphic by pointer to widget.
341341
@param[in] wdg pointer to Photon widget.
342342
*/
343-
Graphic(PtWidget_t *wdg);
343+
explicit Graphic(PtWidget_t *wdg);
344344

345345
//! (copy constructor)
346346
/*!

src/Label.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,14 @@ namespace PhWidgets
499499
Constructs a Label widget by ID.
500500
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
501501
*/
502-
Label(int abn);
502+
explicit Label(int abn);
503503

504504
//! (constructor)
505505
/*!
506506
Constructs a Label widget by pointer to widget.
507507
@param[in] wdg pointer to Photon widget.
508508
*/
509-
Label(PtWidget_t *wdg);
509+
explicit Label(PtWidget_t *wdg);
510510

511511
//! (copy constructor)
512512
/*!
@@ -543,7 +543,7 @@ namespace PhWidgets
543543
/*!
544544
### Property Value ###
545545
546-
> std::string
546+
> `std::string`
547547
548548
The text associated with this widget.
549549

src/Numeric.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ namespace PhWidgets
129129
Constructs a Numeric widget by ID.
130130
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
131131
*/
132-
Numeric(int abn);
132+
explicit Numeric(int abn);
133133

134134
//! (constructor)
135135
/*!
136136
Constructs a Numeric widget by pointer to widget.
137137
@param[in] wdg pointer to Photon widget.
138138
*/
139-
Numeric(PtWidget_t *wdg);
139+
explicit Numeric(PtWidget_t *wdg);
140140

141141
//! (copy constructor)
142142
/*!

src/NumericFloat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ namespace PhWidgets
147147
Constructs a NumericFloat widget by ID.
148148
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
149149
*/
150-
NumericFloat(int abn);
150+
explicit NumericFloat(int abn);
151151

152152
//! (constructor)
153153
/*!
154154
Constructs a NumericFloat widget by pointer to widget.
155155
@param[in] wdg pointer to Photon widget.
156156
*/
157-
NumericFloat(PtWidget_t *wdg);
157+
explicit NumericFloat(PtWidget_t *wdg);
158158

159159
//! (copy constructor)
160160
/*!

src/NumericInteger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ namespace PhWidgets
121121
Constructs a NumericInteger widget by ID.
122122
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
123123
*/
124-
NumericInteger(int abn);
124+
explicit NumericInteger(int abn);
125125

126126
//! (constructor)
127127
/*!
128128
Constructs a NumericInteger widget by pointer to widget.
129129
@param[in] wdg pointer to Photon widget.
130130
*/
131-
NumericInteger(PtWidget_t *wdg);
131+
explicit NumericInteger(PtWidget_t *wdg);
132132

133133
//! (copy constructor)
134134
/*!

src/OnOffButton.h

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,49 @@ namespace PhWidgets
116116
Constructs a OnOffButton widget by ID.
117117
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
118118
*/
119-
OnOffButton(int abn);
120-
OnOffButton(PtWidget_t* wdg);
119+
explicit OnOffButton(int abn);
120+
121+
//! (constructor)
122+
/*!
123+
Constructs a OnOffButton widget by pointer to widget.
124+
@param[in] wdg pointer to Photon widget.
125+
*/
126+
explicit OnOffButton(PtWidget_t* wdg);
121127

122-
OnOffButton(const OnOffButton&);
128+
//! (copy constructor)
129+
/*!
130+
Constructs a OnOffButton widget by copy.
131+
@param[in] other another OnOffButton widget to be used as source to initialize the elements of the container with.
132+
*/
133+
OnOffButton(const OnOffButton &other);
123134

124-
OnOffButton &operator=(const OnOffButton &rhs);
135+
//! Assigns value in OnOffButton widget
136+
/*!
137+
Replaces the contents of the OnOffButton widget.
138+
@param[in] other another OnOffButton widget to use as data source.
139+
*/
140+
OnOffButton &operator=(const OnOffButton &other);
125141

126142
void Check(bool val = true);
127143
void Uncheck(bool val = true);
128144

129145
//! @name Properties
130146
//! Properties are used to simplify use of widget resources.
131147
//@{
148+
149+
//! Gets or set a value indicating whether the OnOffButton is in the checked state.
150+
/*!
151+
### Property Value ###
152+
153+
> **bool**
154+
155+
`true` if the OnOffButton is in the checked state; otherwise, `false`. The default value is `false`.
156+
157+
@see
158+
- Type
159+
*/
132160
phproperty<bool>::bind<OnOffButton, ArgBool::eArgBool, Arguments::onoff_state> Checked;
161+
133162
//@}
134163

135164
phwidgets_event<OnOffButton, OnOffButton::Callbacks::new_value> NewValue;

src/Text.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ namespace PhWidgets
113113
Constructs a Text widget by ID.
114114
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
115115
*/
116-
Text(int abn);
116+
explicit Text(int abn);
117117

118118
//! (constructor)
119119
/*!
120120
Constructs a Text widget by pointer to widget.
121121
@param[in] wdg pointer to Photon widget.
122122
*/
123-
Text(PtWidget_t *wdg);
123+
explicit Text(PtWidget_t *wdg);
124124

125125
//! (copy constructor)
126126
/*!

src/Timer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ namespace PhWidgets
129129
Constructs a Timer widget by ID.
130130
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
131131
*/
132-
Timer(int abn);
132+
explicit Timer(int abn);
133133

134134
//! (constructor)
135135
/*!
136136
Constructs a Timer widget by pointer to widget.
137137
@param[in] wdg pointer to Photon widget.
138138
*/
139-
Timer(PtWidget_t *wdg);
139+
explicit Timer(PtWidget_t *wdg);
140140

141141
//! (copy constructor)
142142
/*!

src/ToggleButton.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ namespace PhWidgets
135135
Constructs a ToggleButton by ID.
136136
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
137137
*/
138-
ToggleButton(int abn);
138+
explicit ToggleButton(int abn);
139139

140140
//! (constructor)
141141
/*!
142142
Constructs a ToggleButton by pointer to widget.
143143
@param[in] wdg pointer to Photon widget.
144144
*/
145-
ToggleButton(PtWidget_t *wdg);
145+
explicit ToggleButton(PtWidget_t *wdg);
146146

147147
//! (copy constructor)
148148
/*!

src/Widget.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@ Widget &Widget::operator=(const Widget &other)
348348
return *this;
349349
}
350350

351+
Widget &Widget::operator=(PtWidget_t *wdg)
352+
{
353+
Widget tmp(wdg);
354+
355+
tmp.swap(*this);
356+
357+
return *this;
358+
}
359+
351360
bool Widget::operator==(const Widget &other) const
352361
{
353362
if(&other == this)

src/Widget.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,13 @@ namespace PhWidgets
10231023
*/
10241024
Widget &operator=(const Widget &other);
10251025

1026+
//! Assigns value in Widget
1027+
/*!
1028+
Replaces the contents of the Widget.
1029+
@param[in] wdg pointer to Photon widget.
1030+
*/
1031+
Widget &operator=(PtWidget_t *wdg);
1032+
10261033
//! Compares Widgets
10271034
/*!
10281035
Compares the Widgets by their Photon widget pointers.

src/Window.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,14 @@ namespace PhWidgets
227227
Constructs a Window by ID.
228228
@param[in] abn ID given by PhAB to widget (like 'ABN_WIDGET_NAME').
229229
*/
230-
Window(int abn);
230+
explicit Window(int abn);
231231

232232
//! (constructor)
233233
/*!
234234
Constructs a Window by pointer to widget.
235235
@param[in] wdg pointer to Photon widget.
236236
*/
237-
Window(PtWidget_t *wdg);
237+
explicit Window(PtWidget_t *wdg);
238238

239239
//! (copy constructor)
240240
/*!

0 commit comments

Comments
 (0)