Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / geometry / test / string_from_type.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #ifndef GEOMETRY_TEST_STRING_FROM_TYPE_HPP
15 #define GEOMETRY_TEST_STRING_FROM_TYPE_HPP
16
17 #include <string>
18
19 #if defined(HAVE_TTMATH)
20 #  include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
21 #endif
22
23 #if defined(HAVE_CLN) || defined(HAVE_GMP)
24 #  include <boost/numeric_adaptor/numeric_adaptor.hpp>
25 #endif
26
27
28 #if defined(HAVE_GMP)
29 #  include <boost/numeric_adaptor/gmp_value_type.hpp>
30 #endif
31 #if defined(HAVE_CLN)
32 #  include <boost/numeric_adaptor/cln_value_type.hpp>
33 #endif
34
35
36
37 template <typename T>
38 struct string_from_type {};
39
40 template <> struct string_from_type<void>
41 { static std::string name() { return "v"; }  };
42
43 template <> struct string_from_type<float>
44 { static std::string name() { return "f"; }  };
45
46 template <> struct string_from_type<double>
47 { static std::string name() { return "d"; }  };
48
49 template <> struct string_from_type<long double>
50 { static std::string name() { return "e"; }  };
51
52 template <> struct string_from_type<short int>
53 { static std::string name() { return "s"; }  };
54
55 template <> struct string_from_type<int>
56 { static std::string name() { return "i"; }  };
57
58 template <> struct string_from_type<boost::long_long_type>
59 { static std::string name() { return "l"; }  };
60
61 #if defined(HAVE_TTMATH)
62     template <> struct string_from_type<ttmath_big>
63     { static std::string name() { return "t"; }  };
64 #endif
65
66 #if defined(BOOST_RATIONAL_HPP)
67 template <typename T> struct string_from_type<boost::rational<T> >
68 { static std::string name() { return "r"; }  };
69 #endif
70
71
72 #if defined(HAVE_GMP)
73 template <> struct string_from_type<boost::numeric_adaptor::gmp_value_type>
74 { static std::string name() { return "g"; }  };
75 #endif
76
77 #if defined(HAVE_CLN)
78 template <> struct string_from_type<boost::numeric_adaptor::cln_value_type>
79 { static std::string name() { return "c"; }  };
80 #endif
81
82
83 #endif // GEOMETRY_TEST_STRING_FROM_TYPE_HPP