Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62532 - in trunk: . boost/archive boost/integer boost/math boost/serialization boost/smart_ptr boost/units boost/units/detail boost/units/systems/si/codata libs/graph/quickbook/guide libs/integer libs/math libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/serialization libs/units/doc libs/units/example libs/units/test status tools/quickbook tools/regression/src
From: steven_at_[hidden]
Date: 2010-06-07 19:50:01


Author: steven_watanabe
Date: 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
New Revision: 62532
URL: http://svn.boost.org/trac/boost/changeset/62532

Log:
Merge the units/autoprefix branch back to the trunk. Fixes #3660. Fixes #3707
Added:
   trunk/libs/units/example/autoprefixes.cpp
      - copied unchanged from r62523, /branches/units/autoprefix/libs/units/example/autoprefixes.cpp
Properties modified:
   trunk/ (props changed)
   trunk/boost/archive/ (props changed)
   trunk/boost/integer/ (props changed)
   trunk/boost/math/ (props changed)
   trunk/boost/serialization/ (props changed)
   trunk/boost/smart_ptr/enable_shared_from_raw.hpp (props changed)
   trunk/libs/graph/quickbook/guide/theory.qbk (props changed)
   trunk/libs/graph/quickbook/guide/tour.qbk (props changed)
   trunk/libs/integer/ (props changed)
   trunk/libs/math/ (props changed)
   trunk/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   trunk/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   trunk/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   trunk/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   trunk/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   trunk/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   trunk/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   trunk/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   trunk/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   trunk/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   trunk/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   trunk/libs/serialization/ (props changed)
   trunk/status/explicit-failures-markup.xml (props changed)
   trunk/tools/quickbook/ (props changed)
   trunk/tools/regression/src/library_status.cpp (props changed)
Text files modified:
   trunk/boost/units/absolute.hpp | 8
   trunk/boost/units/base_dimension.hpp | 4
   trunk/boost/units/base_unit.hpp | 4
   trunk/boost/units/cmath.hpp | 13
   trunk/boost/units/config.hpp | 6
   trunk/boost/units/conversion.hpp | 3
   trunk/boost/units/detail/one.hpp | 5
   trunk/boost/units/dim.hpp | 4
   trunk/boost/units/dimensionless_quantity.hpp | 7
   trunk/boost/units/dimensionless_type.hpp | 5
   trunk/boost/units/dimensionless_unit.hpp | 7
   trunk/boost/units/get_dimension.hpp | 12
   trunk/boost/units/get_system.hpp | 9
   trunk/boost/units/heterogeneous_system.hpp | 7
   trunk/boost/units/io.hpp | 507 +++++++++++++++++++++++++++++++++++----
   trunk/boost/units/is_dim.hpp | 5
   trunk/boost/units/is_dimension_list.hpp | 5
   trunk/boost/units/is_dimensionless.hpp | 9
   trunk/boost/units/is_dimensionless_quantity.hpp | 5
   trunk/boost/units/is_dimensionless_unit.hpp | 5
   trunk/boost/units/is_quantity.hpp | 7
   trunk/boost/units/is_quantity_of_dimension.hpp | 7
   trunk/boost/units/is_quantity_of_system.hpp | 7
   trunk/boost/units/is_unit.hpp | 7
   trunk/boost/units/is_unit_of_dimension.hpp | 7
   trunk/boost/units/is_unit_of_system.hpp | 7
   trunk/boost/units/limits.hpp | 6
   trunk/boost/units/make_scaled_unit.hpp | 15 +
   trunk/boost/units/make_system.hpp | 10
   trunk/boost/units/operators.hpp | 23
   trunk/boost/units/physical_dimensions.hpp | 22 +
   trunk/boost/units/pow.hpp | 18
   trunk/boost/units/reduce_unit.hpp | 3
   trunk/boost/units/scale.hpp | 8
   trunk/boost/units/static_rational.hpp | 2
   trunk/boost/units/systems/si/codata/electromagnetic_constants.hpp | 13
   trunk/boost/units/units_fwd.hpp | 7
   trunk/libs/units/doc/Jamfile.v2 | 3
   trunk/libs/units/doc/units.qbk | 136 ++++++++--
   trunk/libs/units/example/complex.cpp | 2
   trunk/libs/units/example/composite_output.cpp | 2
   trunk/libs/units/example/conversion.cpp | 2
   trunk/libs/units/example/conversion_factor.cpp | 2
   trunk/libs/units/example/dimension.cpp | 2
   trunk/libs/units/example/heterogeneous_unit.cpp | 2
   trunk/libs/units/example/kitchen_sink.cpp | 2
   trunk/libs/units/example/non_base_dimension.cpp | 2
   trunk/libs/units/example/performance.cpp | 2
   trunk/libs/units/example/quantity.cpp | 2
   trunk/libs/units/example/quaternion.cpp | 2
   trunk/libs/units/example/radar_beam_height.cpp | 2
   trunk/libs/units/example/systems.cpp | 2
   trunk/libs/units/example/temperature.cpp | 2
   trunk/libs/units/example/tutorial.cpp | 52 ++-
   trunk/libs/units/example/unit.cpp | 2
   trunk/libs/units/test/fail_add_temperature.cpp | 2
   trunk/libs/units/test/fail_adl_detail.cpp | 2
   trunk/libs/units/test/fail_base_dimension.cpp | 2
   trunk/libs/units/test/fail_heterogeneous_unit.cpp | 2
   trunk/libs/units/test/fail_implicit_conversion.cpp | 2
   trunk/libs/units/test/fail_quantity_add.cpp | 2
   trunk/libs/units/test/fail_quantity_add_assign.cpp | 2
   trunk/libs/units/test/fail_quantity_assign.cpp | 2
   trunk/libs/units/test/fail_quantity_construct.cpp | 2
   trunk/libs/units/test/fail_quantity_non_unit.cpp | 2
   trunk/libs/units/test/fail_quantity_scalar_add.cpp | 2
   trunk/libs/units/test/fail_quantity_scalar_sub.cpp | 2
   trunk/libs/units/test/fail_quantity_sub_assign.cpp | 2
   trunk/libs/units/test/fail_quantity_subtract.cpp | 2
   trunk/libs/units/test/fail_quantity_unit_add.cpp | 2
   trunk/libs/units/test/fail_quantity_unit_subtract.cpp | 2
   trunk/libs/units/test/fail_scalar_quantity_add.cpp | 2
   trunk/libs/units/test/fail_scalar_quantity_sub.cpp | 2
   trunk/libs/units/test/fail_unit_quantity_add.cpp | 2
   trunk/libs/units/test/fail_unit_quantity_subtract.cpp | 2
   trunk/libs/units/test/test_absolute.cpp | 2
   trunk/libs/units/test/test_base_dimension.cpp | 2
   trunk/libs/units/test/test_cmath.cpp | 2
   trunk/libs/units/test/test_constants.cpp | 2
   trunk/libs/units/test/test_conversion.cpp | 2
   trunk/libs/units/test/test_custom_unit.cpp | 12
   trunk/libs/units/test/test_dimensionless_quantity.cpp | 2
   trunk/libs/units/test/test_header.hpp | 2
   trunk/libs/units/test/test_implicit_conversion.cpp | 2
   trunk/libs/units/test/test_limits.cpp | 2
   trunk/libs/units/test/test_negative_denominator.cpp | 2
   trunk/libs/units/test/test_output.cpp | 205 +++++++++++++++
   trunk/libs/units/test/test_predicates.cpp | 2
   trunk/libs/units/test/test_quantity.cpp | 2
   trunk/libs/units/test/test_reduce_unit.cpp | 2
   trunk/libs/units/test/test_scaled_conversion.cpp | 2
   trunk/libs/units/test/test_scaled_unit.cpp | 2
   trunk/libs/units/test/test_trig.cpp | 2
   trunk/libs/units/test/test_unit.cpp | 2
   trunk/libs/units/test/test_unscale.cpp | 4
   95 files changed, 1072 insertions(+), 243 deletions(-)

Modified: trunk/boost/units/absolute.hpp
==============================================================================
--- trunk/boost/units/absolute.hpp (original)
+++ trunk/boost/units/absolute.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -8,6 +8,12 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+///
+/// \file
+/// \brief Absolute units (points rather than vectors).
+/// \details Operations between absolute units, and relative units like temperature differences.
+///
+
 #ifndef BOOST_UNITS_ABSOLUTE_HPP
 #define BOOST_UNITS_ABSOLUTE_HPP
 
@@ -23,7 +29,7 @@
 /// originally for temperatures, this class implements operators for absolute units
 /// so that addition of a relative unit to an absolute unit results in another
 /// absolute unit : absolute<T> +/- T -> absolute<T> and subtraction of one absolute
-/// unit from another results in a relative unit : absolute<T> - absolute<T> -> T
+/// unit from another results in a relative unit : absolute<T> - absolute<T> -> T.
 template<class Y>
 class absolute
 {

Modified: trunk/boost/units/base_dimension.hpp
==============================================================================
--- trunk/boost/units/base_dimension.hpp (original)
+++ trunk/boost/units/base_dimension.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -8,6 +8,10 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/// \file
+/// \brief base dimensions (mass, length, time...).
+/// \details base dimension definition registration.
+
 #ifndef BOOST_UNITS_BASE_DIMENSION_HPP
 #define BOOST_UNITS_BASE_DIMENSION_HPP
 

Modified: trunk/boost/units/base_unit.hpp
==============================================================================
--- trunk/boost/units/base_unit.hpp (original)
+++ trunk/boost/units/base_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -8,6 +8,10 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/// \file
+/// \brief base unit (meter, kg, sec...).
+/// \details base unit definition registration.
+
 #ifndef BOOST_UNITS_BASE_UNIT_HPP
 #define BOOST_UNITS_BASE_UNIT_HPP
 

Modified: trunk/boost/units/cmath.hpp
==============================================================================
--- trunk/boost/units/cmath.hpp (original)
+++ trunk/boost/units/cmath.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -27,19 +27,18 @@
 
 #include <boost/units/systems/si/plane_angle.hpp>
 
-/// \file
-/// \brief Overloads of functions in \<cmath\> for quantities
-///
-/// \detailed Only functions for which a dimensionally-correct result type
-/// can be determined are overloaded. All functions work with dimensionless
-/// quantities.
+/// \file
+/// \brief Overloads of functions in \<cmath\> for quantities.
+/// \details Only functions for which a dimensionally-correct result type
+/// can be determined are overloaded.
+/// All functions work with dimensionless quantities.
 
 // BOOST_PREVENT_MACRO_SUBSTITUTION is needed on certain compilers that define
 // some <cmath> functions as macros; it is used for all functions even though it
 // isn't necessary -- I didn't want to think :)
 //
 // the form using namespace detail; return(f(x)); is used
-// to enable ADL for UDTs
+// to enable ADL for UDTs.
 
 namespace boost {
 

Modified: trunk/boost/units/config.hpp
==============================================================================
--- trunk/boost/units/config.hpp (original)
+++ trunk/boost/units/config.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -8,6 +8,10 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/// \file
+/// \brief Boost units library configuration and Doxygen mainpage.
+/// \details BOOST_UNITS_HAS_BOOST_TYPEOF, BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY
+
 #ifndef BOOST_UNITS_CONFIG_HPP
 #define BOOST_UNITS_CONFIG_HPP
 
@@ -91,7 +95,7 @@
 /// is not layout compatible with T
 #define BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY
 
-/// If defined will diasable a preprocessor check that the
+/// If defined will disable a preprocessor check that the
 /// compiler is able to handle the library.
 #define BOOST_UNITS_NO_COMPILER_CHECK
 

Modified: trunk/boost/units/conversion.hpp
==============================================================================
--- trunk/boost/units/conversion.hpp (original)
+++ trunk/boost/units/conversion.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_CONVERSION_HPP
 #define BOOST_UNITS_CONVERSION_HPP
 
+/// \file
+/// \brief Template for defining conversions between quantities.
+
 #include <boost/units/detail/conversion_impl.hpp>
 
 namespace boost {

Modified: trunk/boost/units/detail/one.hpp
==============================================================================
--- trunk/boost/units/detail/one.hpp (original)
+++ trunk/boost/units/detail/one.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -97,6 +97,11 @@
     return(result);
 }
 
+template<class T>
+inline bool operator>(const boost::units::one&, const T& t) {
+ return(1 > t);
+}
+
 } // namespace units
 
 } // namespace boost

Modified: trunk/boost/units/dim.hpp
==============================================================================
--- trunk/boost/units/dim.hpp (original)
+++ trunk/boost/units/dim.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -21,7 +21,7 @@
 #include <boost/units/static_rational.hpp>
 #include <boost/units/detail/dim_impl.hpp>
 
