Skip to content

Commit df670ad

Browse files
committed
Remove trailing whitespace.
1 parent 47782f8 commit df670ad

File tree

3 files changed

+52
-52
lines changed

3 files changed

+52
-52
lines changed

example/autoprefixes.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
1+
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
22
// unit/quantity manipulation and conversion
33
//
44
// Copyright (C) 2003-2008 Matthias Christian Schabel
@@ -8,9 +8,9 @@
88
// accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11-
/**
11+
/**
1212
\file
13-
13+
1414
\brief Example of using autoprefixes.
1515
1616
\details
@@ -22,7 +22,7 @@ autoprefixes.cpp
2222
using native typeof
2323
Linking...
2424
Embedding manifest...
25-
Autorun "j:\Cpp\Misc\debug\autoprefixes.exe"
25+
Autorun "j:\Cpp\Misc\debug\autoprefixes.exe"
2626
2.345 m
2727
2.345 km
2828
5.49902 MJ
@@ -100,7 +100,7 @@ int main()
100100

101101
quantity<byte_base_unit::unit_type> b = 2048. * byte_base_unit::unit_type();
102102
cout << engineering_prefix << b << endl; // 2.048 kb
103-
cout << symbol_format << binary_prefix << b << endl; // "2 Kib"
103+
cout << symbol_format << binary_prefix << b << endl; // "2 Kib"
104104
//] [/autoprefixes_snippet_2]
105105

106106
// Note that scalar dimensionless values are *not* prefixed automatically by the engineering_prefix or binary_prefix iostream manipulators.
@@ -135,8 +135,8 @@ int main()
135135
quantity<thing_base_unit::unit_type> t = 2048. * thing_base_unit::unit_type();
136136
cout << name_format << engineering_prefix << t << endl; // 2.048 kilothing
137137
cout << symbol_format << engineering_prefix << t << endl; // 2.048 k
138-
139-
cout << binary_prefix << t << endl; // "2 Ki"
138+
139+
cout << binary_prefix << t << endl; // "2 Ki"
140140

141141
quantity<euro_base_unit::unit_type> ce = 2048. * euro_base_unit::unit_type();
142142
cout << name_format << engineering_prefix << ce << endl; // 2.048 kiloEUR

include/boost/units/io.hpp

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
1+
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
22
// unit/quantity manipulation and conversion
33
//
44
// Copyright (C) 2003-2008 Matthias Christian Schabel
@@ -51,7 +51,7 @@ inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsign
5151
{
5252
ar & boost::serialization::make_nvp("value", units::quantity_cast<Y&>(q));
5353
}
54-
54+
5555
} // namespace serialization
5656

5757
namespace units {
@@ -60,9 +60,9 @@ namespace units {
6060
template<class T> std::string to_string(const T& t)
6161
{
6262
std::stringstream sstr;
63-
63+
6464
sstr << t;
65-
65+
6666
return sstr.str();
6767
}
6868

@@ -126,7 +126,7 @@ enum autoprefix_mode
126126
namespace detail {
127127

128128
template<bool>
129-
struct xalloc_key_holder
129+
struct xalloc_key_holder
130130
{
131131
static int value;
132132
static bool initialized;
@@ -138,11 +138,11 @@ int xalloc_key_holder<b>::value = 0;
138138
template<bool b>
139139
bool xalloc_key_holder<b>::initialized = 0;
140140

141-
struct xalloc_key_initializer_t
141+
struct xalloc_key_initializer_t
142142
{
143-
xalloc_key_initializer_t()
143+
xalloc_key_initializer_t()
144144
{
145-
if (!xalloc_key_holder<true>::initialized)
145+
if (!xalloc_key_holder<true>::initialized)
146146
{
147147
xalloc_key_holder<true>::value = std::ios_base::xalloc();
148148
xalloc_key_holder<true>::initialized = true;
@@ -151,62 +151,62 @@ struct xalloc_key_initializer_t
151151
};
152152

153153
namespace /**/ {
154-
154+
155155
xalloc_key_initializer_t xalloc_key_initializer;
156156

157157
} // namespace
158158

159159
} // namespace detail
160160

161161
/// returns flags controlling output.
162-
inline long get_flags(std::ios_base& ios, long mask)
162+
inline long get_flags(std::ios_base& ios, long mask)
163163
{
164164
return(ios.iword(detail::xalloc_key_holder<true>::value) & mask);
165165
}
166166

167167
/// Set new flags controlling output format.
168-
inline void set_flags(std::ios_base& ios, long new_flags, long mask)
168+
inline void set_flags(std::ios_base& ios, long new_flags, long mask)
169169
{
170170
BOOST_ASSERT((~mask & new_flags) == 0);
171171
long& flags = ios.iword(detail::xalloc_key_holder<true>::value);
172172
flags = (flags & ~mask) | new_flags;
173173
}
174174

