Skip to content

Commit a6da52e

Browse files
committed
Add curly braces, apply coding style
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
1 parent b76e66e commit a6da52e

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

src/Duration.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,49 +226,75 @@ bool Duration::parse_designated (Pig& pig)
226226
long long value;
227227
pig.save ();
228228
if (pig.getDigits (value) && pig.skip ('Y'))
229+
{
229230
_year = sign * value;
231+
}
230232
else
233+
{
231234
pig.restore ();
235+
}
232236

233237
pig.save ();
234238
if (pig.getDigits (value) && pig.skip ('M'))
239+
{
235240
_month = sign * value;
241+
}
236242
else
243+
{
237244
pig.restore ();
245+
}
238246

239247
pig.save ();
240248
if (pig.getDigits (value) && pig.skip ('D'))
249+
{
241250
_day = sign * value;
251+
}
242252
else
253+
{
243254
pig.restore ();
255+
}
244256

245257
if (pig.skip ('T') &&
246258
! pig.eos ())
247259
{
248260
pig.save ();
249261
if (pig.getDigits (value) && pig.skip ('H'))
262+
{
250263
_hours = sign * value;
264+
}
251265
else
266+
{
252267
pig.restore ();
268+
}
253269

254270
pig.save ();
255271
if (pig.getDigits (value) && pig.skip ('M'))
272+
{
256273
_minutes = sign * value;
274+
}
257275
else
276+
{
258277
pig.restore ();
278+
}
259279

260280
pig.save ();
261281
if (pig.getDigits (value) && pig.skip ('S'))
282+
{
262283
_seconds = sign * value;
284+
}
263285
else
286+
{
264287
pig.restore ();
288+
}
265289
}
266290

267291
auto following = pig.peek ();
268292
if (pig.cursor () - checkpoint >= 3 &&
269293
! unicodeLatinAlpha (following) &&
270294
! unicodeLatinDigit (following))
295+
{
271296
return true;
297+
}
272298
}
273299

274300
pig.restoreTo (checkpoint);
@@ -405,7 +431,8 @@ std::string Duration::format () const
405431
time_t t = _period;
406432

407433
std::stringstream s;
408-
if (t < 0) {
434+
if (t < 0)
435+
{
409436
s << '-';
410437
t *= -1;
411438
}
@@ -440,7 +467,8 @@ std::string Duration::formatHours () const
440467
time_t t = _period;
441468

442469
std::stringstream s;
443-
if (t < 0) {
470+
if (t < 0)
471+
{
444472
s << '-';
445473
t *= -1;
446474
}
@@ -471,7 +499,8 @@ std::string Duration::formatISO () const
471499
time_t t = _period;
472500

473501
std::stringstream s;
474-
if (t < 0) {
502+
if (t < 0)
503+
{
475504
s << '-';
476505
t *= -1;
477506
}
@@ -517,7 +546,8 @@ std::string Duration::formatVague (bool padding) const
517546
float days = (float) _period / 86400.0;
518547

519548
std::stringstream formatted;
520-
if (t < 0) {
549+
if (t < 0)
550+
{
521551
formatted << '-';
522552
t *= -1;
523553
days *= -1.0;

0 commit comments

Comments
 (0)