Skip to content

Commit

Permalink
improved docs - method and ctor args has to match the underlying type
Browse files Browse the repository at this point in the history
Fixes #56
  • Loading branch information
acki-m committed May 10, 2017
1 parent e4d729d commit 0fb965d
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 32 deletions.
53 changes: 38 additions & 15 deletions src/rttr/constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ class RTTR_API constructor
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
variant invoke() const;
Expand All @@ -168,8 +170,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -179,8 +184,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -190,8 +198,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -201,8 +212,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -212,8 +226,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -224,8 +241,11 @@ class RTTR_API constructor
* \brief Invokes the constructor of type returned by \ref get_instanciated_type().
* The instance will always be created on the heap and will be returned as variant object.
*
* \remark Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand All @@ -237,9 +257,12 @@ class RTTR_API constructor
* The instance will always be created on the heap and will be returned as variant object.
* Use this method when you need to instantiate a constructor with more then 6 parameters.
*
* \remark Using this invoke function is slower, then specifying the arguments directly.
* Returns an invalid \ref variant object (see \ref variant::is_valid), when the arguments does
* not match the parameters of the underlying constructor.
* \remark The given argument type has to match **exactly** the type of the underling constructor parameter,
* otherwise the constructor cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* Using this invoke function is slower, then specifying the arguments directly.
*
* \see get_parameter_infos()
*
* \return An instance of the type \ref get_instanciated_type().
*/
Expand Down
78 changes: 61 additions & 17 deletions src/rttr/method.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace detail
* use therefore the default ctor of \ref instance::instance() "instance()", or as shortcut use simply `{}`.
*
* A method will be successfully invoked when the provided instance can be converted to the \ref get_declaring_type() "declared class" type.
* When the method has \ref get_parameter_infos "parameters" defined, then the same number of arguments must be provided and the type itself must 100% match the type of the registered function.
* When the method has \ref get_parameter_infos "parameters" defined, then the same number of arguments must be provided and the type itself must **100% match** the type of the registered function.
* An automatically type conversion is **not** performed.
*
* The return type of \ref invoke() is \ef variant object.
Expand Down Expand Up @@ -207,62 +207,100 @@ class RTTR_API method
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \return The possible return value of the method.
*
* \see get_parameter_infos()
*/
variant invoke(instance object, argument arg1) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object, argument arg1, argument arg2) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object, argument arg1, argument arg2, argument arg3) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object, argument arg1, argument arg2, argument arg3, argument arg4) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object, argument arg1, argument arg2, argument arg3, argument arg4,
argument arg5) const;

/*!
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
*
* \remark When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke(instance object, argument arg1, argument arg2, argument arg3, argument arg4,
argument arg5, argument arg6) const;
Expand All @@ -271,10 +309,16 @@ class RTTR_API method
* \brief Invokes the method represented by the current instance \p object, using the specified parameters.
* Use this method when the argument count is higher then six.
*
* \remark Using this invoke function is slower, then specifying the arguments directly.
* When it's a static method you still need to provide an instance object, use therefore the default ctor of \ref instance::instance() "instance()".
* \remark The given argument type has to match **exactly** the type of the underling method parameter,
* otherwise the method cannot be invoked and an invalid \ref variant object (see \ref variant::is_valid)
* will be returned.
* When it's a static method you still need to provide an instance object,
* use therefore the default ctor of \ref instance::instance() "instance()".
* Using this invoke function is slower, then specifying the arguments directly.
*
* \return The type of the return type.
* \see get_parameter_infos()
*
* \return The possible return value of the method.
*/
variant invoke_variadic(instance object, std::vector<argument> args) const;

Expand Down

0 comments on commit 0fb965d

Please sign in to comment.