From 0bb06d51904f7c6d3180077b70e1f9b4a04f6d45 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 24 Dec 2017 00:57:08 +0100 Subject: [PATCH] Ensure all pull helper are declared prior to the call site --- lib/json/reflector.h | 70 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/lib/json/reflector.h b/lib/json/reflector.h index a2cc6f6..70aba88 100644 --- a/lib/json/reflector.h +++ b/lib/json/reflector.h @@ -343,6 +343,70 @@ void pull(Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue>...> void pull(Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue> &value, JsonDeserializationErrors *errors); +/*! + * \brief Pulls the specified \a reflectable which is an iteratable without reserve() method from the specified value which is checked to contain an array. + */ +template , Traits::Not>>...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is an iteratable with reserve() method from the specified value which is checked to contain an array. + */ +template , Traits::IsReservable>...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is an iteratable from the specified array. The \a reflectable is cleared before. + */ +template >...> +void pull(Type &reflectable, rapidjson::GenericValue>::ConstArray array, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is a map from the specified value which is checked to contain an object. + */ +template >...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is a tuple from the specified value which is checked to contain an array. + */ +template >...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is a unique_ptr from the specified value which might be null. + */ +template >...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable which is a shared_ptr from the specified value which might be null. + */ +template >...> +void pull(Type &reflectable, const rapidjson::GenericValue> &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified \a reflectable from the specified value iterator which is checked to contain the right type. + */ +template +inline void pull( + Type &reflectable, rapidjson::GenericValue>::ValueIterator &value, JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the specified member of \a reflectable which has a custom type from the specified object. + * \remarks It is checked whether the object actually contains the member. If not, the missing member is ignored. So currently all members + * are optional. + */ +template +inline void pull(Type &reflectable, const char *name, const rapidjson::GenericValue>::ConstObject &value, + JsonDeserializationErrors *errors); + +/*! + * \brief Pulls the \a reflectable which has a custom type from the specified value which is supposed and checked to contain an object. + */ +template >...> +void pull(Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue> &value, JsonDeserializationErrors *errors); + /*! * \brief Pulls the integer/float/boolean from the specified value which is supposed and checked to contain the right type. */ @@ -393,12 +457,6 @@ inline void pull( reflectable = value.GetString(); } -/*! - * \brief Pulls the specified \a reflectable which is an iteratable from the specified array. The \a reflectable is cleared before. - */ -template >...> -void pull(Type &reflectable, rapidjson::GenericValue>::ConstArray array, JsonDeserializationErrors *errors); - /*! * \brief Pulls the specified \a reflectable which is an iteratable without reserve() method from the specified value which is checked to contain an array. */