Holds arguments applied on metamethod invocation.
More...
#include <kanzi/core/metadata/metamethod.hpp>
Holds arguments applied on metamethod invocation.
MethodArguments includes argument values applied on metamethods during invocation. You can add values using setArgument() and setAbstractArgument(), and retrieve them with getArgument() and getAbstractArgument() methods. To get the argument values of a given type use the same argument type which you used to set them. To verify the presence of an argument type, use isSet().
kanzi::MethodArguments::MethodArguments |
( |
| ) |
|
|
explicit |
kanzi::MethodArguments::~MethodArguments |
( |
| ) |
|
template<typename TDataType >
TDataType kanzi::MethodArguments::getArgument |
( |
const PropertyType< TDataType > & |
argumentType | ) |
const |
|
inline |
Returns the value of an argument of a given type.
Use it when the property type defining the metamethod argument is known at build time.
- Parameters
-
argumentType | The type of the argument. |
- Returns
- The argument value set, or the default value of the data type.
- Note
- The function does not tell whether the argument type is set. Use isSet() or getAbstractArgument() functions to find out whether the argument is set.
template<typename TDataType >
void kanzi::MethodArguments::setArgument |
( |
const PropertyType< TDataType > & |
argumentType, |
|
|
typename PropertyType< TDataType >::DataType |
value |
|
) |
| |
|
inline |
Adds or updates the value for a given argument type.
Use it when the property type defining the metamethod argument is known at build time.
- Parameters
-
argumentType | The abstract type of the argument to be set. |
value | The value of the argument type. |
template<typename TDataType >
bool kanzi::MethodArguments::getAbstractArgument |
( |
AbstractPropertyType |
argumentType, |
|
|
TDataType & |
value |
|
) |
| |
|
inline |
Retrieves an argument with the given argumentType into the value address.
Use it when the property type defining the metamethod argument is not known at build time.
- Parameters
-
argumentType | The abstract type of the argument to be set. |
value | The value of the argument type. |
- Returns
- true if the argument is set and the data type of the value matches the argument type.
template<typename TDataType >
void kanzi::MethodArguments::setAbstractArgument |
( |
AbstractPropertyType |
argumentType, |
|
|
TDataType |
value |
|
) |
| |
|
inline |
Adds or updates the value for a given argument type.
Use it when the property type defining the metamethod argument is not known at build time.
- Parameters
-
argumentType | The abstract type of the argument to be set. |
value | The value of the argument type. |
Checks whether a given argument type is set.
- Parameters
-
argumentType | The type of the argument whose presence is checked. |
- Returns
- true if the argument type is defined, false otherwise.
size_t kanzi::MethodArguments::getCount |
( |
| ) |
const |
Returns the number of arguments set, or 0 if none set.
The documentation for this class was generated from the following file: