Holds argument type and value information.
More...
#include <kanzi/core/metadata/metamethod.hpp>
Holds argument type and value information.
The MethodArgument holds the type and value of a metamethod argument or the return value of the method. You can specify the value of the argument upon instantiation and retrieve it with one of the get() template function members.
◆ MethodArgument() [1/4]
kanzi::MethodArgument::MethodArgument |
( |
| ) |
|
|
explicit |
◆ ~MethodArgument()
kanzi::MethodArgument::~MethodArgument |
( |
| ) |
|
◆ MethodArgument() [2/4]
template<typename TDataType >
kanzi::MethodArgument::MethodArgument |
( |
const PropertyType< TDataType > & |
argumentType, |
|
|
typename PropertyType< TDataType >::DataType |
value |
|
) |
| |
|
inlineexplicit |
Creates an argument with a property type.
- Parameters
-
argumentType | A property type defining the type of the argument. |
value | The value of the argument. |
◆ MethodArgument() [3/4]
template<typename TDataType >
Creates an argument using an AbstractPropertyType.
The type of the value must match the type defined by the argumentType.
- Parameters
-
argumentType | An abstract property type defining the type of the argument. |
value | The value of the argument. |
◆ MethodArgument() [4/4]
◆ operator=()
◆ get() [1/2]
template<typename TDataType >
optional<TDataType> kanzi::MethodArgument::get |
( |
const PropertyType< TDataType > & |
argumentType | ) |
const |
|
inline |
Returns the value of the argument.
The argumentType must match the type of the MethodArgument instance.
- Parameters
-
argumentType | Type of the argument. |
- Returns
- The value of the argument, or nullopt, if the argument is not valid or the argumentType and the stored type do not match.
◆ get() [2/2]
template<typename TDataType >
Overloaded version of get() using AbstractPropertyType to retrieve the value.
- Parameters
-
argumentType | AbstractPropertyType defining the type of the argument. |
value | The address to store the argument value. |
- Returns
- true if the argument can be retrieved, false if the argument is invalid, the argumentType differs from the type stored, or the type of the value differs from the type of the argument.
◆ getType()
Returns the type of the argument.
◆ isValid()
bool kanzi::MethodArgument::isValid |
( |
| ) |
const |
|
inline |
Returns true if the argument stores a valid value, false otherwise.
The documentation for this class was generated from the following file: