|
||||
File indexing completed on 2025-01-18 09:36:52
0001 // Boost.Geometry (aka GGL, Generic Geometry Library) 0002 0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. 0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. 0006 0007 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 0008 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 0009 0010 // Use, modification and distribution is subject to the Boost Software License, 0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0012 // http://www.boost.org/LICENSE_1_0.txt) 0013 0014 #ifndef BOOST_GEOMETRY_UTIL_COORDINATE_CAST_HPP 0015 #define BOOST_GEOMETRY_UTIL_COORDINATE_CAST_HPP 0016 0017 #include <cstdlib> 0018 #include <string> 0019 #include <boost/lexical_cast.hpp> 0020 0021 namespace boost { namespace geometry 0022 { 0023 0024 #ifndef DOXYGEN_NO_DETAIL 0025 namespace detail 0026 { 0027 0028 /*! 0029 \brief cast coordinates from a string to a coordinate type 0030 \detail By default it uses lexical_cast. However, lexical_cast seems not to support 0031 See also "define_pi" where the same issue is solved 0032 */ 0033 template <typename CoordinateType> 0034 struct coordinate_cast 0035 { 0036 static inline CoordinateType apply(std::string const& source) 0037 { 0038 #if defined(BOOST_GEOMETRY_NO_LEXICAL_CAST) 0039 return atof(source.c_str()); 0040 #else 0041 return boost::lexical_cast<CoordinateType>(source); 0042 #endif 0043 } 0044 }; 0045 0046 0047 } // namespace detail 0048 #endif 0049 0050 0051 0052 }} // namespace boost::geometry 0053 0054 #endif // BOOST_GEOMETRY_UTIL_COORDINATE_CAST_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |