Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:57

0001 // Copyright 2022 Peter Dimov
0002 // Copyright 2023 Matt Borland
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // https://www.boost.org/LICENSE_1_0.txt
0005 
0006 // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996
0007 #ifndef _SCL_SECURE_NO_WARNINGS
0008 # define _SCL_SECURE_NO_WARNINGS
0009 #endif
0010 #ifndef NO_WARN_MBCS_MFC_DEPRECATION
0011 # define NO_WARN_MBCS_MFC_DEPRECATION
0012 #endif
0013 
0014 #include <boost/json/detail/charconv/detail/fast_float/fast_float.hpp>
0015 #include <boost/json/detail/charconv/detail/from_chars_float_impl.hpp>
0016 #include <boost/json/detail/charconv/from_chars.hpp>
0017 #include <system_error>
0018 #include <string>
0019 #include <cstdlib>
0020 #include <cerrno>
0021 #include <cstring>
0022 
0023 #if defined(__GNUC__) && __GNUC__ < 5
0024 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
0025 #endif
0026 
0027 std::errc boost::json::detail::charconv::detail::errno_to_errc(int errno_value) noexcept
0028 {
0029     switch (errno_value)
0030     {
0031         case EINVAL:
0032             return std::errc::invalid_argument;
0033         case ERANGE:
0034             return std::errc::result_out_of_range;
0035         default:
0036             return std::errc();
0037     }
0038 }
0039 
0040 boost::json::detail::charconv::from_chars_result boost::json::detail::charconv::from_chars(const char* first, const char* last, double& value, boost::json::detail::charconv::chars_format fmt) noexcept
0041 {
0042     if (fmt != boost::json::detail::charconv::chars_format::hex)
0043     {
0044         return boost::json::detail::charconv::detail::fast_float::from_chars(first, last, value, fmt);
0045     }
0046     return boost::json::detail::charconv::detail::from_chars_float_impl(first, last, value, fmt);
0047 }