HxmField Class

class HxmField

An HxmField represents a field belonging to a modeler class. It can be used to get or set the value of a field on objects of the associated class.

Unlike properties, fields are always readable and writable. Furthermore, modifying or reading a field has no side-effects other than changing a value.

HxmFields are not modeler objects: they are merely descriptions that tell the modeler how to modify the fields of a class. They cannot be transformed into modeler values.

Since:

13.0

Summary

Functions

getValue

Returns the value of this field associated with the object given as parameter.

getInt

Returns the value of this field associated with the object given as parameter as an integer.

getDouble

Returns the value of this field associated with the object given as parameter as a double.

getBool

Returns the value of this field associated with the object given as parameter as a boolean.

getExpression

Returns the value of this field associated with the object given as parameter as an expression.

getString

Returns the value of this field associated with the object given as parameter as a string.

getModule

Returns the value of this field associated with the object given as parameter as a module.

getMap

Returns the value of this field associated with the object given as parameter as a map.

getFunction

Returns the value of this field associated with the object given as parameter as a function.

getClass

Returns the value of this field associated with the object given as parameter as a class.

setValue

Sets the value of this field for the object given as parameter.

setInt

Sets the value of this field for the object given as parameter.

setDouble

Sets the value of this field for the object given as parameter.

setBool

Sets the value of this field for the object given as parameter.

setExpression

Sets the value of this field for the object given as parameter.

setString

Sets the value of this field for the object given as parameter.

setModule

Sets the value of this field for the object given as parameter.

setMap

Sets the value of this field for the object given as parameter.

setFunction

Sets the value of this field for the object given as parameter.

setClass

Sets the value of this field for the object given as parameter.

Functions

HxmValue HxmField::getValue(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxmValue

long HxmField::getInt(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as an integer. An exception will be thrown if the returned value is not an integer. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

double HxmField::getDouble(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a double. An exception will be thrown if the returned value is not a double. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

bool HxmField::getBool(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a boolean. An exception will be thrown if the returned value is not a boolean. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

HxExpression HxmField::getExpression(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as an expression. An exception will be thrown if the returned value is not an expression. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxExpression

string HxmField::getString(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a string. An exception will be thrown if the returned value is not a string. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

HxmModule HxmField::getModule(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a module. An exception will be thrown if the returned value is not a module. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxmModule

HxmMap HxmField::getMap(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a map. An exception will be thrown if the returned value is not a map. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxmMap

HxmFunction HxmField::getFunction(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a function. An exception will be thrown if the returned value is not a function. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxmFunction

HxmClass HxmField::getClass(const HxmValue &obj) const

Returns the value of this field associated with the object given as parameter as a class. An exception will be thrown if the returned value is not a class. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:

obj – The object on which to retrieve the field value.

Returns:

Value of the field on the given object.

See:

HxmClass

void HxmField::setValue(HxmValue &obj, const HxmValue &value)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • value – New value of the field.

void HxmField::setInt(HxmValue &obj, long value)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • value – New value of the field.

void HxmField::setDouble(HxmValue &obj, double value)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • value – New value of the field.

void HxmField::setBool(HxmValue &obj, bool value)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • value – New value of the field.

void HxmField::setExpression(HxmValue &obj, const HxExpression &expression)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • expression – New value of the field.

See:

HxExpression

void HxmField::setString(HxmValue &obj, const std::string &value)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • value – New value of the field.

void HxmField::setModule(HxmValue &obj, const HxmModule &module)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • module – New value of the field.

See:

HxmModule

void HxmField::setMap(HxmValue &obj, const HxmMap &map)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • map – New value of the field.

See:

HxmMap

void HxmField::setFunction(HxmValue &obj, const HxmFunction &function)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • function – New value of the field.

See:

HxmFunction

void HxmField::setClass(HxmValue &obj, const HxmClass &clazz)

Sets the value of this field for the object given as parameter. The object passed as parameter must be an instance of the class to which this field belongs.

Parameters:
  • obj – Object on which to change the field value.

  • clazz – New value of the field.

See:

HxmClass