-/// \file
+/// \file dim.hpp
 /// \brief Handling of fundamental dimension/exponent pairs.
 
 namespace boost {
@@ -36,7 +36,7 @@
 
 /// \brief Dimension tag/exponent pair for a single fundamental dimension.
 ///
-/// \detailed
+/// \details
 /// The dim class represents a single dimension tag/dimension exponent pair.
 /// That is, @c dim<tag_type,value_type> is a pair where @c tag_type represents the
 /// fundamental dimension being represented and @c value_type represents the

Modified: trunk/boost/units/dimensionless_quantity.hpp
==============================================================================
--- trunk/boost/units/dimensionless_quantity.hpp (original)
+++ trunk/boost/units/dimensionless_quantity.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_QUANTITY_HPP
 #define BOOST_UNITS_DIMENSIONLESS_QUANTITY_HPP
 
+///
+/// \file
+/// \brief Utility class to simplify construction of dimensionless quantities.
+///
+
 #include <boost/units/dimensionless_unit.hpp>
 #include <boost/units/quantity.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// utility class to simplify construction of dimensionless quantities
+/// Utility class to simplify construction of dimensionless quantities.
 template<class System,class Y>
 struct dimensionless_quantity
 {

Modified: trunk/boost/units/dimensionless_type.hpp
==============================================================================
--- trunk/boost/units/dimensionless_type.hpp (original)
+++ trunk/boost/units/dimensionless_type.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_TYPE_HPP
 #define BOOST_UNITS_DIMENSIONLESS_TYPE_HPP
 
+///
+/// \file
+/// \brief Dimension lists in which all exponents resolve to zero reduce to @c dimensionless_type.
+///
+
 #include <boost/mpl/long.hpp>
 #include <boost/mpl/deref.hpp>
 #include <boost/mpl/arithmetic.hpp>

Modified: trunk/boost/units/dimensionless_unit.hpp
==============================================================================
--- trunk/boost/units/dimensionless_unit.hpp (original)
+++ trunk/boost/units/dimensionless_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
 #define BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
 
+///
+/// \file
+/// \brief Utility class to simplify construction of dimensionless units in a system.
+///
+
 #include <boost/units/dimensionless_type.hpp>
 #include <boost/units/unit.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// utility class to simplify construction of dimensionless units in a system
+/// Utility class to simplify construction of dimensionless units in a system.
 template<class System>
 struct dimensionless_unit
 {

Modified: trunk/boost/units/get_dimension.hpp
==============================================================================
--- trunk/boost/units/get_dimension.hpp (original)
+++ trunk/boost/units/get_dimension.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,12 @@
 #ifndef BOOST_UNITS_GET_DIMENSION_HPP
 #define BOOST_UNITS_GET_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Get the dimension of a unit, absolute unit and quantity.
+/// \details
+///
+
 #include <boost/units/units_fwd.hpp>
 
 namespace boost {
@@ -20,21 +26,21 @@
 template<class T>
 struct get_dimension {};
 
-/// get the dimension of a unit
+/// Get the dimension of a unit.
 template<class Dim,class System>
 struct get_dimension< unit<Dim,System> >
 {
     typedef Dim type;
 };
 
-/// get the dimension of an absolute unit
+/// Get the dimension of an absolute unit.
 template<class Unit>
 struct get_dimension< absolute<Unit> >
 {
     typedef typename get_dimension<Unit>::type type;
 };
 
-/// get the dimension of a quantity
+/// Get the dimension of a quantity.
 template<class Unit,class Y>
 struct get_dimension< quantity<Unit,Y> >
 {

Modified: trunk/boost/units/get_system.hpp
==============================================================================
--- trunk/boost/units/get_system.hpp (original)
+++ trunk/boost/units/get_system.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_GET_SYSTEM_HPP
 #define BOOST_UNITS_GET_SYSTEM_HPP
 
+/// \file
+/// \brief Get the system of a unit, absolute unit or quantity.
+
 #include <boost/units/units_fwd.hpp>
 
 namespace boost {
@@ -20,21 +23,21 @@
 template<class T>
 struct get_system {};
 
-/// get the system of a unit
+/// Get the system of a unit.
 template<class Dim,class System>
 struct get_system< unit<Dim,System> >
 {
     typedef System type;
 };
 
-/// get the system of an absolute unit
+/// Get the system of an absolute unit.
 template<class Unit>
 struct get_system< absolute<Unit> >
 {
     typedef typename get_system<Unit>::type type;
 };
 
-/// get the system of a quantity
+/// Get the system of a quantity.
 template<class Unit,class Y>
 struct get_system< quantity<Unit,Y> >
 {

Modified: trunk/boost/units/heterogeneous_system.hpp
==============================================================================
--- trunk/boost/units/heterogeneous_system.hpp (original)
+++ trunk/boost/units/heterogeneous_system.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
 #define BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
 
+/// \file
+/// \brief A heterogeneous system is a sorted list of base unit/exponent pairs.
+/// \details As long as we don't need to convert heterogeneous systems
+/// directly everything is cool.
+
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/plus.hpp>
 #include <boost/mpl/times.hpp>
@@ -45,7 +50,7 @@
 // A normal system is a sorted list of base units.
 // A heterogeneous system is a sorted list of base unit/exponent pairs.
 // As long as we don't need to convert heterogeneous systems
-// directly everything is cool
+// directly everything is cool.
 
 template<class T>
 struct is_zero : mpl::false_ {};

Modified: trunk/boost/units/io.hpp
==============================================================================
--- trunk/boost/units/io.hpp (original)
+++ trunk/boost/units/io.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2007-2008 Steven Watanabe
+// Copyright (C) 2007-2010 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -11,20 +11,24 @@
 #ifndef BOOST_UNITS_IO_HPP
 #define BOOST_UNITS_IO_HPP
 
+/// \file
+/// \brief Stream input and output for rationals, units and quantities.
+/// \details Functions and manipulators for output and input of units and quantities.
+/// symbol and name format, and engineering and binary autoprefix.
+/// Serialisation output is also supported.
+
 #include <cassert>
+#include <cmath>
 #include <string>
 #include <iosfwd>
 #include <ios>
 #include <sstream>
 
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
 #include <boost/serialization/nvp.hpp>
 
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/make_scaled_unit.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/scale.hpp>
 #include <boost/units/static_rational.hpp>
@@ -51,7 +55,7 @@
 
 namespace units {
 
-// get string representation of arbitrary type
+// get string representation of arbitrary type.
 template<class T> std::string to_string(const T& t)
 {
     std::stringstream sstr;
@@ -61,13 +65,13 @@
     return sstr.str();
 }
 
-// get string representation of integral-valued @c static_rational
+/// get string representation of integral-valued @c static_rational.
 template<integer_type N> std::string to_string(const static_rational<N>&)
 {
     return to_string(N);
 }
 
-// get string representation of @c static_rational
+/// get string representation of @c static_rational.
 template<integer_type N, integer_type D> std::string to_string(const static_rational<N,D>&)
 {
     return '(' + to_string(N) + '/' + to_string(D) + ')';
@@ -81,29 +85,41 @@
     return os;
 }
 
-/// traits template for unit names
+/// traits template for unit names.
 template<class BaseUnit>
 struct base_unit_info
 {
+ /// INTERNAL ONLY
+ typedef void base_unit_info_primary_template;
     /// The full name of the unit (returns BaseUnit::name() by default)
     static std::string name()
     {
         return(BaseUnit::name());
     }
-
     /// The symbol for the base unit (Returns BaseUnit::symbol() by default)
     static std::string symbol()
     {
- return(BaseUnit::symbol());
+ return(BaseUnit::symbol()); /// \returns BaseUnit::symbol(), for example "m"
     }
 };
 
-enum format_mode
+/// \enum format_mode format of output of units, for example "m" or "meter".
+enum format_mode
+{
+ symbol_fmt = 0, /// default - reduces unit names to known symbols for both base and derived units.
+ name_fmt = 1, /// output full unit names for base and derived units, for example "meter".
+ raw_fmt = 2, /// output only symbols for base units (but not derived units), for example "m".
+ typename_fmt = 3, /// output demangled typenames (useful only for diagnosis).
+ fmt_mask = 3 /// Bits used for format.
+};
+
+/// \enum autoprefix_mode automatic scaling and prefix (controlled by value of quantity) a, if any,
+enum autoprefix_mode
 {
- symbol_fmt = 0, // default - reduces unit names to known symbols for both base and derived units
- name_fmt, // output full unit names for base and derived units
- raw_fmt, // output only symbols for base units
- typename_fmt // output demangled typenames
+ autoprefix_none = 0, /// No automatic prefix.
+ autoprefix_engineering = 4, /// Scale and prefix with 10^3 multiples, 1234.5 m output as 1.2345 km.
+ autoprefix_binary = 8, /// Scale and prefix with 2^10 (1024) multiples, 1024 as 1 kb.
+ autoprefix_mask = 12 /// Bits used for autoprefix.
 };
 
 namespace detail {
@@ -141,48 +157,111 @@
 
 } // namespace detail
 
+/// \return flags controlling output.
+inline int get_flags(std::ios_base& ios, int mask)
+{
+ return(ios.iword(detail::xalloc_key_holder<true>::value) & mask);
+}
+
+/// Set new flags controlling output format.
+/// \return previous flags.
+inline void set_flags(std::ios_base& ios, int new_flags, int mask)
+{
+ assert((~mask & new_flags) == 0);
+ long& flags = ios.iword(detail::xalloc_key_holder<true>::value);
+ flags = (flags & ~mask) | static_cast<long>(new_flags);
+}
+
+/// \return flags controlling output format.
 inline format_mode get_format(std::ios_base& ios)
 {
- return(static_cast<format_mode>(ios.iword(detail::xalloc_key_holder<true>::value)));
+ return(static_cast<format_mode>((get_flags)(ios, fmt_mask)));
 }
 
+/// Set new flags controlling output format.
 inline void set_format(std::ios_base& ios, format_mode new_mode)
 {
- ios.iword(detail::xalloc_key_holder<true>::value) = static_cast<long>(new_mode);
+ (set_flags)(ios, new_mode, fmt_mask);
 }
 
+/// Set new flags for type_name output format.
+/// \return previous format flags.
 inline std::ios_base& typename_format(std::ios_base& ios)
 {
     (set_format)(ios, typename_fmt);
     return(ios);
 }
 
+/// set new flag for raw format output, for example "m".
+/// \return previous format flags.
 inline std::ios_base& raw_format(std::ios_base& ios)
 {
     (set_format)(ios, raw_fmt);
     return(ios);
 }
 
+// set new format flag for symbol output, for example "m".
+/// \return previous format flags.
 inline std::ios_base& symbol_format(std::ios_base& ios)
 {
     (set_format)(ios, symbol_fmt);
     return(ios);
 }
 
+/// set new format for name output, for example "meter".
+/// \return previous format flags.
 inline std::ios_base& name_format(std::ios_base& ios)
 {
     (set_format)(ios, name_fmt);
     return(ios);
 }
 
+/// get autoprefix flags for output.
+inline autoprefix_mode get_autoprefix(std::ios_base& ios)
+{
+ return static_cast<autoprefix_mode>((get_flags)(ios, autoprefix_mask));
+}
+
+/// Get format for output.
+inline void set_autoprefix(std::ios_base& ios, autoprefix_mode new_mode)
+{
+ (set_flags)(ios, new_mode, autoprefix_mask);
+}
+
+/// Clear autoprefix flags.
+/// \return previous prefix flags.
+inline std::ios_base& no_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_none);
+ return ios;
+}
+
+/// Set flag for engineering prefix, so 1234.5 m displays as "1.2345 km".
+/// \return previous prefix flags.
+inline std::ios_base& engineering_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_engineering);
+ return ios;
+}
+
+/// Set flag for binary prefix, so 1024 byte displays as "1 Kib".
+/// \return previous prefix flags.
+inline std::ios_base& binary_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_binary);
+ return ios;
+}
+
 namespace detail {
 
+/// \return exponent string like "^1/2".
 template<integer_type N, integer_type D>
 inline std::string exponent_string(const static_rational<N,D>& r)
 {
     return '^' + to_string(r);
 }
 
+/// \return empty exponent string for integer rational like 2.
 template<>
 inline std::string exponent_string(const static_rational<1>&)
 {
@@ -201,7 +280,7 @@
     return base_unit_info<typename T::tag_type>::name() + exponent_string(typename T::value_type());
 }
 
-// stringify with symbols
+// stringify with symbols.
 template<int N>
 struct symbol_string_impl
 {
@@ -268,7 +347,7 @@
     };
 };
 
-// stringify with names
+// stringify with names.
 template<int N>
 struct name_string_impl
 {
@@ -407,7 +486,7 @@
     return(str);
 }
 
-// this overload catches scaled units that have a single base unit
+// This overload catches scaled units that have a single base unit
 // raised to the first power. It causes si::nano * si::meters to not
 // put parentheses around the meters. i.e. nm rather than n(m)
 /// INTERNAL ONLY
@@ -423,7 +502,7 @@
     return(str);
 }
 
-// this overload is necessary to disambiguate.
+// This overload is necessary to disambiguate.
 // it catches units that are unscaled and have a single
 // base unit raised to the first power. It is treated the
 // same as any other unscaled unit.
@@ -437,16 +516,30 @@
     return(str);
 }
 
