🚸 add static assertion for missing binary function in SAX interface
This commit is contained in:
parent
a10d486e36
commit
7fc4b2901a
2 changed files with 26 additions and 12 deletions
|
@ -34,6 +34,10 @@ template<typename T, typename String>
|
||||||
using string_function_t =
|
using string_function_t =
|
||||||
decltype(std::declval<T&>().string(std::declval<String&>()));
|
decltype(std::declval<T&>().string(std::declval<String&>()));
|
||||||
|
|
||||||
|
template<typename T, typename Binary>
|
||||||
|
using binary_function_t =
|
||||||
|
decltype(std::declval<T&>().binary(std::declval<Binary&>()));
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using start_object_function_t =
|
using start_object_function_t =
|
||||||
decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
|
decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
|
||||||
|
@ -68,19 +72,18 @@ struct is_sax
|
||||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||||
using number_float_t = typename BasicJsonType::number_float_t;
|
using number_float_t = typename BasicJsonType::number_float_t;
|
||||||
using string_t = typename BasicJsonType::string_t;
|
using string_t = typename BasicJsonType::string_t;
|
||||||
|
using binary_t = typename BasicJsonType::binary_t;
|
||||||
using exception_t = typename BasicJsonType::exception;
|
using exception_t = typename BasicJsonType::exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr bool value =
|
static constexpr bool value =
|
||||||
is_detected_exact<bool, null_function_t, SAX>::value &&
|
is_detected_exact<bool, null_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, boolean_function_t, SAX>::value &&
|
is_detected_exact<bool, boolean_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, number_integer_function_t, SAX,
|
is_detected_exact<bool, number_integer_function_t, SAX, number_integer_t>::value &&
|
||||||
number_integer_t>::value &&
|
is_detected_exact<bool, number_unsigned_function_t, SAX, number_unsigned_t>::value &&
|
||||||
is_detected_exact<bool, number_unsigned_function_t, SAX,
|
is_detected_exact<bool, number_float_function_t, SAX, number_float_t, string_t>::value &&
|
||||||
number_unsigned_t>::value &&
|
|
||||||
is_detected_exact<bool, number_float_function_t, SAX, number_float_t,
|
|
||||||
string_t>::value &&
|
|
||||||
is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
|
is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
|
||||||
|
is_detected_exact<bool, binary_function_t, SAX, binary_t>::value &&
|
||||||
is_detected_exact<bool, start_object_function_t, SAX>::value &&
|
is_detected_exact<bool, start_object_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
|
is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
|
||||||
is_detected_exact<bool, end_object_function_t, SAX>::value &&
|
is_detected_exact<bool, end_object_function_t, SAX>::value &&
|
||||||
|
@ -100,6 +103,7 @@ struct is_sax_static_asserts
|
||||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||||
using number_float_t = typename BasicJsonType::number_float_t;
|
using number_float_t = typename BasicJsonType::number_float_t;
|
||||||
using string_t = typename BasicJsonType::string_t;
|
using string_t = typename BasicJsonType::string_t;
|
||||||
|
using binary_t = typename BasicJsonType::binary_t;
|
||||||
using exception_t = typename BasicJsonType::exception;
|
using exception_t = typename BasicJsonType::exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -123,6 +127,9 @@ struct is_sax_static_asserts
|
||||||
static_assert(
|
static_assert(
|
||||||
is_detected_exact<bool, string_function_t, SAX, string_t>::value,
|
is_detected_exact<bool, string_function_t, SAX, string_t>::value,
|
||||||
"Missing/invalid function: bool string(string_t&)");
|
"Missing/invalid function: bool string(string_t&)");
|
||||||
|
static_assert(
|
||||||
|
is_detected_exact<bool, binary_function_t, SAX, binary_t>::value,
|
||||||
|
"Missing/invalid function: bool binary(binary_t&)");
|
||||||
static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
|
static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
|
||||||
"Missing/invalid function: bool start_object(std::size_t)");
|
"Missing/invalid function: bool start_object(std::size_t)");
|
||||||
static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
|
static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
|
||||||
|
|
|
@ -5774,6 +5774,10 @@ template<typename T, typename String>
|
||||||
using string_function_t =
|
using string_function_t =
|
||||||
decltype(std::declval<T&>().string(std::declval<String&>()));
|
decltype(std::declval<T&>().string(std::declval<String&>()));
|
||||||
|
|
||||||
|
template<typename T, typename Binary>
|
||||||
|
using binary_function_t =
|
||||||
|
decltype(std::declval<T&>().binary(std::declval<Binary&>()));
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using start_object_function_t =
|
using start_object_function_t =
|
||||||
decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
|
decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
|
||||||
|
@ -5808,19 +5812,18 @@ struct is_sax
|
||||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||||
using number_float_t = typename BasicJsonType::number_float_t;
|
using number_float_t = typename BasicJsonType::number_float_t;
|
||||||
using string_t = typename BasicJsonType::string_t;
|
using string_t = typename BasicJsonType::string_t;
|
||||||
|
using binary_t = typename BasicJsonType::binary_t;
|
||||||
using exception_t = typename BasicJsonType::exception;
|
using exception_t = typename BasicJsonType::exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr bool value =
|
static constexpr bool value =
|
||||||
is_detected_exact<bool, null_function_t, SAX>::value &&
|
is_detected_exact<bool, null_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, boolean_function_t, SAX>::value &&
|
is_detected_exact<bool, boolean_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, number_integer_function_t, SAX,
|
is_detected_exact<bool, number_integer_function_t, SAX, number_integer_t>::value &&
|
||||||
number_integer_t>::value &&
|
is_detected_exact<bool, number_unsigned_function_t, SAX, number_unsigned_t>::value &&
|
||||||
is_detected_exact<bool, number_unsigned_function_t, SAX,
|
is_detected_exact<bool, number_float_function_t, SAX, number_float_t, string_t>::value &&
|
||||||
number_unsigned_t>::value &&
|
|
||||||
is_detected_exact<bool, number_float_function_t, SAX, number_float_t,
|
|
||||||
string_t>::value &&
|
|
||||||
is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
|
is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
|
||||||
|
is_detected_exact<bool, binary_function_t, SAX, binary_t>::value &&
|
||||||
is_detected_exact<bool, start_object_function_t, SAX>::value &&
|
is_detected_exact<bool, start_object_function_t, SAX>::value &&
|
||||||
is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
|
is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
|
||||||
is_detected_exact<bool, end_object_function_t, SAX>::value &&
|
is_detected_exact<bool, end_object_function_t, SAX>::value &&
|
||||||
|
@ -5840,6 +5843,7 @@ struct is_sax_static_asserts
|
||||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||||
using number_float_t = typename BasicJsonType::number_float_t;
|
using number_float_t = typename BasicJsonType::number_float_t;
|
||||||
using string_t = typename BasicJsonType::string_t;
|
using string_t = typename BasicJsonType::string_t;
|
||||||
|
using binary_t = typename BasicJsonType::binary_t;
|
||||||
using exception_t = typename BasicJsonType::exception;
|
using exception_t = typename BasicJsonType::exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -5863,6 +5867,9 @@ struct is_sax_static_asserts
|
||||||
static_assert(
|
static_assert(
|
||||||
is_detected_exact<bool, string_function_t, SAX, string_t>::value,
|
is_detected_exact<bool, string_function_t, SAX, string_t>::value,
|
||||||
"Missing/invalid function: bool string(string_t&)");
|
"Missing/invalid function: bool string(string_t&)");
|
||||||
|
static_assert(
|
||||||
|
is_detected_exact<bool, binary_function_t, SAX, binary_t>::value,
|
||||||
|
"Missing/invalid function: bool binary(binary_t&)");
|
||||||
static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
|
static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
|
||||||
"Missing/invalid function: bool start_object(std::size_t)");
|
"Missing/invalid function: bool start_object(std::size_t)");
|
||||||
static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
|
static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
|
||||||
|
|
Loading…
Reference in a new issue