1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7 
8 
9 //
10 // NOTE: This file is intended to be used ONLY by the test files
11 //       from the Numeric Conversions Library
12 //
13 
14 //
15 // The following 'to_string' helpers are provided to give readable names
16 // to the various enums used by the library.
17 // NOTE: specializations of boost::lexical_cast<> were not used since some compilers had
18 // trouble dealing with such specializations for different enumerations.
19 //
20 
to_string(boost::numeric::int_float_mixture_enum arg)21 std::string to_string ( boost::numeric::int_float_mixture_enum arg )
22 {
23   switch ( arg )
24   {
25     case boost::numeric::integral_to_integral : return "integral_to_integral" ;
26     case boost::numeric::integral_to_float    : return "integral_to_float" ;
27     case boost::numeric::float_to_integral    : return "float_to_integral" ;
28     case boost::numeric::float_to_float       : return "float_to_float" ;
29   }
30   return "(Unknown result!)" ;
31 }
32 
33 
to_string(boost::numeric::sign_mixture_enum arg)34 std::string to_string ( boost::numeric::sign_mixture_enum arg )
35 {
36   switch ( arg )
37   {
38     case boost::numeric::unsigned_to_unsigned : return "unsigned_to_unsigned" ;
39     case boost::numeric::signed_to_signed     : return "signed_to_signed" ;
40     case boost::numeric::signed_to_unsigned   : return "signed_to_unsigned" ;
41     case boost::numeric::unsigned_to_signed   : return "unsigned_to_signed" ;
42   }
43   return "(Unknown result!)" ;
44 }
45 
to_string(boost::numeric::udt_builtin_mixture_enum arg)46 std::string to_string ( boost::numeric::udt_builtin_mixture_enum arg )
47 {
48   switch ( arg )
49   {
50     case boost::numeric::builtin_to_builtin : return "builtin_to_builtin" ;
51     case boost::numeric::builtin_to_udt     : return "builtin_to_udt" ;
52     case boost::numeric::udt_to_builtin     : return "udt_to_builtin" ;
53     case boost::numeric::udt_to_udt         : return "udt_to_udt" ;
54   }
55   return "(Unknown result!)" ;
56 }
57 
58 //
59 ///////////////////////////////////////////////////////////////////////////////////////////////
60 
61