-
-// this overload catches scaled units that have a single scaled base unit
+// This overload catches scaled units that have a single scaled base unit
 // raised to the first power. It moves that scaling on the base unit
 // to the unit level scaling and recurses. By doing this we make sure that
-// si::milli * si::kilograms will print g rather than mkg
+// si::milli * si::kilograms will print g rather than mkg.
+//
+// This transformation will not be applied if base_unit_info is specialized
+// for the scaled base unit.
 //
 /// INTERNAL ONLY
 template<class Dimension,class Unit,class UnitScale, class Scale, class Subformatter>
 inline std::string
-to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>, Dimension, Scale> > >&, Subformatter f)
+to_string_impl(
+ const unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>,
+ Dimension,
+ Scale
+ >
+ >
+ >&,
+ Subformatter f,
+ typename base_unit_info<scaled_base_unit<Unit, UnitScale> >::base_unit_info_primary_template* = 0)
 {
     return(f(
         unit<
@@ -455,7 +548,7 @@
                 heterogeneous_system_impl<
                     list<heterogeneous_system_dim<Unit, static_rational<1> >, dimensionless_type>,
                     Dimension,
- typename mpl::times<Scale, list<UnitScale, dimensionless_type> >::type
+ typename mpl::times<Scale, list<scale_list_dim<UnitScale>, dimensionless_type> >::type
>
>
>()));
@@ -466,7 +559,19 @@
 /// INTERNAL ONLY
 template<class Dimension,class Unit,class UnitScale,class Subformatter>
 inline std::string
-to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>, Dimension, dimensionless_type> > >&, Subformatter f)
+to_string_impl(
+ const unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >&,
+ Subformatter f,
+ typename base_unit_info<scaled_base_unit<Unit, UnitScale> >::base_unit_info_primary_template* = 0)
 {
     std::string str;
     f.template append_units_to<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type> >(str);
@@ -483,8 +588,8 @@
         detail::scale_symbol_string_impl<Scale::size::value>::template apply<Scale>::value(str);
     }
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(to_string_impl(unit, *this));
+ std::string operator()(const Unit& u) {
+ return(to_string_impl(u, *this));
     }
     template<class Unit>
     bool is_default_string(const std::string&, const Unit&) {
@@ -494,12 +599,12 @@
 
 struct format_symbol_impl : format_raw_symbol_impl {
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(symbol_string(unit));
+ std::string operator()(const Unit& u) {
+ return(symbol_string(u));
     }
     template<class Unit>
- bool is_default_string(const std::string& str, const Unit& unit) {
- return(str == to_string_impl(unit, format_raw_symbol_impl()));
+ bool is_default_string(const std::string& str, const Unit& u) {
+ return(str == to_string_impl(u, format_raw_symbol_impl()));
     }
 };
 
@@ -513,8 +618,8 @@
         detail::scale_name_string_impl<Scale::size::value>::template apply<Scale>::value(str);
     }
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(to_string_impl(unit, *this));
+ std::string operator()(const Unit& u) {
+ return(to_string_impl(u, *this));
     }
     template<class Unit>
     bool is_default_string(const std::string&, const Unit&) {
@@ -524,29 +629,308 @@
 
 struct format_name_impl : format_raw_name_impl {
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(name_string(unit));
+ std::string operator()(const Unit& u) {
+ return(name_string(u));
     }
     template<class Unit>
- bool is_default_string(const std::string& str, const Unit& unit) {
- return(str == to_string_impl(unit, format_raw_name_impl()));
+ bool is_default_string(const std::string& str, const Unit& u) {
+ return(str == to_string_impl(u, format_raw_name_impl()));
     }
 };
 
 template<class Char, class Traits>
-inline void do_print(std::basic_ostream<Char, Traits>& os, const std::string& s) {
+inline void do_print(std::basic_ostream<Char, Traits>& os, const std::string& s)
+{
     os << s.c_str();
 }
 
-inline void do_print(std::ostream& os, const std::string& s) {
+inline void do_print(std::ostream& os, const std::string& s)
+{
     os << s;
 }
 
 template<class Char, class Traits>
-inline void do_print(std::basic_ostream<Char, Traits>& os, const char* s) {
+inline void do_print(std::basic_ostream<Char, Traits>& os, const char* s)
+{
     os << s;
 }
 
+// For automatically applying the appropriate prefixes.
+
+template<class End, class Prev, class T, class F>
+bool find_matching_scale_impl(End, End, Prev, T, F)
+{
+ return false;
+}
+
+template<class Begin, class End, class Prev, class T, class F>
+bool find_matching_scale_impl(Begin, End end, Prev prev, T t, F f)
+{
+ using std::abs;
+ if(Begin::item::value() > abs(t)) {
+ f(prev, t);
+ return true;
+ } else {
+ return detail::find_matching_scale_impl(
+ typename Begin::next(),
+ end,
+ typename Begin::item(),
+ t,
+ f
+ );
+ }
+}
+
+template<class End, class T, class F>
+bool find_matching_scale_i(End, End, T, F)
+{
+ return false;
+}
+
+template<class Begin, class End, class T, class F>
+bool find_matching_scale_i(Begin, End end, T t, F f)
+{
+ using std::abs;
+ if(Begin::item::value() > abs(t)) {
+ return false;
+ } else {
+ return detail::find_matching_scale_impl(typename Begin::next(), end, typename Begin::item(), t, f);
+ }
+}
+
+template<class Scales, class T, class F>
+bool find_matching_scale(T t, F f)
+{
+ return detail::find_matching_scale_i(Scales(), dimensionless_type(), t, f);
+}
+
+typedef list<scale<10, static_rational<-24> >,
+ list<scale<10, static_rational<-21> >,
+ list<scale<10, static_rational<-18> >,
+ list<scale<10, static_rational<-15> >,
+ list<scale<10, static_rational<-12> >,
+ list<scale<10, static_rational<-9> >,
+ list<scale<10, static_rational<-6> >,
+ list<scale<10, static_rational<-3> >,
+ list<scale<10, static_rational<0> >,
+ list<scale<10, static_rational<3> >,
+ list<scale<10, static_rational<6> >,
+ list<scale<10, static_rational<9> >,
+ list<scale<10, static_rational<12> >,
+ list<scale<10, static_rational<15> >,
+ list<scale<10, static_rational<18> >,
+ list<scale<10, static_rational<21> >,
+ list<scale<10, static_rational<24> >,
+ list<scale<10, static_rational<27> >,
+ dimensionless_type> > > > > > > > > > > > > > > > > > engineering_prefixes;
+
+typedef list<scale<2, static_rational<10> >,
+ list<scale<2, static_rational<20> >,
+ list<scale<2, static_rational<30> >,
+ list<scale<2, static_rational<40> >,
+ list<scale<2, static_rational<50> >,
+ list<scale<2, static_rational<60> >,
+ list<scale<2, static_rational<70> >,
+ dimensionless_type> > > > > > > binary_prefixes;
+
+template<class Os, class Quantity>
+struct print_default_t {
+ typedef void result_type;
+ void operator()() const
+ {
+ *os << q->value() << ' ' << typename Quantity::unit_type();
+ }
+ Os* os;
+ const Quantity* q;
+};
+
+template<class Os, class Quantity>
+print_default_t<Os, Quantity> print_default(Os& os, const Quantity& q)
+{
+ print_default_t<Os, Quantity> result = { &os, &q };
+ return result;
+}
+
+template<class Os>
+struct print_scale_t {
+ typedef void result_type;
+ template<class Prefix, class T>
+ void operator()(Prefix, const T& t) const
+ {
+ *prefixed = true;
+ *os << t / Prefix::value() << ' ';
+ switch(units::get_format(*os)) {
+ case name_fmt: do_print(*os, Prefix::name()); break;
+ case raw_fmt:
+ case symbol_fmt: do_print(*os, Prefix::symbol()); break;
+ case typename_fmt: do_print(*os, units::simplify_typename(Prefix())); *os << ' '; break;
+ }
+ }
+ template<long N, class T>
+ void operator()(scale<N, static_rational<0> >, const T& t) const
+ {
+ *prefixed = false;
+ *os << t << ' ';
+ }
+ Os* os;
+ bool* prefixed;
+};
+
+template<class Os>
+print_scale_t<Os> print_scale(Os& os, bool& prefixed)
+{
+ print_scale_t<Os> result = { &os, &prefixed };
+ return result;
+}
+
+// puts parentheses around a unit
+/// INTERNAL ONLY
+template<class Dimension,class Units,class Scale, class Subformatter>
+inline std::string
+maybe_parenthesize(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, Scale> > >&, Subformatter f)
+{
+ std::string str;
+
+ std::string without_scale = f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >());
+
+ if (f.is_default_string(without_scale, unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >()))
+ {
+ str += "(";
+ str += without_scale;
+ str += ")";
+ }
+ else
+ {
+ str += without_scale;
+ }
+
+ return(str);
+}
+
+// This overload catches scaled units that have a single base unit
+// raised to the first power. It causes si::nano * si::meters to not
+// put parentheses around the meters. i.e. nm rather than n(m)
+/// INTERNAL ONLY
+template<class Dimension,class Unit,class Scale, class Subformatter>
+inline std::string
+maybe_parenthesize(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<Unit, static_rational<1> >,dimensionless_type>, Dimension, Scale> > >&, Subformatter f)
+{
+ return f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<Unit, static_rational<1> >, dimensionless_type>, Dimension, dimensionless_type> > >());
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T, class F>
+void do_print_prefixed_impl(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q, F default_)
+{
+ bool prefixed;
+ if(detail::find_matching_scale<Prefixes>(q.value(), detail::print_scale(os, prefixed))) {
+ if(prefixed) {
+ switch(units::get_format(os)) {
+ case symbol_fmt: do_print(os, maybe_parenthesize(Unit(), format_symbol_impl())); break;
+ case raw_fmt: do_print(os, maybe_parenthesize(Unit(), format_raw_symbol_impl())); break;
+ case name_fmt: do_print(os, maybe_parenthesize(Unit(), format_name_impl())); break;
+ case typename_fmt: do_print(os, simplify_typename(Unit())); break;
+ }
+ } else {
+ os << Unit();
+ }
+ } else {
+ default_();
+ }
+}
+
+// Handle units like si::kilograms that have a scale embedded in the
+// base unit. This overload is disabled if the scaled base unit has
+// a user-defined string representation.
+template<class Prefixes, class CharT, class Traits, class Dimension, class BaseUnit, class BaseScale, class Scale, class T>
+typename base_unit_info<
+ scaled_base_unit<BaseUnit, Scale>
+>::base_unit_info_primary_template
+do_print_prefixed(
+ std::basic_ostream<CharT, Traits>& os,
+ const quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<
+ heterogeneous_system_dim<
+ scaled_base_unit<BaseUnit, BaseScale>,
+ static_rational<1>
+ >,
+ dimensionless_type
+ >,
+ Dimension,
+ Scale
+ >
+ >
+ >,
+ T
+ >& q)
+{
+ quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<
+ heterogeneous_system_dim<BaseUnit, static_rational<1> >,
+ dimensionless_type
+ >,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >,
+ T
+ > unscaled(q);
+ detail::do_print_prefixed_impl<Prefixes>(os, unscaled, detail::print_default(os, q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Dimension, class L, class Scale, class T>
+void do_print_prefixed(
+ std::basic_ostream<CharT, Traits>& os,
+ const quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ L,
+ Dimension,
+ Scale
+ >
+ >
+ >,
+ T
+ >& q)
+{
+ quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ L,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >,
+ T
+ > unscaled(q);
+ detail::do_print_prefixed_impl<Prefixes>(os, unscaled, detail::print_default(os, q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Dimension, class System, class T>
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<unit<Dimension, System>, T>& q)
+{
+ detail::do_print_prefixed<Prefixes>(os, quantity<unit<Dimension, typename make_heterogeneous_system<Dimension, System>::type>, T>(q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T>
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q)
+{
+ detail::print_default(os, q)();
+}
+
 } // namespace detail
 
 template<class Dimension,class System>
@@ -570,18 +954,18 @@
     return detail::to_string_impl(unit<Dimension,System>(), detail::format_name_impl());
 }
 
-/// Print an @c unit as a list of base units and exponents
+/// Print a @c unit as a list of base units and their exponents.
 ///
-/// for @c symbol_format this gives e.g. "m s^-1" or "J"
-/// for @c name_format this gives e.g. "meter second^-1" or "joule"
-/// for @c raw_format this gives e.g. "m s^-1" or "meter kilogram^2 second^-2"
-/// for @c typename_format this gives the typename itself (currently demangled only on GCC)
+/// for @c symbol_format outputs e.g. "m s^-1" or "J".
+/// for @c name_format outputs e.g. "meter second^-1" or "joule".
+/// for @c raw_format outputs e.g. "m s^-1" or "meter kilogram^2 second^-2".
+/// for @c typename_format outputs the typename itself (currently demangled only on GCC).
 template<class Char, class Traits, class Dimension, class System>
 inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>& u)
 {
     if (units::get_format(os) == typename_fmt)
     {
- detail::do_print(os , typename_string(u));
+ detail::do_print(os, typename_string(u));
     }
     else if (units::get_format(os) == raw_fmt)
     {
@@ -603,12 +987,31 @@
     return(os);
 }
 
-/// INTERNAL ONLY
-/// Print a @c quantity. Prints the value followed by the unit
+/// \brief Print a @c quantity.
+/// \details Prints the value followed by the unit.
+/// If the engineering_prefix, or binary_prefix is set,
+/// tries to scale the value appropriately.
+/// For example, it might print 12.345 km instead of 12345 m.
+/// (Note does @b not attempt to automatically scale scalars like double, float...)
 template<class Char, class Traits, class Unit, class T>
 inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q)
 {
- os << q.value() << ' ' << Unit();
+ if (units::get_autoprefix(os) == autoprefix_none)
+ {
+ os << q.value() << ' ' << Unit();
+ }
+ else if (units::get_autoprefix(os) == autoprefix_engineering)
+ {
+ detail::do_print_prefixed<detail::engineering_prefixes>(os, q);
+ }
+ else if (units::get_autoprefix(os) == autoprefix_binary)
+ {
+ detail::do_print_prefixed<detail::binary_prefixes>(os, q);
+ }
+ else
+ {
+ assert(!"Autoprefixing must be one of: no_prefix, engineering_prefix, binary_prefix");
+ }
     return(os);
 }
 

Modified: trunk/boost/units/is_dim.hpp
==============================================================================
--- trunk/boost/units/is_dim.hpp (original)
+++ trunk/boost/units/is_dim.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIM_HPP
 #define BOOST_UNITS_IS_DIM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a valid @c dim.
+///
+
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/units_fwd.hpp>

Modified: trunk/boost/units/is_dimension_list.hpp
==============================================================================
--- trunk/boost/units/is_dimension_list.hpp (original)
+++ trunk/boost/units/is_dimension_list.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIMENSION_LIST_HPP
 #define BOOST_UNITS_IS_DIMENSION_LIST_HPP
 
+///
+/// \file
+/// \brief Check that a type is a valid dimension list.
+///
+
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/units_fwd.hpp>

Modified: trunk/boost/units/is_dimensionless.hpp
==============================================================================
--- trunk/boost/units/is_dimensionless.hpp (original)
+++ trunk/boost/units/is_dimensionless.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_HPP
 
+///
+/// \file
+/// \brief Check if a unit or quantity is dimensionless.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -23,13 +28,13 @@
     public mpl::false_
 { };
 
-/// check if a unit is dimensionless
+/// Check if a unit is dimensionless.
 template<class System>
 struct is_dimensionless< unit<dimensionless_type,System> > :
     public mpl::true_
 { };
 
-/// check if a quantity is dimensionless
+/// Check if a quantity is dimensionless.
 template<class Unit,class Y>
 struct is_dimensionless< quantity<Unit,Y> > :
     public is_dimensionless<Unit>

Modified: trunk/boost/units/is_dimensionless_quantity.hpp
==============================================================================
--- trunk/boost/units/is_dimensionless_quantity.hpp (original)
+++ trunk/boost/units/is_dimensionless_quantity.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_QUANTITY_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_QUANTITY_HPP
 
+/// \file
+/// \brief check that a type is a dimensionless quantity
+
 #include <boost/units/is_quantity_of_dimension.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +21,7 @@
 
 namespace units {
 
-/// check that a type is a dimensionless quantity
+/// Check that a type is a dimensionless quantity.
 template<class T>
 struct is_dimensionless_quantity :
     public is_quantity_of_dimension<T,dimensionless_type>

Modified: trunk/boost/units/is_dimensionless_unit.hpp
==============================================================================
--- trunk/boost/units/is_dimensionless_unit.hpp (original)
+++ trunk/boost/units/is_dimensionless_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_UNIT_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_UNIT_HPP
 
+/// \file
+/// \brief Check that a type is a dimensionless unit.
+
 #include <boost/units/is_unit_of_dimension.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +21,7 @@
 
 namespace units {
 
-/// check that a type is a dimensionless unit
+/// Check that a type is a dimensionless unit.
 template<class T>
 struct is_dimensionless_unit :
     public is_unit_of_dimension<T,dimensionless_type>

Modified: trunk/boost/units/is_quantity.hpp
==============================================================================
--- trunk/boost/units/is_quantity.hpp (original)
+++ trunk/boost/units/is_quantity.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_HPP
 #define BOOST_UNITS_IS_QUANTITY_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a quantity
+/// Check that a type is a quantity.
 template<typename T>
 struct is_quantity :
     public mpl::false_

Modified: trunk/boost/units/is_quantity_of_dimension.hpp
==============================================================================
--- trunk/boost/units/is_quantity_of_dimension.hpp (original)
+++ trunk/boost/units/is_quantity_of_dimension.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_OF_DIMENSION_HPP
 #define BOOST_UNITS_IS_QUANTITY_OF_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity of the specified dimension.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/is_unit_of_dimension.hpp>
@@ -19,7 +24,7 @@
 
 namespace units {
 
-/// check that a type is a quantity of the specified dimension
+/// Check that a type is a quantity of the specified dimension.
 template<class T,class Dim>
 struct is_quantity_of_dimension :
     public mpl::false_

Modified: trunk/boost/units/is_quantity_of_system.hpp
==============================================================================
--- trunk/boost/units/is_quantity_of_system.hpp (original)
+++ trunk/boost/units/is_quantity_of_system.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_OF_SYSTEM_HPP
 #define BOOST_UNITS_IS_QUANTITY_OF_SYSTEM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity in a specified system.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/is_unit_of_system.hpp>
@@ -19,7 +24,7 @@
 
 namespace units {
 
-/// check that a type is a quantity in a specified system
+/// Check that a type is a quantity in a specified system.
 template<class T,class System>
 struct is_quantity_of_system :
     public mpl::false_

Modified: trunk/boost/units/is_unit.hpp
==============================================================================
--- trunk/boost/units/is_unit.hpp (original)
+++ trunk/boost/units/is_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_HPP
 #define BOOST_UNITS_IS_UNIT_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit
+/// Check that a type is a unit.
 template<class T>
 struct is_unit :
     public mpl::false_

Modified: trunk/boost/units/is_unit_of_dimension.hpp
==============================================================================
--- trunk/boost/units/is_unit_of_dimension.hpp (original)
+++ trunk/boost/units/is_unit_of_dimension.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_OF_DIMENSION_HPP
 #define BOOST_UNITS_IS_UNIT_OF_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit of the specified dimension.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit of the specified dimension
+/// Check that a type is a unit of the specified dimension.
 template<class T,class Dim>
 struct is_unit_of_dimension :
     public mpl::false_

Modified: trunk/boost/units/is_unit_of_system.hpp
==============================================================================
--- trunk/boost/units/is_unit_of_system.hpp (original)
+++ trunk/boost/units/is_unit_of_system.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_OF_SYSTEM_HPP
 #define BOOST_UNITS_IS_UNIT_OF_SYSTEM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit in a specified system.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit in a specified system
+/// Check that a type is a unit in a specified system.
 template<class T,class System>
 struct is_unit_of_system :
     public mpl::false_

Modified: trunk/boost/units/limits.hpp
==============================================================================
--- trunk/boost/units/limits.hpp (original)
+++ trunk/boost/units/limits.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -7,9 +7,15 @@
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
+
 #ifndef BOOST_UNITS_LIMITS_HPP
 #define BOOST_UNITS_LIMITS_HPP
 
+///
+/// \file
+/// \brief specialize std::numeric_limits for units.
+///
+
 #include <limits>
 
 #include <boost/units/units_fwd.hpp>

Modified: trunk/boost/units/make_scaled_unit.hpp
==============================================================================
--- trunk/boost/units/make_scaled_unit.hpp (original)
+++ trunk/boost/units/make_scaled_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,7 @@
 #ifndef BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 #define BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 
+#include <boost/units/units_fwd.hpp>
 #include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/unit.hpp>
 
@@ -39,6 +40,20 @@
> type;
 };
 
+template<class Dimension, class UnitList, class OldScale, long Base>
+struct make_scaled_unit<unit<Dimension, heterogeneous_system<heterogeneous_system_impl<UnitList, Dimension, OldScale> > >, scale<Base, static_rational<0> > > {
+ typedef unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ UnitList,
+ Dimension,
+ OldScale
+ >
+ >
+ > type;
+};
+
 }
 }
 

Modified: trunk/boost/units/make_system.hpp
==============================================================================
--- trunk/boost/units/make_system.hpp (original)
+++ trunk/boost/units/make_system.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,16 @@
 #ifndef BOOST_UNITS_MAKE_SYSTEM_HPP
 #define BOOST_UNITS_MAKE_SYSTEM_HPP
 
+/// \file
+/// \brief Metafunction returning a homogeneous system that can
+/// represent any combination of the base units.
+/// \details
+/// Metafunction make_system returning a homogeneous system that can
+/// represent any combination of the base units. There must
+/// be no way to represent any of the base units in terms
+/// of the others. make_system<foot_base_unit, meter_base_unit>::type
+/// is not allowed, for example.
+
 #include <boost/units/config.hpp>
 #include <boost/units/dimensionless_type.hpp>
 #include <boost/units/homogeneous_system.hpp>

Modified: trunk/boost/units/operators.hpp
==============================================================================
--- trunk/boost/units/operators.hpp (original)
+++ trunk/boost/units/operators.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,29 +11,30 @@
 #ifndef BOOST_UNITS_OPERATORS_HPP
 #define BOOST_UNITS_OPERATORS_HPP
 
+
+///
+/// \file
+/// \brief Compile time operators and typeof helper classes.
+/// \details
+/// These operators declare the compile-time operators needed to support dimensional
+/// analysis algebra. They require the use of Boost.Typeof, emulation or native.
+/// Typeof helper classes define result type for heterogeneous operators on value types.
+/// These must be defined through specialization for powers and roots.
+///
+
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_same.hpp>
 
 #include <boost/units/config.hpp>
 
-/// \file
-/// \brief Compile time operators and typeof helper classes.
-///
-/// \detailed
-/// These operators declare the compile-time operators needed to support dimensional
-/// analysis algebra. They require the use of Boost.Typeof.
-/// Typeof helper classes define result type for heterogeneous operators on value types.
-/// These must be defined through specialization for powers and roots.
-
 namespace boost {
-
 namespace units {
 
 #if BOOST_UNITS_HAS_TYPEOF
 
 #ifndef BOOST_UNITS_DOXYGEN
 
-// to avoid need for default constructor and eliminate divide by zero errors
+// to avoid need for default constructor and eliminate divide by zero errors.
 namespace typeof_ {
 
 /// INTERNAL ONLY

Modified: trunk/boost/units/physical_dimensions.hpp
==============================================================================
--- trunk/boost/units/physical_dimensions.hpp (original)
+++ trunk/boost/units/physical_dimensions.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2007-2008 Steven Watanabe
+// Copyright (C) 2007-2010 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -11,25 +11,29 @@
 #ifndef BOOST_UNITS_PHYSICAL_UNITS_HPP
 #define BOOST_UNITS_PHYSICAL_UNITS_HPP
 
-/// \file Includes all of the physical_dimension headers.
 ///
-/// \brief Physical dimensions according to the SI system
-///
-/// \detail This header includes all physical dimension headers for both base
-/// derived dimensions. Base dimensions are extended to include plane and
-/// solid angle for convenience.
+/// \file
+/// \brief Physical dimensions according to the SI system.
+/// \details This header includes all physical dimension headers for both base
+/// and derived dimensions.
 ///
 
+// Include all of the physical_dimension headers.
+
+// SI seven fundamental dimensions.
 #include <boost/units/physical_dimensions/amount.hpp>
 #include <boost/units/physical_dimensions/current.hpp>
 #include <boost/units/physical_dimensions/length.hpp>
 #include <boost/units/physical_dimensions/luminous_intensity.hpp>
 #include <boost/units/physical_dimensions/mass.hpp>
-#include <boost/units/physical_dimensions/plane_angle.hpp>
-#include <boost/units/physical_dimensions/solid_angle.hpp>
 #include <boost/units/physical_dimensions/temperature.hpp>
 #include <boost/units/physical_dimensions/time.hpp>
 
+// Base dimensions are extended to include plane and solid angle for convenience.
+#include <boost/units/physical_dimensions/plane_angle.hpp>
+#include <boost/units/physical_dimensions/solid_angle.hpp>
+
+// Derived dimensions.
 #include <boost/units/physical_dimensions/absorbed_dose.hpp>
 #include <boost/units/physical_dimensions/acceleration.hpp>
 #include <boost/units/physical_dimensions/action.hpp>

Modified: trunk/boost/units/pow.hpp
==============================================================================
--- trunk/boost/units/pow.hpp (original)
+++ trunk/boost/units/pow.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -19,13 +19,13 @@
 #include <boost/units/detail/static_rational_power.hpp>
 
 /// \file
-/// \brief Raise values to exponents known at compile-time
+/// \brief Raise values to exponents known at compile-time.
 
 namespace boost {
 
 namespace units {
 
-/// raise a value to a @c static_rational power
+/// raise a value to a @c static_rational power.
 template<class Rat,class Y>
 inline typename power_typeof_helper<Y,Rat>::type
 pow(const Y& x)
@@ -33,7 +33,7 @@
     return power_typeof_helper<Y,Rat>::value(x);
 }
 
-/// raise a value to an integer power
+/// raise a value to an integer power.
 template<long N,class Y>
 inline typename power_typeof_helper<Y,static_rational<N> >::type
 pow(const Y& x)
@@ -43,7 +43,7 @@
 
 #ifndef BOOST_UNITS_DOXYGEN
 
-/// raise @c T to a @c static_rational power
+/// raise @c T to a @c static_rational power.
 template<class T, long N,long D>
 struct power_typeof_helper<T, static_rational<N,D> >
 {
@@ -57,11 +57,11 @@
     }
 };
 
-/// raise @c float to a @c static_rational power
+/// raise @c float to a @c static_rational power.
 template<long N,long D>
 struct power_typeof_helper<float, static_rational<N,D> >
 {
- // N.B. pathscale doesn't accept inheritence for some reason.
+ // N.B. pathscale doesn't accept inheritance for some reason.
     typedef power_typeof_helper<double, static_rational<N,D> > base;
     typedef typename base::type type;
     static type value(const double& x)
@@ -72,7 +72,7 @@
 
 #endif
 
-/// take the @c static_rational root of a value
+/// take the @c static_rational root of a value.
 template<class Rat,class Y>
 typename root_typeof_helper<Y,Rat>::type
 root(const Y& x)
@@ -80,7 +80,7 @@
     return root_typeof_helper<Y,Rat>::value(x);
 }
 
-/// take the integer root of a value
+/// take the integer root of a value.
 template<long N,class Y>
 typename root_typeof_helper<Y,static_rational<N> >::type
 root(const Y& x)
@@ -94,7 +94,7 @@
 template<class T, long N,long D>
 struct root_typeof_helper<T,static_rational<N,D> >
 {
- // N.B. pathscale doesn't accept inheritence for some reason.
+ // N.B. pathscale doesn't accept inheritance for some reason.
     typedef power_typeof_helper<T, static_rational<D,N> > base;
     typedef typename base::type type;
     static type value(const T& x)

Modified: trunk/boost/units/reduce_unit.hpp
==============================================================================
--- trunk/boost/units/reduce_unit.hpp (original)
+++ trunk/boost/units/reduce_unit.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
 #define BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
 
+/// \file
+/// \brief Returns a unique type for every unit.
+
 namespace boost {
 namespace units {
 

Modified: trunk/boost/units/scale.hpp
==============================================================================
--- trunk/boost/units/scale.hpp (original)
+++ trunk/boost/units/scale.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,12 @@
 #ifndef BOOST_UNITS_SCALE_HPP_INCLUDED
 #define BOOST_UNITS_SCALE_HPP_INCLUDED
 
+///
+/// \file
+/// \brief 10^3 Engineering & 2^10 binary scaling factors for autoprefixing.
+/// \details
+///
+
 #include <string>
 
 #include <boost/units/config.hpp>
@@ -27,7 +33,7 @@
 struct scaled_base_unit;
 
 /// class representing a scaling factor such as 10^3
-/// The exponent should be a static rational.
+/// The exponent must be a static rational.
 template<long Base, class Exponent>
 struct scale
 {

Modified: trunk/boost/units/static_rational.hpp
==============================================================================
--- trunk/boost/units/static_rational.hpp (original)
+++ trunk/boost/units/static_rational.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -46,7 +46,7 @@
     BOOST_STATIC_CONSTANT(integer_type,value = Value < 0 ? -Value : Value);
 };
 
-/// Compile time rational number.
+// Compile time rational number.
 /**
 This is an implementation of a compile time rational number, where @c static_rational<N,D> represents
 a rational number with numerator @c N and denominator @c D. Because of the potential for ambiguity arising

Modified: trunk/boost/units/systems/si/codata/electromagnetic_constants.hpp
==============================================================================
--- trunk/boost/units/systems/si/codata/electromagnetic_constants.hpp (original)
+++ trunk/boost/units/systems/si/codata/electromagnetic_constants.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,6 +11,13 @@
 #ifndef BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP
 #define BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP
 
+///
+/// \file
+/// \brief CODATA recommended values of fundamental electromagnetic constants.
+/// \details CODATA recommended values of the fundamental physical constants: NIST SP 961
+/// CODATA 2006 values as of 2007/03/30
+///
+
 #include <boost/units/static_constant.hpp>
 
 #include <boost/units/systems/detail/constants.hpp>
@@ -26,10 +33,6 @@
 
 #include <boost/units/systems/si/codata/typedefs.hpp>
 
-/// \file
-/// CODATA recommended values of fundamental electromagnetic constants
-/// CODATA 2006 values as of 2007/03/30
-
 namespace boost {
 
 namespace units {
@@ -40,8 +43,6 @@
 
 namespace codata {
 
-/// CODATA recommended values of the fundamental physical constants: NIST SP 961
-
 // ELECTROMAGNETIC
 /// elementary charge
 BOOST_UNITS_PHYSICAL_CONSTANT(e,quantity<electric_charge>,1.602176487e-19*coulombs,4.0e-27*coulombs);

Modified: trunk/boost/units/units_fwd.hpp
==============================================================================
--- trunk/boost/units/units_fwd.hpp (original)
+++ trunk/boost/units/units_fwd.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -11,8 +11,11 @@
 #ifndef BOOST_UNITS_UNITS_FWD_HPP
 #define BOOST_UNITS_UNITS_FWD_HPP
 
+///
 /// \file
-/// Forward declarations of library components.
+/// \brief Forward declarations of library components.
+/// \details Forward declarations of units library - dimensions, systems, quantity and string components.
+///
 
 #ifndef BOOST_UNITS_DOXYGEN
 
@@ -38,6 +41,8 @@
 
 template<class Dim,class System, class Enable=void> class unit;
 
+template<long Base, class Exponent> struct scale;
+
 template<class BaseUnitTag> struct base_unit_info;
 template<class System> struct dimensionless_unit;
 template<class T> struct is_unit;

Modified: trunk/libs/units/doc/Jamfile.v2
==============================================================================
--- trunk/libs/units/doc/Jamfile.v2 (original)
+++ trunk/libs/units/doc/Jamfile.v2 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -55,7 +55,8 @@
 
 run_doxygen units_reference
   :
- [ glob $(here)/../../../boost/units/*.hpp ]
+ [ glob $(here)/../../../boost/units/*.hpp :
+ $(here)/../../../boost/units/physical_dimensions.hpp ]
   :
     "Units Reference"
   ;

Modified: trunk/libs/units/doc/units.qbk
==============================================================================
--- trunk/libs/units/doc/units.qbk (original)
+++ trunk/libs/units/doc/units.qbk 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -1,9 +1,9 @@
 [library Boost.Units
- [quickbook 1.3]
- [version 1.0.0]
+ [quickbook 1.5]
+ [version 1.1.0]
   [authors [Schabel, Matthias C.]]
   [authors [Watanabe, Steven]]
- [copyright 2003-2008 Matthias Christian Schabel, 2007-2008 Steven Watanabe]
+ [copyright 2003-2008 Matthias Christian Schabel, 2007-2010 Steven Watanabe]
   [license
       Distributed under the Boost Software License, Version 1.0.
       (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,10 +12,15 @@
   [purpose zero-overhead compile-time dimensional analysis and unit computations]
 ]
 
+[/ Some links to external sources.]
+[def __boost [@http://www.boost.org/ Boost]]
+[def __boostroot [@boost: Boost root]]
+[def __boostlicense [@http://www.boost.org/LICENSE_1_0.txt Boost License]]
 [def __boost_mpl [@http://www.boost.org/libs/mpl/doc/index.html Boost Metaprogramming Library]]
 
 [def __mpl_forward_sequence [@http://www.boost.org/libs/mpl/doc/refmanual/forward-sequence.html MPL Forward Sequence]]
 
+[/Links within this document.]
 [def __ordinal [classref boost::units::ordinal ordinal]]
 [def __dim [classref boost::units::dim dim]]
 [def __static_rational [classref boost::units::static_rational static_rational]]
@@ -61,7 +66,6 @@
 [def __unscale [classref boost::units::unscale unscale]]
 
 [def __BOOST_UNITS_STATIC_CONSTANT [macroref BOOST_UNITS_STATIC_CONSTANT]]
-
 [def __BOOST_UNITS_DEFINE_CONVERSION_FACTOR [macroref BOOST_UNITS_DEFINE_CONVERSION_FACTOR]]
 [def __BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE [macroref BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE]]
 [def __BOOST_UNITS_DEFAULT_CONVERSION [macroref BOOST_UNITS_DEFAULT_CONVERSION]]
@@ -113,13 +117,14 @@
    no specific restriction on what base dimensions can be used. Base dimensions are essentially a tag type and
    provide no dimensional analysis functionality themselves.
 * *Dimension* : A collection of zero or more base dimensions, each
- potentially raised to a different rational power. For example, area = \[L\]^2, velocity = \[L\]^1/\[T\]^1, and
+ potentially raised to a different rational power.
+ For example, length = \[L\]^1, area = \[L\]^2, velocity = \[L\]^1/\[T\]^1, and
    energy = \[M\]^1 \[L\]^2/\[T\]^2 are all dimensions.
 * *Base unit* : A base unit represents a specific measure of a dimension. For example, while length is an abstract measure of
    distance, the meter is a concrete base unit of distance. Conversions are defined using base units.
    Much like base dimensions, base units are a tag type used solely to define units and do not support dimensional
    analysis algebra.
-* *Unit* : A set of base units raised to rational exponents, e.g. kg^1 m^1/s^2.
+* *Unit* : A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2.
 * *System* : A unit system is a collection of base units representing all the measurable entities of interest for a
    specific problem. For example, the SI unit system defines seven base units : length (\[L\]) in meters,
    mass (\[M\]) in kilograms, time (\[T\]) in seconds, current (\[I\]) in amperes, temperature (\[theta\]) in kelvin,
@@ -150,8 +155,8 @@
 While this library attempts to make simple dimensional computations easy to code, it is in no way
 tied to any particular unit system (SI or otherwise). Instead, it provides a highly flexible compile-time
 system for dimensional analysis, supporting arbitrary collections of base dimensions, rational
-powers of units, and explicit quantity conversions. It accomplishes all of this via template metaprogramming techniques. With
-modern optimizing compilers, this results in zero runtime overhead for quantity computations relative to the
+powers of units, and explicit quantity conversions. It accomplishes all of this via template metaprogramming techniques.
+With modern optimizing compilers, this results in zero runtime overhead for quantity computations relative to the
 same code without unit checking.
 
 [endsect]
@@ -319,7 +324,7 @@
 we have the rudimentary beginnings of our unit system, which can be used to determine reduced dimensions for arbitrary
 unit calculations.
 
-[endsect]
+[endsect] [/section Base Units]
 
 [section Scaled Base Units]
 
@@ -340,7 +345,7 @@
 * Similarly, if the symbol for grams is defined as "g", then the symbol for kilograms
   will be "kg" without any extra effort.
 
-[endsect]
+[endsect] [/section Scaled Base Units]
 
 [section Scaled Units]
 
@@ -353,15 +358,14 @@
 
     typedef make_scaled_unit<si::time, scale<10, static_rational<-9> > >::type nanosecond;
 
-nanosecond is a specialization of [___unit], and can be
-used in a quantity normally.
+nanosecond is a specialization of [___unit], and can be used in a quantity normally.
 
     quantity<nanosecond> t(1.0 * si::seconds);
     std::cout << t << std::endl; // prints 1e9 ns
 
-[endsect]
+[endsect] [/section Scaled Units]
 
-[endsect]
+[endsect] [/section:Units Units]
 
 [section:Quantities Quantities]
 
@@ -507,7 +511,8 @@
 
 [dimension_snippet_1]
 
-outputting (with symbol demangling, implemented in [headerref boost/units/detail/utility.hpp])
+outputting (with symbol demangling, implemented in
+[@boost:/boost/units/detail/utility.hpp utility.hpp])
 
 [dimension_output]
 
@@ -518,7 +523,7 @@
 ([@../../libs/units/example/unit.cpp unit.cpp])
 
 This example demonstrates the use of the simple but functional unit system implemented in
-[headerref libs/units/example/test_system.hpp] :
+[@boost:/libs/units/example/test_system.hpp test_system.hpp]
 
 [import ../example/unit.cpp]
 
@@ -557,7 +562,7 @@
 
 [endsect]
 
-[section:KitchenSinkExample Kitchen Sink Example]
+[section:KitchenSinkExample Kitchen Sink Example using SI units]
 
 ([@../../libs/units/example/kitchen_sink.cpp kitchen_sink.cpp])
 
@@ -958,6 +963,60 @@
 
 [endsect]
 
+[section:autoscale Automatically Scaled Units]
+
+It is often desirable to scale a [___unit] automatically, depending on its value,
+to keep the integral part in a limited range, usually between 1 and 999.
+
+For example, using [@http://en.wikipedia.org/wiki/Engineering_notation engineering notation prefixes],
+
+ "1234.5 m" is more helpfully displayed as "1.234 km"
+ "0.000000001234 m" is more clearly displayed as "1.2345 nanometer".
+
+The iostream manipulators `engineering_prefixes` or `binary_prefixes` make this easy.
+
+[import ../example/autoprefixes.cpp]
+
+[autoprefixes_snippet_1]
+
+(The complete set of [@http://physics.nist.gov/cuu/Units/prefixes.html engineering and scientific multiples]
+is not used (not centi or deci for example), but only powers of ten that are multiples of three, 10^3).
+
+Similarly, the equivalent [@http://en.wikipedia.org/wiki/Binary_prefixes binary prefixes]
+used for displaying computing kilobytes, megabytes, gigabytes...
+
+These are the 2^10 = 1024, 2^20 = 1 048 576, 2^30 ... multiples.
+
+(See also [@http://physics.nist.gov/cuu/Units/binary.html Prefixes for binary multiples]
+
+This scale is specified in IEC 60027-2, Second edition, 2000-11,
+Letter symbols to be used in electrical technology -
+Part 2: Telecommunications and electronics).
+
+[autoprefixes_snippet_2]
+
+But note that scalar dimensionless values, like int, float and double,
+are *not* prefixed automatically by the engineering_prefix or binary_prefix iostream manipulators.
+
+[autoprefixes_snippet_3]
+
+You can output the name or symbol of a unit (rather than the most common quantity of a unit).
+
+[autoprefixes_snippet_4]
+
+Note too that all the formatting flags are persistent,
+so that if you set engineering_prefix, then it applies to all future outputs,
+until you select binary_prefix, or explicitly switch autoprefix off.
+You can specify no prefix (the default of course) in two ways:
+
+[autoprefixes_snippet_5]
+
+And you can get the format flags for diagnosing problems.
+
+[autoprefixes_snippet_6]
+
+[endsect] [/section:autoscale Automatically Scaled Units]
+
 [section:ConversionFactor Conversion Factor]
 
 This code demonstrates the use of the `conversion_factor` free function to determine
@@ -1233,7 +1292,7 @@
 and all the members of the Boost mailing list who provided their input into
 the design and implementation of this library.
 
-[endsect]
+[endsect] [/section:Acknowledgements Acknowledgements]
 
 [section:HelpWanted Help Wanted]
 
@@ -1245,29 +1304,46 @@
 
 [endsect]
 
+[section:version_id Version Info]
+
+__boostroot
+
+Last edit to Quickbook file __FILENAME__ was at __TIME__ on __DATE__.
+
+[tip This should appear on the pdf version (but may be redundant on html).]
+[/ Useful on pdf version. See also Last revised timestamp on first page of html version.]
+[/See also Adobe Reader pdf File Properties for creation date, and PDF producer, version and page count.]
+
+[endsect] [/section:version_id Version Info]
+
 [section:ReleaseNotes Release Notes]
 
+1.2 (March 2010)
+
+* Added autoprefix ready for Boost 1.43
+
 1.0.0 (August 1, 2008) :
 
 * Initial release with Boost 1.36
 
 0.7.1 (March 14, 2007) :
 
-* Boost.Typeof emulation support
+* Boost.Typeof emulation support.
 * attempting to rebind a heterogeneous_system to a different set of dimensions now fails.
-* cmath.hpp now works with como-win32
-* minor changes to the tests and examples to make msvc 7.1 happy
+* cmath.hpp now works with como-win32.
+* minor changes to the tests and examples to make msvc 7.1 happy.
 
 0.7.0 (March 13, 2007) :
 
-* heterogeneous and mixed system functionality added
-* added fine-grained implicit unit conversion on a per fundamental dimension basis
-* added a number of utility metafunction classes and predicates
-* [headerref boost/units/operators.hpp] now uses `BOOST_TYPEOF` when possible
-* angular units added in [headerref boost/units/systems/trig.hpp] - implicit conversion
- of radians between trigonometric, SI, and CGS systems allowed
-* a variety of [___unit] and [___quantity] tests added
-* examples now provide self-tests
+* heterogeneous and mixed system functionality added.
+* added fine-grained implicit unit conversion on a per fundamental dimension basis.
+* added a number of utility metafunction classes and predicates.
+* [headerref boost/units/operators.hpp] now uses `BOOST_TYPEOF` when possible.
+* angular units added in [headerref boost/units/systems/angle/gradians.hpp]
+ and [headerref boost/units/systems/angle/gradians.hpp].
+ Implicit conversion of radians between trigonometric, SI, and CGS systems is allowed.
+* a variety of [___unit] and [___quantity] tests added.
+* examples now provide self-tests.
 
 0.6.2 (February 22, 2007) :
 
@@ -1395,4 +1471,4 @@
 * Implementation of I/O is rudimentary; consider methods of i18n using facets
 * Consider runtime variant, perhaps using overload like `quantity<runtime,Y>`
 
-[endsect]
+[endsect] [/section:TODO TODO]

Modified: trunk/libs/units/example/complex.cpp
==============================================================================
--- trunk/libs/units/example/complex.cpp (original)
+++ trunk/libs/units/example/complex.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief complex.cpp
 
-\detailed
+\details
 Demonstrate a complex number class that functions correctly with quantities.
 
 Output:

Modified: trunk/libs/units/example/composite_output.cpp
==============================================================================
--- trunk/libs/units/example/composite_output.cpp (original)
+++ trunk/libs/units/example/composite_output.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief composite_output.cpp
 
-\detailed An example of textual representations of units.
+\details An example of textual representations of units.
 
 Output:
 @verbatim

Modified: trunk/libs/units/example/conversion.cpp
==============================================================================
--- trunk/libs/units/example/conversion.cpp (original)
+++ trunk/libs/units/example/conversion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief conversion.cpp
 
-\detailed
+\details
 Test explicit and implicit unit conversion.
 
 Output:

Modified: trunk/libs/units/example/conversion_factor.cpp
==============================================================================
--- trunk/libs/units/example/conversion_factor.cpp (original)
+++ trunk/libs/units/example/conversion_factor.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief conversion_factor.cpp
 
-\detailed An example of using conversion_factor.
+\details An example of using conversion_factor.
 
 Output:
 @verbatim

Modified: trunk/libs/units/example/dimension.cpp
==============================================================================
--- trunk/libs/units/example/dimension.cpp (original)
+++ trunk/libs/units/example/dimension.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief dimension.cpp
 
-\detailed
+\details
 Test dimension list manipulation.
 
 Output:

Modified: trunk/libs/units/example/heterogeneous_unit.cpp
==============================================================================
--- trunk/libs/units/example/heterogeneous_unit.cpp (original)
+++ trunk/libs/units/example/heterogeneous_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief heterogeneous_unit.cpp
 
-\detailed
+\details
 Test heterogeneous units and quantities.
 
 Output:

Modified: trunk/libs/units/example/kitchen_sink.cpp
==============================================================================
--- trunk/libs/units/example/kitchen_sink.cpp (original)
+++ trunk/libs/units/example/kitchen_sink.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief kitchen_sink.cpp
 
-\detailed
+\details
 More extensive quantity tests.
 
 Output:

Modified: trunk/libs/units/example/non_base_dimension.cpp
==============================================================================
--- trunk/libs/units/example/non_base_dimension.cpp (original)
+++ trunk/libs/units/example/non_base_dimension.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief non_base_dimension.cpp
 
-\detailed
+\details
 Another example of user-defined units with conversions.
 
 Output:

Modified: trunk/libs/units/example/performance.cpp
==============================================================================
--- trunk/libs/units/example/performance.cpp (original)
+++ trunk/libs/units/example/performance.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief performance.cpp
 
-\detailed
+\details
 Test runtime performance.
 
 Output:

Modified: trunk/libs/units/example/quantity.cpp
==============================================================================
--- trunk/libs/units/example/quantity.cpp (original)
+++ trunk/libs/units/example/quantity.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief quantity.cpp
 
-\detailed
+\details
 Test quantity algebra.
 
 Output:

Modified: trunk/libs/units/example/quaternion.cpp
==============================================================================
--- trunk/libs/units/example/quaternion.cpp (original)
+++ trunk/libs/units/example/quaternion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief quaternion.cpp
 
-\detailed
+\details
 Demonstrate interoperability with Boost.Quaternion.
 
 Output:

Modified: trunk/libs/units/example/radar_beam_height.cpp
==============================================================================
--- trunk/libs/units/example/radar_beam_height.cpp (original)
+++ trunk/libs/units/example/radar_beam_height.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief radar_beam_height.cpp
 
-\detailed
+\details
 Demonstrate library usage for user test cases suggested by Michael Fawcett.
 
 Output:

Modified: trunk/libs/units/example/systems.cpp
==============================================================================
--- trunk/libs/units/example/systems.cpp (original)
+++ trunk/libs/units/example/systems.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief systems.cpp
 
-\detailed
+\details
 Test various non-si units
 
 Output:

Modified: trunk/libs/units/example/temperature.cpp
==============================================================================
--- trunk/libs/units/example/temperature.cpp (original)
+++ trunk/libs/units/example/temperature.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief temperature.cpp
 
-\detailed
+\details
 Conversions between Fahrenheit and Kelvin for absolute temperatures and
 temperature differences.
 

Modified: trunk/libs/units/example/tutorial.cpp
==============================================================================
--- trunk/libs/units/example/tutorial.cpp (original)
+++ trunk/libs/units/example/tutorial.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -8,17 +8,22 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-/**
-\file
+/**
+\file tutorial.cpp
     
-\brief tutorial.cpp
+\brief Basic tutorial using SI units.
 
-\detailed
-Basic tutorial using si units.
+\details
+Tutorial
+Defines a function that computes the work, in joules,
+done by exerting a force in newtons over a specified distance
+in meters and outputs the result to std::cout.
+
+Also code for computing the complex impedance
+using std::complex<double> as the value type.
 
 Output:
 @verbatim
-
 //[tutorial_output
 F = 2 N
 dx = 2 m
@@ -30,9 +35,8 @@
 I*Z = (12.5,0) V
 I*Z == V? true
 //]
-
 @endverbatim
-**/
+*/
 
 //[tutorial_code
 #include <complex>
@@ -52,37 +56,39 @@
 using namespace boost::units::si;
 
 quantity<energy>
-work(const quantity<force>& F,const quantity<length>& dx)
+work(const quantity<force>& F, const quantity<length>& dx)
 {
- return F*dx;
+ return F * dx; // Defines the relation: work = force * distance.
 }
 
 int main()
 {
- /// test calcuation of work
- quantity<force> F(2.0*newton);
- quantity<length> dx(2.0*meter);
- quantity<energy> E(work(F,dx));
+ /// Test calculation of work.
+ quantity<force> F(2.0 * newton); // Define a quantity of force.
+ quantity<length> dx(2.0 * meter); // and a distance,
+ quantity<energy> E(work(F,dx)); // and calculate the work done.
     
     std::cout << "F = " << F << std::endl
               << "dx = " << dx << std::endl
               << "E = " << E << std::endl
               << std::endl;
 
- /// check complex quantities
- typedef std::complex<double> complex_type;
+ /// Test and check complex quantities.
+ typedef std::complex<double> complex_type; // double real and imaginary parts.
     
- quantity<electric_potential,complex_type> v = complex_type(12.5,0.0)*volts;
- quantity<current,complex_type> i = complex_type(3.0,4.0)*amperes;
- quantity<resistance,complex_type> z = complex_type(1.5,-2.0)*ohms;
+ // Define some complex electrical quantities.
+ quantity<electric_potential, complex_type> v = complex_type(12.5, 0.0) * volts;
+ quantity<current, complex_type> i = complex_type(3.0, 4.0) * amperes;
+ quantity<resistance, complex_type> z = complex_type(1.5, -2.0) * ohms;
     
     std::cout << "V = " << v << std::endl
               << "I = " << i << std::endl
- << "Z = " << z << std::endl
- << "I*Z = " << i*z << std::endl
- << "I*Z == V? " << std::boolalpha << (i*z == v) << std::endl
+ << "Z = " << z << std::endl
+ // Calculate from Ohm's law voltage = current * resistance.
+ << "I * Z = " << i * z << std::endl
+ // Check defined V is equal to calculated.
+ << "I * Z == V? " << std::boolalpha << (i * z == v) << std::endl
               << std::endl;
-
     return 0;
 }
 //]

Modified: trunk/libs/units/example/unit.cpp
==============================================================================
--- trunk/libs/units/example/unit.cpp (original)
+++ trunk/libs/units/example/unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief unit.cpp
 
-\detailed
+\details
 Test unit algebra.
 
 Output:

Modified: trunk/libs/units/test/fail_add_temperature.cpp
==============================================================================
--- trunk/libs/units/test/fail_add_temperature.cpp (original)
+++ trunk/libs/units/test/fail_add_temperature.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_add_temperature.cpp
 
-\detailed
+\details
 Verify that adding two absolute temeratures fails miserably.
 
 Output:

Modified: trunk/libs/units/test/fail_adl_detail.cpp
==============================================================================
--- trunk/libs/units/test/fail_adl_detail.cpp (original)
+++ trunk/libs/units/test/fail_adl_detail.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_adl_detail.cpp
 
-\detailed
+\details
 make sure that namespace detail is not pulled in by ADL.
 
 Output:

Modified: trunk/libs/units/test/fail_base_dimension.cpp
==============================================================================
--- trunk/libs/units/test/fail_base_dimension.cpp (original)
+++ trunk/libs/units/test/fail_base_dimension.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_base_dimension.cpp
 
-\detailed
+\details
 make sure that trying to use the same ordinal for multiple
 base dimensions fails.
 

Modified: trunk/libs/units/test/fail_heterogeneous_unit.cpp
==============================================================================
--- trunk/libs/units/test/fail_heterogeneous_unit.cpp (original)
+++ trunk/libs/units/test/fail_heterogeneous_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_heterogeneous_unit.cpp
 
-\detailed
+\details
 make sure that trying to bind a heterogeneous system to a different dimension fails.
 
 Output:

Modified: trunk/libs/units/test/fail_implicit_conversion.cpp
==============================================================================
--- trunk/libs/units/test/fail_implicit_conversion.cpp (original)
+++ trunk/libs/units/test/fail_implicit_conversion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_implicit_conversion.cpp
 
-\detailed
+\details
 Test implicit conversions for quantity.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_add.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_add.cpp (original)
+++ trunk/libs/units/test/fail_quantity_add.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_add.cpp
 
-\detailed
+\details
 Test addition of quantities with different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_add_assign.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_add_assign.cpp (original)
+++ trunk/libs/units/test/fail_quantity_add_assign.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_add_assign.cpp
 
-\detailed
+\details
 Test += of quantity from different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_assign.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_assign.cpp (original)
+++ trunk/libs/units/test/fail_quantity_assign.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_assign.cpp
 
-\detailed
+\details
 Test assignment of quantity from different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_construct.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_construct.cpp (original)
+++ trunk/libs/units/test/fail_quantity_construct.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_construct.cpp
 
-\detailed
+\details
 Test construction of quantity from different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_non_unit.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_non_unit.cpp (original)
+++ trunk/libs/units/test/fail_quantity_non_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -12,7 +12,7 @@
     
 \brief fail_quantity_non_unit.cpp
 
-\detailed
+\details
 
 Make sure that trying to use a base_unit as though
 it were a unit fails.

Modified: trunk/libs/units/test/fail_quantity_scalar_add.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_scalar_add.cpp (original)
+++ trunk/libs/units/test/fail_quantity_scalar_add.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_scalar_add.cpp
 
-\detailed
+\details
 Test addition of quantity and scalar.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_scalar_sub.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_scalar_sub.cpp (original)
+++ trunk/libs/units/test/fail_quantity_scalar_sub.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_scalar_sub.cpp
 
-\detailed
+\details
 Test subtraction of quantity and scalar.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_sub_assign.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_sub_assign.cpp (original)
+++ trunk/libs/units/test/fail_quantity_sub_assign.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_sub_assign.cpp
 
-\detailed
+\details
 Test -= of quantity from different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_subtract.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_subtract.cpp (original)
+++ trunk/libs/units/test/fail_quantity_subtract.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_subtract.cpp
 
-\detailed
+\details
 Test subtraction of quantities with different dimensions.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_unit_add.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_unit_add.cpp (original)
+++ trunk/libs/units/test/fail_quantity_unit_add.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_unit_add.cpp
 
-\detailed
+\details
 Test addition of quantity and unit.
 
 Output:

Modified: trunk/libs/units/test/fail_quantity_unit_subtract.cpp
==============================================================================
--- trunk/libs/units/test/fail_quantity_unit_subtract.cpp (original)
+++ trunk/libs/units/test/fail_quantity_unit_subtract.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_unit_subtract.cpp
 
-\detailed
+\details
 Test subtraction of quantity and unit.
 
 Output:

Modified: trunk/libs/units/test/fail_scalar_quantity_add.cpp
==============================================================================
--- trunk/libs/units/test/fail_scalar_quantity_add.cpp (original)
+++ trunk/libs/units/test/fail_scalar_quantity_add.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_scalar_quantity_add.cpp
 
-\detailed
+\details
 Test addition of scalar and quantity.
 
 Output:

Modified: trunk/libs/units/test/fail_scalar_quantity_sub.cpp
==============================================================================
--- trunk/libs/units/test/fail_scalar_quantity_sub.cpp (original)
+++ trunk/libs/units/test/fail_scalar_quantity_sub.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_scalar_quantity_sub.cpp
 
-\detailed
+\details
 Test subtraction of scalar and quantity.
 
 Output:

Modified: trunk/libs/units/test/fail_unit_quantity_add.cpp
==============================================================================
--- trunk/libs/units/test/fail_unit_quantity_add.cpp (original)
+++ trunk/libs/units/test/fail_unit_quantity_add.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_unit_quantity_add.cpp
 
-\detailed
+\details
 Test addition of unit and quantity.
 
 Output:

Modified: trunk/libs/units/test/fail_unit_quantity_subtract.cpp
==============================================================================
--- trunk/libs/units/test/fail_unit_quantity_subtract.cpp (original)
+++ trunk/libs/units/test/fail_unit_quantity_subtract.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_unit_quantity_add.cpp
 
-\detailed
+\details
 Test addition of unit and quantity.
 
 Output:

Modified: trunk/libs/units/test/test_absolute.cpp
==============================================================================
--- trunk/libs/units/test/test_absolute.cpp (original)
+++ trunk/libs/units/test/test_absolute.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_absolute.cpp
 
-\detailed
+\details
 Test absolute units.
 
 Output:

Modified: trunk/libs/units/test/test_base_dimension.cpp
==============================================================================
--- trunk/libs/units/test/test_base_dimension.cpp (original)
+++ trunk/libs/units/test/test_base_dimension.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_base_dimension.cpp
 
-\detailed
+\details
 Test base_dimension class.
 
 Output:

Modified: trunk/libs/units/test/test_cmath.cpp
==============================================================================
--- trunk/libs/units/test/test_cmath.cpp (original)
+++ trunk/libs/units/test/test_cmath.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: trunk/libs/units/test/test_constants.cpp
==============================================================================
--- trunk/libs/units/test/test_constants.cpp (original)
+++ trunk/libs/units/test/test_constants.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_constants.cpp
 
-\detailed
+\details
 Test all combinations of operators with the constants.
 
 **/

Modified: trunk/libs/units/test/test_conversion.cpp
==============================================================================
--- trunk/libs/units/test/test_conversion.cpp (original)
+++ trunk/libs/units/test/test_conversion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_conversion.cpp
 
-\detailed
+\details
 Test conversion between quantities.
 
 Output:

Modified: trunk/libs/units/test/test_custom_unit.cpp
==============================================================================
--- trunk/libs/units/test/test_custom_unit.cpp (original)
+++ trunk/libs/units/test/test_custom_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_custom_unit.cpp
 
-\detailed
+\details
 Make sure that a minimal + - * / unit class is fully functional.
 
 Output:
@@ -34,11 +34,17 @@
 
 template<int Mass, int Length, int Time>
 simple_unit<Mass, Length, Time> operator+(const simple_unit<Mass, Length, Time>&,
- const simple_unit<Mass, Length, Time>&) {}
+ const simple_unit<Mass, Length, Time>&)
+{
+ return simple_unit<Mass, Length, Time>();
+}
 
 template<int Mass, int Length, int Time>
 simple_unit<Mass, Length, Time> operator-(const simple_unit<Mass, Length, Time>&,
- const simple_unit<Mass, Length, Time>&) {}
+ const simple_unit<Mass, Length, Time>&)
+{
+ return simple_unit<Mass, Length, Time>();
+}
 
 template<int Mass1, int Length1, int Time1, int Mass2, int Length2, int Time2>
 simple_unit<Mass1 + Mass2, Length1 + Length2, Time1 + Time2>

Modified: trunk/libs/units/test/test_dimensionless_quantity.cpp
==============================================================================
--- trunk/libs/units/test/test_dimensionless_quantity.cpp (original)
+++ trunk/libs/units/test/test_dimensionless_quantity.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_dimensionless_quantity.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: trunk/libs/units/test/test_header.hpp
==============================================================================
--- trunk/libs/units/test/test_header.hpp (original)
+++ trunk/libs/units/test/test_header.hpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_header.hpp
 
-\detailed
+\details
 Unit system for test purposes.
 
 Output:

Modified: trunk/libs/units/test/test_implicit_conversion.cpp
==============================================================================
--- trunk/libs/units/test/test_implicit_conversion.cpp (original)
+++ trunk/libs/units/test/test_implicit_conversion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_implicit_conversion.cpp
 
-\detailed
+\details
 Test implicit conversions for quantity.
 
 Output:

Modified: trunk/libs/units/test/test_limits.cpp
==============================================================================
--- trunk/libs/units/test/test_limits.cpp (original)
+++ trunk/libs/units/test/test_limits.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_limits.cpp
 
-\detailed
+\details
 Test numeric_limits specialization.
 
 Output:

Modified: trunk/libs/units/test/test_negative_denominator.cpp
==============================================================================
--- trunk/libs/units/test/test_negative_denominator.cpp (original)
+++ trunk/libs/units/test/test_negative_denominator.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_negative_denominator.cpp
 
-\detailed
+\details
 Test negative denominator for static_rational class.
 
 Output:

Modified: trunk/libs/units/test/test_output.cpp
==============================================================================
--- trunk/libs/units/test/test_output.cpp (original)
+++ trunk/libs/units/test/test_output.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -2,19 +2,19 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2009 Steven Watanabe
+// Copyright Paul A. Bristow 2010
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
 /**
-\file
+\file test_output.cpp
     
-\brief test_output.cpp
-
-\detailed
+\brief
 Test unit and quantity printing
-
+\details
+Tests for output from various units, name, symbol and raw formats, and automatic prefixing in engineering and binary units.
 **/
 
 #include <boost/units/quantity.hpp>
@@ -35,6 +35,7 @@
 
 #include <sstream>
 #include <boost/config.hpp>
+#include <limits>
 
 #define BOOST_TEST_MAIN
 #include <boost/test/unit_test.hpp>
@@ -44,11 +45,16 @@
     static const char* symbol() { return("m"); }
 };
 
-struct second_base_unit : boost::units::base_unit<meter_base_unit, boost::units::time_dimension, 2> {
+struct second_base_unit : boost::units::base_unit<second_base_unit, boost::units::time_dimension, 2> {
     static const char* name() { return("second"); }
     static const char* symbol() { return("s"); }
 };
 
+struct byte_base_unit : boost::units::base_unit<byte_base_unit, boost::units::dimensionless_type, 3> {
+ static const char* name() { return("byte"); }
+ static const char* symbol() { return("b"); }
+};
+
 typedef boost::units::make_system<meter_base_unit, second_base_unit>::type my_system;
 
 typedef boost::units::unit<boost::units::length_dimension, my_system> length;
@@ -120,7 +126,8 @@
 
 #endif
 
-BOOST_AUTO_TEST_CASE(test_output_unit_symbol) {
+BOOST_AUTO_TEST_CASE(test_output_unit_symbol)
+{ // base units using default symbol_format (no format specified) and no auto prefixing.
 #define FORMATTERS
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "m");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "m s^-1");
@@ -141,7 +148,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_unit_raw) {
+BOOST_AUTO_TEST_CASE(test_output_unit_raw)
+{ // raw format specified
 #define FORMATTERS << boost::units::raw_format
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "m");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "m s^-1");
@@ -163,7 +171,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_unit_name) {
+BOOST_AUTO_TEST_CASE(test_output_unit_name)
+{ // name format specified.
 #define FORMATTERS << boost::units::name_format
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "meter");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "meter second^-1");
@@ -185,7 +194,8 @@
 }
 
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_symbol) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_symbol)
+{ // quantity symbols using default format.
 #define FORMATTERS
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
@@ -203,10 +213,13 @@
     BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kc1");
     BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kc2");
     BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute m");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1024 b");
+
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_raw) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_raw)
+{ // quantity symbols using raw format.
 #define FORMATTERS << boost::units::raw_format
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
@@ -228,7 +241,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_name) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_name)
+{ // // quantity symbols using name format.
 #define FORMATTERS << boost::units::name_format
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
@@ -249,3 +263,170 @@
 #undef FORMATTERS
 }
 
+BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_name)
+{ // Engineering autoprefix, with name format.
+#define FORMATTERS << boost::units::name_format << boost::units::engineering_prefix
+ // Single base unit like meter.
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
+ BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 kilometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e7*meter_base_unit::unit_type(), "15 megameter");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-3*meter_base_unit::unit_type(), "1.5 millimeter");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-9*meter_base_unit::unit_type(), "1.5 nanometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-8*meter_base_unit::unit_type(), "15 nanometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-10*meter_base_unit::unit_type(), "150 picometer");
+ BOOST_UNITS_TEST_OUTPUT(0.0000000012345 * meter_base_unit::unit_type(), "1.2345 nanometer");
+
+ // Too small or large for a multiple name.
+ BOOST_UNITS_TEST_OUTPUT(9.99999e-25 * meter_base_unit::unit_type(), "9.99999e-025 meter"); // Just too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1e+28 * meter_base_unit::unit_type(), "1e+028 meter"); // Just too large for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e-25 * meter_base_unit::unit_type(), "1.5e-025 meter"); // Too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e+28 * meter_base_unit::unit_type(), "1.5e+028 meter"); // Too large for multiple.
+ // Too 'biggest or too smallest'.
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::max()*meter_base_unit::unit_type(), "3.40282e+038 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::min()*meter_base_unit::unit_type(), "1.17549e-038 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::max()*meter_base_unit::unit_type(), "1.79769e+308 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::min()*meter_base_unit::unit_type(), "2.22507e-308 meter");
+ // Infinity and NaN
+#if defined(_MSC_VER)
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "1.#INF meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-1.#INF meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "1.#QNAN meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "-1.#IND meter");
+#elif defined(__GLIBCXX__)
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "inf meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-inf meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "nan meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "nan meter");
+#else
+ // TODO infinity on other platforms?
+#endif
+ BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_length(), "1.5 kilometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity1(), "1.5 kilo(meter second^-1)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*millisecond_base_unit::unit_type(), "1.5 millisecond");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_time(), "1.5 millisecond");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity2(), "1.5 meter millisecond^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*area(), "1.5 meter^2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_area(), "1.5 kilo(meter^2)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length(), "1.536 megameter"); // 1.5 * 2^10 = 1.5 * 1024 = 1.536
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length2(), "1.5 kiloscaled_meter");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom1(), "1.5 custom1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom2(), "1.5 custom2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kilocustom1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kilocustom2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute meter");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1.024 kilobyte");
+
+ BOOST_UNITS_TEST_OUTPUT(1.5, "1.5"); // scalar.
+ BOOST_UNITS_TEST_OUTPUT(1567., "1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(0.00015, "0.00015"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-1.5, "-1.5"); // scalar.
+ BOOST_UNITS_TEST_OUTPUT(-1567., "-1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-0.00015, "-0.00015"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_symbol)
+{ // Engineering autoprefix, with symbol format.
+#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix
+ // Single base unit like m.
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
+ BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 km");
+ BOOST_UNITS_TEST_OUTPUT(1.5e7*meter_base_unit::unit_type(), "15 Mm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-3*meter_base_unit::unit_type(), "1.5 mm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-9*meter_base_unit::unit_type(), "1.5 nm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-8*meter_base_unit::unit_type(), "15 nm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-10*meter_base_unit::unit_type(), "150 pm");
+ // Too small or large for a multiple name.
+ BOOST_UNITS_TEST_OUTPUT(9.99999e-25 * meter_base_unit::unit_type(), "9.99999e-025 m"); // Just too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1e+28 * meter_base_unit::unit_type(), "1e+028 m"); // Just too large for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e-25 * meter_base_unit::unit_type(), "1.5e-025 m"); // Too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e+28 * meter_base_unit::unit_type(), "1.5e+028 m"); // Too large for multiple.
+ //
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::max()*meter_base_unit::unit_type(), "3.40282e+038 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::min()*meter_base_unit::unit_type(), "1.17549e-038 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::max()*meter_base_unit::unit_type(), "1.79769e+308 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::min()*meter_base_unit::unit_type(), "2.22507e-308 m");
+
+ BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_length(), "1.5 km");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity1(), "1.5 k(m s^-1)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*millisecond_base_unit::unit_type(), "1.5 ms");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_time(), "1.5 ms");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity2(), "1.5 m ms^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*area(), "1.5 m^2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_area(), "1.5 k(m^2)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length(), "1.536 Mm"); // 1.5 * 2^10 = 1.5 * 1024 = 1.536
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length2(), "1.5 kscm");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom1(), "1.5 c1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom2(), "1.5 c2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kc1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kc2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute m");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1.024 kb");
+
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_symbol)
+{ // Binary prefix with symbol format.
+#define FORMATTERS << boost::units::symbol_format << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(1024 * byte_base_unit::unit_type(), "1 Kib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 20) * byte_base_unit::unit_type(), "1 Mib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 30) * byte_base_unit::unit_type(), "1 Gib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 40) * byte_base_unit::unit_type(), "1 Tib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 50) * byte_base_unit::unit_type(), "1 Pib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 60) * byte_base_unit::unit_type(), "1 Eib");
+ BOOST_UNITS_TEST_OUTPUT(42, "42"); // integer scalar.
+ BOOST_UNITS_TEST_OUTPUT(-42, "-42"); // integer scalar.
+ BOOST_UNITS_TEST_OUTPUT(1567, "1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-1567, "-1567"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name)
+{ // Binary prefix with name format.
+ // http://physics.nist.gov/cuu/Units/binary.html
+ // 1998 the International Electrotechnical Commission (IEC) approved
+ // IEC 60027-2, Second edition, 2000-11, Letter symbols to be used in electrical technology
+ // - Part 2: Telecommunications and electronics.
+#define FORMATTERS << boost::units::name_format << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2 kibibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 32) *byte_base_unit::unit_type(), "4 gibibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 41) *byte_base_unit::unit_type(), "2 tebibyte"); // http://en.wikipedia.org/wiki/Tebibyte
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 50) *byte_base_unit::unit_type(), "1 pebibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 60) *byte_base_unit::unit_type(), "1 exbibyte");
+ BOOST_UNITS_TEST_OUTPUT(2048, "2048"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-4096, "-4096"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+// Tests on using more than one format or prefix - only the last specified should be used.
+// (This may indicate a programming mistake, but it is ignored).
+BOOST_AUTO_TEST_CASE(test_output_quantity_name_duplicate)
+{ // Ensure that if more than one format specified, only the last is used.
+#define FORMATTERS << boost::units::symbol_format << boost::units::name_format
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_quantity_symbol_duplicate)
+{ // Ensure that if more than one format specified, only the last is used.
+#define FORMATTERS << boost::units::name_format << boost::units::symbol_format
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name_duplicate)
+{ // Ensure that if more than one auto prefix specified, only the last is used.
+#define FORMATTERS << boost::units::name_format << boost::units::binary_prefix << boost::units::engineering_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2.048 kilobyte");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_symbol_duplicate)
+{ // Ensure that if more than one auto prefix specified, only the last is used.
+#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2 Kib");
+#undef FORMATTERS
+}

Modified: trunk/libs/units/test/test_predicates.cpp
==============================================================================
--- trunk/libs/units/test/test_predicates.cpp (original)
+++ trunk/libs/units/test/test_predicates.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_predicates.cpp
 
-\detailed
+\details
 Test metafunctions is_unit, is_quantity, is_dimension_list ....
 
 Output:

Modified: trunk/libs/units/test/test_quantity.cpp
==============================================================================
--- trunk/libs/units/test/test_quantity.cpp (original)
+++ trunk/libs/units/test/test_quantity.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: trunk/libs/units/test/test_reduce_unit.cpp
==============================================================================
--- trunk/libs/units/test/test_reduce_unit.cpp (original)
+++ trunk/libs/units/test/test_reduce_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_reduce_unit.cpp
 
-\detailed
+\details
 Test that reduce_unit works correctly by itself to try to isolate problems.
 
 Output:

Modified: trunk/libs/units/test/test_scaled_conversion.cpp
==============================================================================
--- trunk/libs/units/test/test_scaled_conversion.cpp (original)
+++ trunk/libs/units/test/test_scaled_conversion.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_scaled_conversion.cpp
 
-\detailed
+\details
 Test unit scaling
 
 Output:

Modified: trunk/libs/units/test/test_scaled_unit.cpp
==============================================================================
--- trunk/libs/units/test/test_scaled_unit.cpp (original)
+++ trunk/libs/units/test/test_scaled_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_scaled_conversion.cpp
 
-\detailed
+\details
 Test unit scaling
 
 Output:

Modified: trunk/libs/units/test/test_trig.cpp
==============================================================================
--- trunk/libs/units/test/test_trig.cpp (original)
+++ trunk/libs/units/test/test_trig.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -12,7 +12,7 @@
     
 \brief test_trig.cpp
 
-\detailed
+\details
 Test trigonometric functions.
 
 Output:

Modified: trunk/libs/units/test/test_unit.cpp
==============================================================================
--- trunk/libs/units/test/test_unit.cpp (original)
+++ trunk/libs/units/test/test_unit.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: trunk/libs/units/test/test_unscale.cpp
==============================================================================
--- trunk/libs/units/test/test_unscale.cpp (original)
+++ trunk/libs/units/test/test_unscale.cpp 2010-06-07 19:49:52 EDT (Mon, 07 Jun 2010)
@@ -1,4 +1,4 @@
-// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
@@ -13,7 +13,7 @@
     
 \brief test_unscale.cpp
 
-\detailed
+\details
 Test that unscale works in an attempt to isolate the sun problems.
 
 Output:


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk