MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / is_integer

Function is_integer

include/jsoncons/basic_json.hpp:3696–3712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3694
3695 template <typename T>
3696 typename std::enable_if<ext_traits::is_signed_integer<T>::value && sizeof(T) <= sizeof(int64_t),bool>::type
3697 is_integer() const noexcept
3698 {
3699 switch (storage_kind())
3700 {
3701 case json_storage_kind::int64:
3702 return (as_integer<int64_t>() >= (ext_traits::integer_limits<T>::lowest)()) && (as_integer<int64_t>() <= (ext_traits::integer_limits<T>::max)());
3703 case json_storage_kind::uint64:
3704 return as_integer<uint64_t>() <= static_cast<uint64_t>((ext_traits::integer_limits<T>::max)());
3705 case json_storage_kind::const_json_ref:
3706 return cast<const_json_ref_storage>().value().template is_integer<T>();
3707 case json_storage_kind::json_ref:
3708 return cast<json_ref_storage>().value().template is_integer<T>();
3709 default:
3710 return false;
3711 }
3712 }
3713
3714 template <typename T>
3715 typename std::enable_if<ext_traits::is_signed_integer<T>::value && sizeof(int64_t) < sizeof(T),bool>::type

Callers

nothing calls this directly

Calls 5

storage_kindFunction · 0.85
as_string_viewFunction · 0.85
valueMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected