| Qore DataProvider Module Reference 3.2.2

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DataProvider::AbstractDataField Class Reference

describes a data type based on a hashdecl More...

`#include <AbstractDataField.qc.dox.h>`

Inheritance diagram for DataProvider::AbstractDataField:
[legend]

## Public Member Functions
auto | acceptsValue (auto value)
| returns the value if the value can be assigned to the type
*hash< string, bool > | getAllowedValueMap ()
| Get allowed values.
*list< hash< AllowedValueInfo > > | getAllowedValues ()
| Get allowed values.
bool | getAllowedValuesCreatable ()
| Get the "allowed values creatable" flag.
*hash< auto > | getAttributes ()
| Returns custom attributes set on the field.
hash< DataFieldInfo > | getConfigInfo ()
| returns information about the field
auto | getDefaultValue ()
| get default value, if any
abstract *string | getDescription ()
| returns the description, if any
string | getDisplayName ()
| Returns the display name of the field.
*hash< string, bool > | getElementAllowedValueMap ()
| Get allowed values.
*list< hash< AllowedValueInfo > > | getElementAllowedValues ()
| Get element allowed values.
bool | getElementAllowedValuesCreatable ()
| Get the "element allowed values creatable" flag.
auto | getExampleValue (*hash< string, bool > emap, *string fname)
| Returns any example value for the field, otherwise return example data from the type.
hash< DataFieldInfo > | getInfo ()
| returns information about the field
hash< DataFieldInfo > | getInputInfo ()
| returns information about the field as an input field
hash< DataFieldInfo > | getLocalInfo ()
| Returns information about the field without calling AbstractDataProviderType::getInfo() on the type.
AbstractDataField | getMandatoryType ()
| Returns a mandatory (i.e. not "or nothing") field equivalent to the current field.
abstract string | getName ()
| returns the name of the field
*hash< auto > | getOptions ()
| returns options set on the field's type
auto | getOptionValue (string opt)
| returns the value of the given option on the field's type
AbstractDataField | getOrNothingType ()
| returns a field with an "or nothing" type equivalent to the current type
*string | getShortDescription ()
| Returns the short description, if any.
AbstractDataField | getSoftType ()
| returns a field with a "soft" type equivalent to the current type
*hash< string, hash< DataProviderTypeOptionInfo > > | getSupportedOptions ()
| returns supported options on the field's type
abstract AbstractDataProviderType | getType ()
| returns the type of the field
string | getTypeName ()
| returns the type name
bool | hasType ()
| returns True if the field's type is not a wildcard type
bool | isAssignableFrom (AbstractDataProviderType t)
| returns True if this field's type can be assigned from values of the argument type
bool | isAssignableFrom (Type t)
| returns True if this field's type can be assigned from values of the argument type
bool | isList ()
| returns True if this field's type is a list
bool | isMandatory ()
| returns True if the field's type must have a value
bool | isMultiselect ()
| Returns True if the type is a list and the allowed values are allowed values of the list's type.
| replaceAttributes (*hash< auto > attr)
| Replaces all custom attributes.
AbstractDataField | setAllowedValues (list< auto > allowed_values, *bool allowed_values_creatable)
| Sets allowed values for enum types.
AbstractDataField | setAttributes (hash< auto > attr)
| Sets custom attributes.
AbstractDataField | setDefaultValue (auto default_value)
| sets the default value for the field
AbstractDataField | setElementAllowedValues (list< auto > element_allowed_values, *bool element_allowed_values_creatable)
| Sets allowed values for enum types.
AbstractDataField | setOption (string opt, auto value)
| sets the given option on the field's type
AbstractDataField | setOptions (hash< auto > options)
| sets the given options on the field's type

## Static Public Member Functions
static string | getDisplayName (string name)
| Converts a technical name into a display name.
static string | getNameFromDisplayName (string display_name)
| Converts a display name into a technical name.
static *string | getShortDescription (*string desc, *int maxlen)
| Converts a long description into a short description.

