Qore reflection Module  0.9.1
Qore::Reflection::Type Class Reference

The abstract base class for Qore data types. More...

Public Member Methods

bool canConvertToScalar ()
 Returns True if values of this type can be converted to a scalar value. More...
 
 constructor ()
 Throws an exception if called directly; this class can only be instantiated by builtin subclasses. More...
 
auto getDefaultValue ()
 Returns the default value for the type or NOTHING if the type has no default value. More...
 
string getName ()
 returns the type's name More...
 
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. More...
 
bool hasDefaultValue ()
 Returns True if this type has a default value. More...
 
bool isEqual (Type type)
 Returns True if the Type object passed as an argument is equal to the current object; False if not. More...
 
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. More...
 

Static Public Member Methods

static Type getOrNothingType (auto v)
 Returns the "or nothing" type object for the value. More...
 
static Type getType (auto v)
 Returns the type object for the value. More...
 

Detailed Description

The abstract base class for Qore data types.

Restrictions:
Qore::PO_NO_REFLECTION

This class cannot be instantiated directly and also cannot be directly inherited by user-defined classes.

Since
Qore 0.9.0

Member Function Documentation

◆ canConvertToScalar()

bool Qore::Reflection::Type::canConvertToScalar ( )

Returns True if values of this type can be converted to a scalar value.

Code Flags:
CONSTANT
Example:
bool b = t.canConvertToScalar();
Returns
True if the output of the Type object passed as an argument is compatible with the return type if the current Type

◆ constructor()

Qore::Reflection::Type::constructor ( )

Throws an exception if called directly; this class can only be instantiated by builtin subclasses.

Exceptions
TYPE-CONSTRUCTOR-ERRORthis exception is thrown if this class is constructed directly (also if directly inherited by user classes)

◆ getDefaultValue()

auto Qore::Reflection::Type::getDefaultValue ( )

Returns the default value for the type or NOTHING if the type has no default value.

Code Flags:
CONSTANT
Example:
auto v = t.getDefaultValue();
Returns
the default value for the type or NOTHING if the type has no default value

◆ getName()

string Qore::Reflection::Type::getName ( )

returns the type's name

Code Flags:
RET_VALUE_ONLY
Example:
string name = t.getName();
Returns
the type's name

◆ getOrNothingType() [1/2]

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.

Code Flags:
CONSTANT
Example:
auto v = t.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

◆ getOrNothingType() [2/2]

static Type Qore::Reflection::Type::getOrNothingType ( auto  v)
static

Returns the "or nothing" type object for the value.

Code Flags:
CONSTANT
Example:
Type t = Type::getOrNothingType(v);
Returns
the "or nothing" type object for the value

◆ getType()

static Type Qore::Reflection::Type::getType ( auto  v)
static

Returns the type object for the value.

Code Flags:
CONSTANT
Example:
Type t = Type::getType(v);
Parameters
vthe value to return the type object for
Returns
the type object for the value

◆ hasDefaultValue()

bool Qore::Reflection::Type::hasDefaultValue ( )

Returns True if this type has a default value.

Code Flags:
CONSTANT
Example:
bool b = t.canConvertToScalar();
Returns
True if this type has a default value

◆ isEqual()

bool Qore::Reflection::Type::isEqual ( Type  type)

Returns True if the Type object passed as an argument is equal to the current object; False if not.

Code Flags:
CONSTANT
Example:
bool b = t1.isEqual(t2);
Parameters
typethe type to check with the current type for equality
Returns
True if the Type object passed as an argument is equal to the current object; False if not

◆ isOutputCompatible()

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.

Code Flags:
CONSTANT
Example:
bool b = t1.isOutputCompatible(t2);
Parameters
typethe type to check output value compatibility with the current type
Returns
True if the output of the Type object passed as an argument is compatible with the return type if the current Type

The documentation for this class was generated from the following file: