Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
io.hpp File Reference

Stream input and output for rationals, units and quantities. More...

#include <cassert>
#include <cmath>
#include <string>
#include <iosfwd>
#include <ios>
#include <sstream>
#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>
#include <boost/units/unit.hpp>
#include <boost/units/detail/utility.hpp>
Include dependency graph for io.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  boost::units::base_unit_info< BaseUnit >
 traits template for unit names. More...
 
struct  boost::units::detail::xalloc_key_holder< bool >
 
struct  boost::units::detail::xalloc_key_initializer_t
 
struct  boost::units::detail::symbol_string_impl< N >
 
struct  boost::units::detail::symbol_string_impl< N >::apply< Begin >
 
struct  boost::units::detail::symbol_string_impl< 1 >
 
struct  boost::units::detail::symbol_string_impl< 1 >::apply< Begin >
 
struct  boost::units::detail::symbol_string_impl< 0 >
 
struct  boost::units::detail::symbol_string_impl< 0 >::apply< Begin >
 
struct  boost::units::detail::scale_symbol_string_impl< N >
 
struct  boost::units::detail::scale_symbol_string_impl< N >::apply< Begin >
 
struct  boost::units::detail::scale_symbol_string_impl< 0 >
 
struct  boost::units::detail::scale_symbol_string_impl< 0 >::apply< Begin >
 
struct  boost::units::detail::name_string_impl< N >
 
struct  boost::units::detail::name_string_impl< N >::apply< Begin >
 
struct  boost::units::detail::name_string_impl< 1 >
 
struct  boost::units::detail::name_string_impl< 1 >::apply< Begin >
 
struct  boost::units::detail::name_string_impl< 0 >
 
struct  boost::units::detail::name_string_impl< 0 >::apply< Begin >
 
struct  boost::units::detail::scale_name_string_impl< N >
 
struct  boost::units::detail::scale_name_string_impl< N >::apply< Begin >
 
struct  boost::units::detail::scale_name_string_impl< 0 >
 
struct  boost::units::detail::scale_name_string_impl< 0 >::apply< Begin >
 
struct  boost::units::detail::format_raw_symbol_impl
 
struct  boost::units::detail::format_symbol_impl
 
struct  boost::units::detail::format_raw_name_impl
 
struct  boost::units::detail::format_name_impl
 
struct  boost::units::autoprefix_norm_impl< T, C >
 
struct  boost::units::autoprefix_norm_impl< T, true >
 
struct  boost::units::autoprefix_norm_impl< T, false >
 
struct  boost::units::detail::print_default_t< Os, Quantity >
 
struct  boost::units::detail::print_scale_t< Os >
 

Namespaces

 boost
 Duration formatting facet for input.
 
 boost::serialization
 
 boost::units
 
 boost::units::detail
 

Typedefs

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 > > > > > > > > > > > > > > > > > > 
boost::units::detail::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 > >, list< scale
< 2, static_rational
< 80 > >, list< scale
< 2, static_rational
< 90 > >, dimensionless_type > > > > > > > > > 
boost::units::detail::binary_prefixes
 

Enumerations

enum  boost::units::format_mode {
  boost::units::symbol_fmt = 0,
  boost::units::name_fmt = 1,
  boost::units::raw_fmt = 2,
  boost::units::typename_fmt = 3,
  boost::units::fmt_mask = 3
}
 format of output of units, for example "m" or "meter". More...
 
enum  boost::units::autoprefix_mode {
  boost::units::autoprefix_none = 0,
  boost::units::autoprefix_engineering = 4,
  boost::units::autoprefix_binary = 8,
  boost::units::autoprefix_mask = 12
}
 automatic scaling and prefix (controlled by value of quantity) a, if any, More...
 

Functions

template<class Archive , class System , class Dim >
void boost::serialization::serialize (Archive &ar, boost::units::unit< Dim, System > &, const unsigned int)
 Boost Serialization library support for units. More...
 
template<class Archive , class Unit , class Y >
void boost::serialization::serialize (Archive &ar, boost::units::quantity< Unit, Y > &q, const unsigned int)
 Boost Serialization library support for quantities. More...
 
template<class T >
std::string boost::units::to_string (const T &t)
 
template<integer_type N>
std::string boost::units::to_string (const static_rational< N > &)
 get string representation of integral-valued static_rational. More...
 
template<integer_type N, integer_type D>
std::string boost::units::to_string (const static_rational< N, D > &)
 get string representation of static_rational. More...
 
template<class Char , class Traits , integer_type N, integer_type D>
std::basic_ostream< Char,
Traits > & 
boost::units::operator<< (std::basic_ostream< Char, Traits > &os, const static_rational< N, D > &r)
 Write static_rational to std::basic_ostream. More...
 
long boost::units::get_flags (std::ios_base &ios, long mask)
 returns flags controlling output. More...
 
void boost::units::set_flags (std::ios_base &ios, long new_flags, long mask)
 Set new flags controlling output format. More...
 
format_mode boost::units::get_format (std::ios_base &ios)
 returns flags controlling output format. More...
 
void boost::units::set_format (std::ios_base &ios, format_mode new_mode)
 Set new flags controlling output format. More...
 
std::ios_base & boost::units::typename_format (std::ios_base &ios)
 Set new flags for type_name output format. More...
 
std::ios_base & boost::units::raw_format (std::ios_base &ios)
 set new flag for raw format output, for example "m". More...
 
std::ios_base & boost::units::symbol_format (std::ios_base &ios)
 set new format flag for symbol output, for example "m". More...
 
std::ios_base & boost::units::name_format (std::ios_base &ios)
 set new format for name output, for example "meter". More...
 
autoprefix_mode boost::units::get_autoprefix (std::ios_base &ios)
 get autoprefix flags for output. More...
 
void boost::units::set_autoprefix (std::ios_base &ios, autoprefix_mode new_mode)
 Get format for output. More...
 
std::ios_base & boost::units::no_prefix (std::ios_base &ios)
 Clear autoprefix flags. More...
 
std::ios_base & boost::units::engineering_prefix (std::ios_base &ios)
 Set flag for engineering prefix, so 1234.5 m displays as "1.2345 km". More...
 
std::ios_base & boost::units::binary_prefix (std::ios_base &ios)
 Set flag for binary prefix, so 1024 byte displays as "1 Kib". More...
 
template<integer_type N, integer_type D>
std::string boost::units::detail::exponent_string (const static_rational< N, D > &r)
 
template<>
std::string boost::units::detail::exponent_string (const static_rational< 1 > &)
 
template<class T >
std::string boost::units::detail::base_unit_symbol_string (const T &)
 
template<class T >
std::string boost::units::detail::base_unit_name_string (const T &)
 
template<class Dimension , class System , class SubFormatter >
std::string boost::units::detail::to_string_impl (const unit< Dimension, System > &, SubFormatter f)
 
template<class Dimension , class Units , class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< Units, Dimension, dimensionless_type > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< dimensionless_type, heterogeneous_system< heterogeneous_system_impl< dimensionless_type, dimensionless_type, dimensionless_type > > > &, Subformatter)
 INTERNAL ONLY. More...
 
template<class Scale , class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< dimensionless_type, heterogeneous_system< heterogeneous_system_impl< dimensionless_type, dimensionless_type, Scale > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Dimension , class Units , class Scale , class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< Units, Dimension, Scale > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Dimension , class Unit , class Scale , class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< list< heterogeneous_system_dim< Unit, static_rational< 1 > >, dimensionless_type >, Dimension, Scale > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Dimension , class Unit , class Subformatter >
std::string boost::units::detail::to_string_impl (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< list< heterogeneous_system_dim< Unit, static_rational< 1 > >, dimensionless_type >, Dimension, dimensionless_type > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Dimension , class Unit , class UnitScale , class Scale , class Subformatter >
std::string boost::units::detail::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)
 INTERNAL ONLY. More...
 
template<class Dimension , class Unit , class UnitScale , class Subformatter >
std::string boost::units::detail::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)
 INTERNAL ONLY. More...
 
template<class Char , class Traits >
void boost::units::detail::do_print (std::basic_ostream< Char, Traits > &os, const std::string &s)
 
void boost::units::detail::do_print (std::ostream &os, const std::string &s)
 
template<class Char , class Traits >
void boost::units::detail::do_print (std::basic_ostream< Char, Traits > &os, const char *s)
 
template<class T >
autoprefix_norm_impl< T >::type boost::units::autoprefix_norm (const T &arg)
 
