#include <apiargument.h>
Public Member Functions | |
APIArgument (std::unique_ptr< APIBaseValue > value) | |
~APIArgument ()=default | |
APIArgument (APIArgument &)=delete | |
APIArgument & | operator= (const APIArgument &)=delete |
const rtti::TypeInfo | getValueType () const |
const APIBaseValue & | getValue () const |
template<typename T > | |
T * | get () |
template<typename T > | |
const T * | get () const |
template<typename T > | |
T | getCopy () |
bool | isArray () const |
template<typename T > | |
const std::vector< T > * | asArray () const |
template<typename T > | |
std::vector< T > * | asArray () |
bool | isString () const |
std::string | asString () const |
bool | isChar () const |
char | asChar () const |
bool | isByte () const |
uint8_t | asByte () const |
bool | isFloat () const |
float | asFloat () const |
bool | isDouble () const |
double | asDouble () const |
bool | isInt () const |
int | asInt () const |
bool | isBool () const |
bool | asBool () const |
bool | isLong () const |
int64_t | asLong () const |
const std::string & | getName () const |
Wrapper around an APIValue that can be given to or is received from an external environment. This object can not be copied or moved but the APIValue can be moved and copied. To access the managed APIValue use the get() or getCopy() methods. Use the other methods to translate this argument directly into more common types such as int, string, vector<T> etc.
APIArgument | ( | std::unique_ptr< APIBaseValue > | value | ) |
Arguments can only be constructed using a value
value | the value associated with this argument, owned by this object. |
|
default |
|
delete |
Copy is not allowed
std::vector< T > * asArray |
Returns the API value as a vector of value type T, nullptr if the argument isn't an array or value types don't match.
const std::vector< T > * asArray |
Returns the API value as a vector of value type T, nullptr if the argument isn't an array or value types don't match.
bool asBool | ( | ) | const |
uint8_t asByte | ( | ) | const |
char asChar | ( | ) | const |
double asDouble | ( | ) | const |
float asFloat | ( | ) | const |
int asInt | ( | ) | const |
int64_t asLong | ( | ) | const |
std::string asString | ( | ) | const |
T * get |
Returns the API value as a pointer of type T, where T is of type APIValue
const T * get |
Returns the API value as a pointer of type T, where T is of type APIValue
T getCopy |
const std::string& getName | ( | ) | const |
const APIBaseValue& getValue | ( | ) | const |
const rtti::TypeInfo getValueType | ( | ) | const |
Returns the actual type of the value managed by this argument: RTTI_OF(float), RTTI_OF(int) etc. Note that when this argument represents an array the return value is the value type contained by the array. For example, the return type of an array, say std::vector<float> is RTTI_OF(float).
bool isArray | ( | ) | const |
bool isBool | ( | ) | const |
bool isByte | ( | ) | const |
bool isChar | ( | ) | const |
bool isDouble | ( | ) | const |
bool isFloat | ( | ) | const |
bool isInt | ( | ) | const |
bool isLong | ( | ) | const |
bool isString | ( | ) | const |
|
delete |