| 215 | // Convert single signed integer value (also {Date,Time}{32,64} and Timestamp) |
| 216 | template <typename T> |
| 217 | enable_if_physical_signed_integer<T, Status> ConvertNumber(const rj::Value& json_obj, |
| 218 | const DataType& type, |
| 219 | typename T::c_type* out) { |
| 220 | if (json_obj.IsInt64()) { |
| 221 | int64_t v64 = json_obj.GetInt64(); |
| 222 | *out = static_cast<typename T::c_type>(v64); |
| 223 | if (*out == v64) { |
| 224 | return Status::OK(); |
| 225 | } else { |
| 226 | return Status::Invalid("Value ", v64, " out of bounds for ", type); |
| 227 | } |
| 228 | } else { |
| 229 | *out = static_cast<typename T::c_type>(0); |
| 230 | return JSONTypeError("signed int", json_obj.GetType()); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | // Convert single unsigned integer value |
| 235 | template <typename T> |