json/include/nlohmann/detail/input/numerizer.hpp
KeXu001 26cdbe0564
Fix workflows cppcheck (#2)
* change parser template args order

* amalgamate for previous commit

* add newlines at end of file

* incremental changes

* incremental changes

* incremental changes

* incremental changes

* incremental changes (code style)

* incremental changes

* incremental changes amalgamate

* incremental changes (code style)

* add missing include guards

* incremental changes (code style)

* incremental changes (code style)

* incremental changes (amalgamate)

* incremental changes

* incremental changes

* code style change

* clean up includes

* try using vector_of_uint8_t

* add missing include

* add missing include

* add missing includes

* add comment
2021-12-08 01:17:17 -05:00

49 lines
1.0 KiB
C++

#pragma once
#include <cstdint> // uint64_t, int64_t
#include <cstdlib> // strtof, strtod, strtold, strtoll, strtoull
#include <nlohmann/detail/macro_scope.hpp>
namespace nlohmann
{
namespace detail
{
struct numerizer
{
JSON_HEDLEY_NON_NULL(2)
static void strtof(float& f, const char* str, char** endptr) noexcept
{
f = std::strtof(str, endptr);
}
JSON_HEDLEY_NON_NULL(2)
static void strtof(double& f, const char* str, char** endptr) noexcept
{
f = std::strtod(str, endptr);
}
JSON_HEDLEY_NON_NULL(2)
static void strtof(long double& f, const char* str, char** endptr) noexcept
{
f = std::strtold(str, endptr);
}
JSON_HEDLEY_NON_NULL(2)
static uint64_t strtoull(const char* str, char** endptr, int base)
{
return std::strtoull(str, endptr, base);
}
JSON_HEDLEY_NON_NULL(2)
static int64_t strtoll(const char* str, char** endptr, int base)
{
return std::strtoll(str, endptr, base);
}
};
} // namespace detail
} // namespace nlohmann