brought back the from_*(ptr, len) syntax with a deprecation warning

This commit is contained in:
Francois Chabot 2020-05-28 12:13:43 -04:00
parent 248f310215
commit d575534471
2 changed files with 98 additions and 0 deletions

View file

@ -6639,6 +6639,7 @@ class basic_json
return result; return result;
} }
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, parse(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json parse(detail::span_input_adapter&& i, static basic_json parse(detail::span_input_adapter&& i,
const parser_callback_t cb = nullptr, const parser_callback_t cb = nullptr,
@ -6661,6 +6662,8 @@ class basic_json
return parser(detail::input_adapter(std::move(first), std::move(last))).accept(true); return parser(detail::input_adapter(std::move(first), std::move(last))).accept(true);
} }
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, accept(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static bool accept(detail::span_input_adapter&& i) static bool accept(detail::span_input_adapter&& i)
{ {
return parser(i.get()).accept(true); return parser(i.get()).accept(true);
@ -6728,6 +6731,7 @@ class basic_json
} }
template <typename SAX> template <typename SAX>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, sax_parse(ptr, ptr + len, ...))
JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static bool sax_parse(detail::span_input_adapter&& i, SAX* sax, static bool sax_parse(detail::span_input_adapter&& i, SAX* sax,
input_format_t format = input_format_t::json, input_format_t format = input_format_t::json,
@ -7403,6 +7407,18 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_cbor(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(detail::span_input_adapter&& i, static basic_json from_cbor(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
@ -7531,6 +7547,17 @@ class basic_json
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(detail::span_input_adapter&& i, static basic_json from_msgpack(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
@ -7634,7 +7661,18 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(detail::span_input_adapter&& i, static basic_json from_ubjson(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7736,6 +7774,17 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_bson(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED(3.8.0, from_bson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(detail::span_input_adapter&& i, static basic_json from_bson(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,

View file

@ -22402,6 +22402,7 @@ class basic_json
return result; return result;
} }
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, parse(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json parse(detail::span_input_adapter&& i, static basic_json parse(detail::span_input_adapter&& i,
const parser_callback_t cb = nullptr, const parser_callback_t cb = nullptr,
@ -22424,6 +22425,8 @@ class basic_json
return parser(detail::input_adapter(std::move(first), std::move(last))).accept(true); return parser(detail::input_adapter(std::move(first), std::move(last))).accept(true);
} }
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, accept(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static bool accept(detail::span_input_adapter&& i) static bool accept(detail::span_input_adapter&& i)
{ {
return parser(i.get()).accept(true); return parser(i.get()).accept(true);
@ -22491,6 +22494,7 @@ class basic_json
} }
template <typename SAX> template <typename SAX>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, sax_parse(ptr, ptr + len, ...))
JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static bool sax_parse(detail::span_input_adapter&& i, SAX* sax, static bool sax_parse(detail::span_input_adapter&& i, SAX* sax,
input_format_t format = input_format_t::json, input_format_t format = input_format_t::json,
@ -23166,6 +23170,18 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_cbor(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(detail::span_input_adapter&& i, static basic_json from_cbor(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
@ -23294,6 +23310,17 @@ class basic_json
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(detail::span_input_adapter&& i, static basic_json from_msgpack(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
@ -23397,7 +23424,18 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(detail::span_input_adapter&& i, static basic_json from_ubjson(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -23499,6 +23537,17 @@ class basic_json
return res ? result : basic_json(value_t::discarded); return res ? result : basic_json(value_t::discarded);
} }
template<typename T>
JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(const T* ptr, std::size_t len,
const bool strict = true,
const bool allow_exceptions = true)
{
return from_bson(ptr, ptr + len, strict, allow_exceptions);
}
JSON_HEDLEY_DEPRECATED(3.8.0, from_bson(ptr, ptr + len))
JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(detail::span_input_adapter&& i, static basic_json from_bson(detail::span_input_adapter&& i,
const bool strict = true, const bool strict = true,