![]() |
Qore reflection Module 1.14.0
|
The base class for Qore data types. More...
#include <QC_Type.dox.h>
Public Member Functions | |
auto | acceptsValue (auto value) |
Returns the value after any conversions by the type. | |
bool | canConvertToScalar () |
Returns True if values of this type can be converted to a scalar value. | |
constructor (string typestr) | |
Creates the type from the given string. | |
hash< string, bool > | getAcceptTypeHash (*bool simple) |
Returns a hash of types accepted by this type. | |
Type | getBaseType () |
Returns the base type for the current type; if the type is already a base type (i.e. not an "or nothing" type), then the same type is returned. | |
int | getBaseTypeCode () |
Returns the base type code for the type or Qore::NT_ALL for those that don't have types. | |
auto | getDefaultValue () |
Returns the default value for the type or NOTHING if the type has no default value. | |
*Type | getElementType () |
Returns the element type for complex list and hash types, if any, otherwise returns NOTHING. | |
Type | getMandatoryType () |
Returns the mandatory (i.e. not "or nothing") type for the current type. | |
string | getName () |
returns the type's name | |
Type | getOrNothingType () |
Returns the "or nothing" type for the current type; if the type is already an "or nothing" type (i.e. it already accepts NOTHING), then the same type is returned. | |
hash< string, bool > | getReturnTypeHash (*bool simple) |
Returns a hash of types returned by this type. | |
*TypedHash | getTypedHash () |
Returns the TypedHash for the type, if the type specifies a typed hash. | |
bool | hasDefaultValue () |
Returns True if this type has a default value. | |
bool | hasType () |
Returns True if the type is not a wildcard type; i.e. has type restrictions. | |
bool | isAssignableFrom (Type type, reference< bool > may_not_match) |
Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type. | |
bool | isAssignableFrom (Type type) |
Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type. | |
int | isAssignableFrom (auto value) |
Returns True if the Type object can be assigned from the value given as an argument. | |
bool | isCompatible (Type type) |
Returns True if the argument type is compatible with the current type (inputs and outputs) | |
bool | isEqual (Type type) |
Returns True if the Type object passed as an argument is equal to the current object; False if not. | |
bool | isOrNothingType () |
Returns True if the type accepts and returns NOTHING in addition to other values. | |
bool | isOutputCompatible (Type type) |
Returns True if the output of the Type object passed as an argument is compatible with the return type if the current Type. | |
bool | isTypedHash () |
Returns True if the type is a TypedHash type, False if not. | |
![]() |
Static Public Member Functions | |
static Type | getOrNothingType (auto v) |
Returns the "or nothing" type object for the value. | |
static Type | getType (auto v) |
Returns the type object for the value. | |
![]() |
auto Qore::Reflection::Type::acceptsValue | ( | auto | value | ) |
Returns the value after any conversions by the type.
value | the value to assign to the type |
RUNTIME-TYPE-ERROR | if the value cannot be assigned to the type |
bool Qore::Reflection::Type::canConvertToScalar | ( | ) |
Qore::Reflection::Type::constructor | ( | string | typestr | ) |
Creates the type from the given string.
string | the type string |
UNKNOWN-TYPE | cannot find the given type |
Type Qore::Reflection::Type::getBaseType | ( | ) |
Returns the base type for the current type; if the type is already a base type (i.e. not an "or nothing" type), then the same type is returned.
int Qore::Reflection::Type::getBaseTypeCode | ( | ) |
Returns the base type code for the type or Qore::NT_ALL for those that don't have types.
auto Qore::Reflection::Type::getDefaultValue | ( | ) |
*Type Qore::Reflection::Type::getElementType | ( | ) |
Type Qore::Reflection::Type::getMandatoryType | ( | ) |
Returns the mandatory (i.e. not "or nothing") type for the current type.
If the type is already an "or nothing" type (i.e. it already accepts NOTHING), then the same type is returned
string Qore::Reflection::Type::getName | ( | ) |
returns the type's name
Type Qore::Reflection::Type::getOrNothingType | ( | ) |
Returns the "or nothing" type for the current type; if the type is already an "or nothing" type (i.e. it already accepts NOTHING), then the same type is returned.
|
static |
Returns the "or nothing" type object for the value.
|
static |
Returns the type object for the value.
v | the value to return the type object for |
*TypedHash Qore::Reflection::Type::getTypedHash | ( | ) |
bool Qore::Reflection::Type::hasDefaultValue | ( | ) |
bool Qore::Reflection::Type::hasType | ( | ) |
int Qore::Reflection::Type::isAssignableFrom | ( | auto | value | ) |
Returns True if the Type object can be assigned from the value given as an argument.
value | the value to check |
bool Qore::Reflection::Type::isAssignableFrom | ( | Type | type | ) |
Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type.
type | the type to check output value compatibility with the current type |
bool Qore::Reflection::Type::isAssignableFrom | ( | Type | type, |
reference< bool > | may_not_match ) |
Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type.
type | the type to check output value compatibility with the current type |
may_not_match | an output variable, if True then the assignment is not guaranteed to succeed and may fail at runtime |
bool Qore::Reflection::Type::isCompatible | ( | Type | type | ) |
Returns True if the argument type is compatible with the current type (inputs and outputs)
type | the type to check compatibility with the current type |
bool Qore::Reflection::Type::isEqual | ( | Type | type | ) |
bool Qore::Reflection::Type::isOrNothingType | ( | ) |
bool Qore::Reflection::Type::isOutputCompatible | ( | Type | type | ) |
Returns True if the output of the Type object passed as an argument is compatible with the return type if the current Type.
type | the type to check output value compatibility with the current type |
bool Qore::Reflection::Type::isTypedHash | ( | ) |