Qore DataProvider Module Reference 3.0
All Classes Namespaces Functions Variables Modules Pages
DataProvider::QoreDataField Class Reference

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

#include <QoreDataField.qc.dox.h>

Inheritance diagram for DataProvider::QoreDataField:
[legend]

Public Member Methods

 appendDescription (string separator, string new_desc)
 adds a string to the description
 
 constructor (hash< auto > h)
 creates the field from the argument
 
 constructor (Qore::Reflection::TypedHashMember mem)
 creates the field from the argument
 
 constructor (string name, *string desc, AbstractDataProviderType type, auto default_value, *softlist< auto > allowed_values, *bool multiselect, *bool allowed_values_creatable)
 creates the field from the arguments
 
 constructor (string name, *string desc, Type type, auto default_value, *softlist< auto > allowed_values, *bool multiselect, *bool allowed_values_creatable)
 creates the field from the arguments
 
hash< DataFieldInfogetConfigInfo ()
 returns information about the field
 
*string getDescription ()
 returns the description, if any
 
string getDisplayName ()
 Returns the display name of the field.
 
auto getExampleValue (*hash< string, bool > emap, *string fname)
 Returns any example value for the field, if present.
 
AbstractDataField getMandatoryType ()
 Returns a mandatory (i.e. not "or nothing") field equivalent to the current field.
 
string getName ()
 returns the name of the field
 
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
 
AbstractDataProviderType getType ()
 returns the type of the field
 
AbstractDataField updateFieldType (AbstractDataProviderType type)
 Updates the field type.
 
- Public Member Methods inherited from DataProvider::AbstractDataField
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< DataFieldInfogetConfigInfo ()
 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< DataFieldInfogetInfo ()
 returns information about the field
 
hash< DataFieldInfogetInputInfo ()
 returns information about the field as an input field
 
hash< DataFieldInfogetLocalInfo ()
 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
 

Private Member Methods

AbstractDataField getNewFieldType (AbstractDataProviderType new_type)
 returns a field with the new type
 

Static Private Member Methods

static checkHash (bool required, hash< auto > h,...)
 Checks for hash values in a hash.
 
static checkString (bool required, hash< auto > h,...)
 Checks for string values in a hash.
 

Private Attributes

*string desc
 description of the field
 
string display_name
 Display name of the field.
 
auto example_value
 Example value for the field.
 
string name
 Name of the field.
 
*string short_desc
 Short description of the field.
 
AbstractDataProviderType type
 field type
 
- Private Attributes inherited from DataProvider::AbstractDataField
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?
 

Additional Inherited Members

- Static Public Member Methods inherited from DataProvider::AbstractDataField
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.
 

Detailed Description

describes a data type based on a hashdecl

Member Function Documentation

◆ appendDescription()

DataProvider::QoreDataField::appendDescription ( string  separator,
string  new_desc 
)

adds a string to the description

Parameters
separatorstring to add first if there is already a description
new_descthe new string to add to the description

◆ getExampleValue()

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

Returns any example value for the field, if present.

Parameters
emapa hash to ensure that examples are only produced once
fnameany field context for the value
Returns
any example value for the field, otherwise the default value for the field, otherwise the example value for the type
Since
DataProvider 3.0

◆ getMandatoryType()

AbstractDataField DataProvider::QoreDataField::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

◆ getNewFieldType()

AbstractDataField DataProvider::QoreDataField::getNewFieldType ( AbstractDataProviderType  new_type)
private

returns a field with the new type

Returns
a field with the new type

◆ getOrNothingType()

AbstractDataField DataProvider::QoreDataField::getOrNothingType ( )

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

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

◆ getSoftType()

AbstractDataField DataProvider::QoreDataField::getSoftType ( )

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

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