template<class End , class Prev , class T , class F >
bool boost::units::detail::find_matching_scale_impl (End, End, Prev, T, double, F)
 
template<class Begin , class End , class Prev , class T , class F >
bool boost::units::detail::find_matching_scale_impl (Begin, End end, Prev prev, T t, double x, F f)
 
template<class End , class T , class F >
bool boost::units::detail::find_matching_scale_i (End, End, T, double, F)
 
template<class Begin , class End , class T , class F >
bool boost::units::detail::find_matching_scale_i (Begin, End end, T t, double x, F f)
 
template<class Scales , class T , class F >
bool boost::units::detail::find_matching_scale (T t, double x, F f)
 
template<class Os , class Quantity >
print_default_t< Os, Quantity > boost::units::detail::print_default (Os &os, const Quantity &q)
 
template<class Os >
print_scale_t< Os > boost::units::detail::print_scale (Os &os, bool &prefixed)
 
template<class Dimension , class Units , class Scale , class Subformatter >
std::string boost::units::detail::maybe_parenthesize (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< Units, Dimension, Scale > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Dimension , class Unit , class Scale , class Subformatter >
std::string boost::units::detail::maybe_parenthesize (const unit< Dimension, heterogeneous_system< heterogeneous_system_impl< list< heterogeneous_system_dim< Unit, static_rational< 1 > >, dimensionless_type >, Dimension, Scale > > > &, Subformatter f)
 INTERNAL ONLY. More...
 
template<class Prefixes , class CharT , class Traits , class Unit , class T , class F >
void boost::units::detail::do_print_prefixed_impl (std::basic_ostream< CharT, Traits > &os, const quantity< Unit, T > &q, F default_)
 
template<class Prefixes , class CharT , class Traits , class Dimension , class BaseUnit , class BaseScale , class Scale , class T >
base_unit_info
< scaled_base_unit< BaseUnit,
Scale >
>::base_unit_info_primary_template 
boost::units::detail::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)
 
template<class Prefixes , class CharT , class Traits , class Dimension , class L , class Scale , class T >
void boost::units::detail::do_print_prefixed (std::basic_ostream< CharT, Traits > &os, const quantity< unit< Dimension, heterogeneous_system< heterogeneous_system_impl< L, Dimension, Scale > > >, T > &q)
 
template<class Prefixes , class CharT , class Traits , class Dimension , class System , class T >
void boost::units::detail::do_print_prefixed (std::basic_ostream< CharT, Traits > &os, const quantity< unit< Dimension, System >, T > &q)
 
template<class Prefixes , class CharT , class Traits , class Unit , class T >
void boost::units::detail::do_print_prefixed (std::basic_ostream< CharT, Traits > &os, const quantity< Unit, T > &q)
 
template<class Prefixes , class CharT , class Traits , class Unit , class T >
void boost::units::detail::maybe_print_prefixed (std::basic_ostream< CharT, Traits > &os, const quantity< Unit, T > &q, mpl::true_)
 
template<class Prefixes , class CharT , class Traits , class Unit , class T >
void boost::units::detail::maybe_print_prefixed (std::basic_ostream< CharT, Traits > &os, const quantity< Unit, T > &q, mpl::false_)
 
mpl::true_ boost::units::detail::test_norm (double)
 
mpl::false_ boost::units::detail::test_norm (one)
 
template<class Dimension , class System >
std::string boost::units::typename_string (const unit< Dimension, System > &)
 
template<class Dimension , class System >
std::string boost::units::symbol_string (const unit< Dimension, System > &)
 
template<class Dimension , class System >
std::string boost::units::name_string (const unit< Dimension, System > &)
 
template<class Char , class Traits , class Dimension , class System >
std::basic_ostream< Char,
Traits > & 
boost::units::operator<< (std::basic_ostream< Char, Traits > &os, const unit< Dimension, System > &u)
 Print a unit as a list of base units and their exponents. More...
 
template<class Char , class Traits , class Unit , class T >
std::basic_ostream< Char,
Traits > & 
boost::units::operator<< (std::basic_ostream< Char, Traits > &os, const quantity< Unit, T > &q)
 Print a quantity. More...
 

Detailed Description

Stream input and output for rationals, units and quantities.

Functions and manipulators for output and input of units and quantities. symbol and name format, and engineering and binary autoprefix. Serialization output is also supported.