175175
/// returns flags controlling output format.
176-
inline format_mode get_format(std::ios_base& ios)
176+
inline format_mode get_format(std::ios_base& ios)
177177
{
178178
return(static_cast<format_mode>((get_flags)(ios, fmt_mask)));
179179
}
180180

181181
/// Set new flags controlling output format.
182-
inline void set_format(std::ios_base& ios, format_mode new_mode)
182+
inline void set_format(std::ios_base& ios, format_mode new_mode)
183183
{
184184
(set_flags)(ios, new_mode, fmt_mask);
185185
}
186186

187187
/// Set new flags for type_name output format.
188-
inline std::ios_base& typename_format(std::ios_base& ios)
188+
inline std::ios_base& typename_format(std::ios_base& ios)
189189
{
190190
(set_format)(ios, typename_fmt);
191191
return(ios);
192192
}
193193

194194
/// set new flag for raw format output, for example "m".
195-
inline std::ios_base& raw_format(std::ios_base& ios)
195+
inline std::ios_base& raw_format(std::ios_base& ios)
196196
{
197197
(set_format)(ios, raw_fmt);
198198
return(ios);
199199
}
200200

201201
/// set new format flag for symbol output, for example "m".
202-
inline std::ios_base& symbol_format(std::ios_base& ios)
202+
inline std::ios_base& symbol_format(std::ios_base& ios)
203203
{
204204
(set_format)(ios, symbol_fmt);
205205
return(ios);
206206
}
207207

208208
/// set new format for name output, for example "meter".
209-
inline std::ios_base& name_format(std::ios_base& ios)
209+
inline std::ios_base& name_format(std::ios_base& ios)
210210
{
211211
(set_format)(ios, name_fmt);
212212
return(ios);
@@ -267,7 +267,7 @@ inline std::string base_unit_symbol_string(const T&)
267267
return base_unit_info<typename T::tag_type>::symbol() + exponent_string(typename T::value_type());
268268
}
269269

270-
template<class T>
270+
template<class T>
271271
inline std::string base_unit_name_string(const T&)
272272
{
273273
return base_unit_info<typename T::tag_type>::name() + exponent_string(typename T::value_type());
@@ -317,12 +317,12 @@ struct symbol_string_impl<0>
317317
};
318318