## Protected Attributes
list< hash< AllowedValueInfo > > | allowed_values
| for enum fields; raw allowed values
*bool | allowed_values_creatable
| Does the field accept values not defined in allowed_values too?
hash< string, bool > | allowed_values_map
| for enum fields; allowed values
hash< auto > | attr
| User-defined custom attributes set on the field.
auto | default_value
| the default value for the field, if any
*list< hash< AllowedValueInfo > > | element_allowed_values
| for enum fields; allowed values for elements for list types
*bool | element_allowed_values_creatable
| Do elements of the field for list types accept values not defined in element_allowed_values too?
hash< string, bool > | element_allowed_values_map
| for enum fields; allowed values for elements for list types
bool | multiselect
| Are allowed values elements of the list's element type that indicate what values the list can have?

## Detailed Description

describes a data type based on a hashdecl

## Member Function Documentation

## ◆ acceptsValue()

auto DataProvider::AbstractDataField::acceptsValue | ( | auto | value | ) |

returns the value if the value can be assigned to the type

Parameters

  value | the value to assign to the type

Returns
  the value to be assigned; can be converted by the type

## ◆ getExampleValue()

auto DataProvider::AbstractDataField::getExampleValue | ( | *hash< string, bool > | emap,
|  | *string | fname )

Returns any example value for the field, otherwise return example data from the type.

Parameters

  emap | a hash to ensure that examples are only produced once
  fname | any field context for the value

Returns
  if a default value exists, it is returned first, then the example value for the type, if any

Since
  DataProvider 3.0

## ◆ getInputInfo()

hash< DataFieldInfo > DataProvider::AbstractDataField::getInputInfo | ( |  | ) |

returns information about the field as an input field

the `default_value` and \example_value keys are not returned, and the `type` key returns only input information

## ◆ getMandatoryType()

AbstractDataField DataProvider::AbstractDataField::getMandatoryType | ( |  | ) |

Returns a mandatory (i.e. not "or nothing") field equivalent to the current field.

The base class method returns the same type; this method must be overridden in child classes to return a usable mandatory field

Returns
  a mandatory (i.e. not "or nothing") field equivalent to the current field

Since
  DataProvider 3.0

## ◆ getOrNothingType()

AbstractDataField DataProvider::AbstractDataField::getOrNothingType | ( |  | ) |

returns a field with an "or nothing" type equivalent to the current type

The base class method returns the same field; this method must be overridden in child classes to return a field with a usable "or nothing" type

Returns
  a field with an "or nothing" type equivalent to the current type

## ◆ getSoftType()

AbstractDataField DataProvider::AbstractDataField::getSoftType | ( |  | ) |

returns a field with a "soft" type equivalent to the current type

The base class method returns the same field; this method must be overridden in child classes to return a field with a usable "soft" type

Returns
  a field with a "soft" type equivalent to the current type

## ◆ setOption()

AbstractDataField DataProvider::AbstractDataField::setOption | ( | string | opt,
|  | auto | value )

sets the given option on the field's type

Parameters

  opt | the option to set
  value | the value to set

Exceptions

  TYPE-OPTION-ERROR | invalid option or invalid option type

## ◆ setOptions()

AbstractDataField DataProvider::AbstractDataField::setOptions | ( | hash< auto > | options | ) |

sets the given options on the field's type

Parameters

  options | a hash of options, if any options match supported options for this type, they are set

Exceptions

  TYPE-OPTION-ERROR | option value has an invalid type

## Member Data Documentation

## ◆ allowed_values_map

hash<string, bool> DataProvider::AbstractDataField::allowed_values_map
| protected

for enum fields; allowed values

only supported for types that convert to a string

## ◆ element_allowed_values_map

hash<string, bool> DataProvider::AbstractDataField::element_allowed_values_map
| protected

for enum fields; allowed values for elements for list types

only supported for types that convert to a string