319319
template<int N>
320-
struct scale_symbol_string_impl
320+
struct scale_symbol_string_impl
321321
{
322322
template<class Begin>
323-
struct apply
323+
struct apply
324324
{
325-
static void value(std::string& str)
325+
static void value(std::string& str)
326326
{
327327
str += Begin::item::symbol();
328328
scale_symbol_string_impl<N - 1>::template apply<typename Begin::next>::value(str);
@@ -334,7 +334,7 @@ template<>
334334
struct scale_symbol_string_impl<0>
335335
{
336336
template<class Begin>
337-
struct apply
337+
struct apply
338338
{
339339
static void value(std::string&) { }
340340
};
@@ -383,12 +383,12 @@ struct name_string_impl<0>
383383
};
384384

385385
template<int N>
386-
struct scale_name_string_impl
386+
struct scale_name_string_impl
387387
{
388388
template<class Begin>
389-
struct apply
389+
struct apply
390390
{
391-
static void value(std::string& str)
391+
static void value(std::string& str)
392392
{
393393
str += Begin::item::name();
394394
scale_name_string_impl<N - 1>::template apply<typename Begin::next>::value(str);
@@ -400,7 +400,7 @@ template<>
400400
struct scale_name_string_impl<0>
401401
{
402402
template<class Begin>
403-
struct apply
403+
struct apply
404404
{
405405
static void value(std::string&) { }
406406
};
@@ -464,14 +464,14 @@ to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_i
464464
f.template append_scale_to<Scale>(str);
465465

466466
std::string without_scale = f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >());
467-
467+
468468
if (f.is_default_string(without_scale, unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >()))
469469
{
470470
str += "(";
471471
str += without_scale;
472472
str += ")";
473-
}
474-
else
473+
}
474+
else
475475
{
476476
str += without_scale;
477477
}
@@ -1011,27 +1011,27 @@ name_string(const unit<Dimension, System>&)
10111011
template<class Char, class Traits, class Dimension, class System>
10121012
inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>& u)
10131013
{
1014-
if (units::get_format(os) == typename_fmt)
1014+
if (units::get_format(os) == typename_fmt)
10151015
{
10161016
detail::do_print(os, typename_string(u));
10171017
}
1018-
else if (units::get_format(os) == raw_fmt)
1018+
else if (units::get_format(os) == raw_fmt)
10191019
{
10201020
detail::do_print(os, detail::to_string_impl(u, detail::format_raw_symbol_impl()));
10211021
}
1022-
else if (units::get_format(os) == symbol_fmt)
1022+
else if (units::get_format(os) == symbol_fmt)
10231023
{
10241024
detail::do_print(os, symbol_string(u));
10251025
}
1026-
else if (units::get_format(os) == name_fmt)
1026+
else if (units::get_format(os) == name_fmt)
10271027
{
10281028
detail::do_print(os, name_string(u));
10291029
}
1030-
else
1030+
else
10311031
{
10321032
BOOST_ASSERT_MSG(false, "The format mode must be one of: typename_format, raw_format, name_format, symbol_format");
10331033
}
1034-
1034+
10351035
return(os);
10361036
}
10371037

test/test_output.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
1+
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
22
// unit/quantity manipulation and conversion
33
//
44
// Copyright (C) 2009 Steven Watanabe
@@ -8,10 +8,10 @@
88
// accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11-
/**
11+
/**
1212
\file test_output.cpp
13-
14-
\brief
13+
14+
\brief
1515
Test unit and quantity printing
1616
\details
1717
Tests for output from various units, name, symbol and raw formats, and automatic prefixing in engineering and binary units.
@@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(test_output_quantity_name)
311311

312312
BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_name)
313313
{ // Engineering autoprefix, with name format.
314-
#define FORMATTERS << boost::units::name_format << boost::units::engineering_prefix
314+
#define FORMATTERS << boost::units::name_format << boost::units::engineering_prefix
315315
// Single base unit like meter.
316316
BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
317317
BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 kilometer");
@@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_name)
366366

367367
BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_symbol)
368368
{ // Engineering autoprefix, with symbol format.
369-
#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix
369+
#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix
370370
// Single base unit like m.
371371
BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
372372
BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 km");
@@ -380,7 +380,7 @@ BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_symbol)
380380
BOOST_UNITS_TEST_OUTPUT_REGEX(1e+28 * meter_base_unit::unit_type(), "1e\\+0?28 m"); // Just too large for multiple.
381381
BOOST_UNITS_TEST_OUTPUT_REGEX(1.5e-25 * meter_base_unit::unit_type(), "1\\.5e-0?25 m"); // Too small for multiple.
382382
BOOST_UNITS_TEST_OUTPUT_REGEX(1.5e+28 * meter_base_unit::unit_type(), "1\\.5e\\+0?28 m"); // Too large for multiple.
383-
//
383+
//
384384
BOOST_UNITS_TEST_OUTPUT_REGEX((std::numeric_limits<float>::max)()*meter_base_unit::unit_type(), "3\\.40282e\\+0?38 m");
385385
BOOST_UNITS_TEST_OUTPUT_REGEX((std::numeric_limits<float>::min)()*meter_base_unit::unit_type(), "1\\.17549e-0?38 m");
386386
BOOST_UNITS_TEST_OUTPUT((std::numeric_limits<double>::max)()*meter_base_unit::unit_type(), "1.79769e+308 m");
@@ -427,7 +427,7 @@ BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_symbol)
427427
BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name)
428428
{ // Binary prefix with name format.
429429
// http://physics.nist.gov/cuu/Units/binary.html
430-
// 1998 the International Electrotechnical Commission (IEC) approved
430+
// 1998 the International Electrotechnical Commission (IEC) approved
431431
// IEC 60027-2, Second edition, 2000-11, Letter symbols to be used in electrical technology
432432
// - Part 2: Telecommunications and electronics.
433433
// IEC 80000-13:2008, Quantities and units
@@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name)
436436
BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2 kibibyte");
437437
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 32) *byte_base_unit::unit_type(), "4 gibibyte");
438438
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 41) *byte_base_unit::unit_type(), "2 tebibyte"); // http://en.wikipedia.org/wiki/Tebibyte
439-
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 50) *byte_base_unit::unit_type(), "1 pebibyte");
439+
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 50) *byte_base_unit::unit_type(), "1 pebibyte");
440440
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 60) *byte_base_unit::unit_type(), "1 exbibyte");
441441
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 70) *byte_base_unit::unit_type(), "1 zebibyte");
442442
BOOST_UNITS_TEST_OUTPUT(std::pow(2., 80) *byte_base_unit::unit_type(), "1 yobibyte");
@@ -456,7 +456,7 @@ BOOST_AUTO_TEST_CASE(test_output_quantity_name_duplicate)
456456

457457
BOOST_AUTO_TEST_CASE(test_output_quantity_symbol_duplicate)
458458
{ // Ensure that if more than one format specified, only the last is used.
459-
#define FORMATTERS << boost::units::name_format << boost::units::symbol_format
459+
#define FORMATTERS << boost::units::name_format << boost::units::symbol_format
460460
BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
461461
#undef FORMATTERS
462462
}

0 commit comments

Comments
 (0)