Qore DataProvider Module Reference 3.1
Loading...
Searching...
No Matches
DataProvider::AbstractDataProviderType Class Reference

describes a data type More...

#include <AbstractDataProviderType.qc.dox.h>

Inheritance diagram for DataProvider::AbstractDataProviderType:
[legend]

Public Member Functions

abstract auto acceptsValue (auto value)
 Returns the value if the value can be assigned to the type.
 
 clearPath ()
 Clears the type path for the type.
 
 constructor ()
 creates the type
 
 constructor (*hash< auto > options, hash< auto > tags, *string path)
 creates the type and sets options
 
 constructor (hash< auto > options, *hash< auto > tags, *string path)
 creates the type and sets options
 
 constructor (string path)
 creates the type
 
abstract hash< string, bool > getAcceptTypeHash (*bool simple)
 Returns a hash of types accepted by this type; keys are type names.
 
int getBaseTypeCode ()
 Returns the base type code for the type.
 
string getBaseTypeName ()
 Returns the base type name for the type; must be a standard Qore base type name.
 
auto getDefaultValue ()
 
string getDesc ()
 Returns the description.
 
*hash< string, bool > getDirectTypeHash ()
 Returns a hash of native base type code keys where no translations are performed; keys are type codes, not names.
 
string getDisplayName ()
 Returns the type's display name.
 
abstract *AbstractDataProviderType getElementType ()
 Returns the subtype (for lists or hashes) if there is only one.
 
auto getExampleValue (*hash< string, bool > emap, *string fname)
 Returns any example value for type, if any.
 
*AbstractDataField getField (string field_name)
 Returns the given field, if present, or nothing if not.
 
*hash< string, hash< DataFieldInfo > > getFieldInfo ()
 Returns information on fields supported.
 
abstract *hash< string, AbstractDataFieldgetFields ()
 Returns the fields of the data structure; if any.
 
*AbstractDataProviderType getFieldType (string field_name)
 get the given field type if it exists, otherwise return nothing
 
hash< DataTypeInfogetInfo (*bool simple)
 Returns a description of the type as a hash.
 
hash< DataTypeInfogetInputInfo (*bool simple)
 Returns a description of the type as an input type.
 
AbstractDataProviderType getMandatoryType ()
 Returns a mandatory (i.e. not "or nothing") type equivalent to the current type.
 
abstract string getName ()
 Returns the type name.
 
*hash< auto > getOptions ()
 Returns options set on the type.
 
auto getOptionValue (string opt)
 Returns the value of the given option.
 
AbstractDataProviderType getOrNothingType ()
 Returns an "or nothing" type equivalent to the current type.
 
*string getPath ()
 Returns the type path in the type cache, if any.
 
*hash< auto > getPublicOptions ()
 Returns options with the publish flag set on the type.
 
abstract hash< string, bool > getReturnTypeHash (*bool simple)
 Returns a hash of types returned by this type; keys are type names.
 
string getShortDescription ()
 Returns the type's short description.
 
AbstractDataProviderType getSoftType ()
 Returns a "soft" type equivalent to the current type.
 
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions ()
 Returns supported options.
 
auto getTag (string tag)
 Returns the value of the given tag.
 
*hash< auto > getTags ()
 Returns tags set on the type.
 
abstract *Type getValueType ()
 Returns the base type for the type, if any.
 
bool hasDefaultValue ()
 ! Returns True if this type has a default value
 
bool hasType ()
 Returns True if the type is not a wildcard type.
 
bool isAssignableFrom (AbstractDataProviderType t)
 Returns True if this type can be assigned from values of the argument type.
 
bool isAssignableFrom (Type t)
 Returns True if this type can be assigned from values of the argument type.
 
bool isList ()
 Returns True if this type is a list.
 
bool isMandatory ()
 Returns True if the type must have a value.
 
bool isOrNothingType ()
 Returns True if the type also accepts nothing.
 
 setDynamicTag ()
 Sets the dynamic tag on the type.
 
 setOption (string opt, auto value)
 sets the given option on the type
 
 setOptions (hash< auto > options)
 sets options on the type
 
 setPath (string path)
 Sets the type path for the type.
 

Static Public Member Functions

static AbstractDataProviderType get (hash< DataTypeInfo > info)
 Returns an appropriate object for the given type description.
 
static AbstractDataProviderType get (string typename, *hash< auto > options)
 Returns an appropriate object for the given type.
 
static AbstractDataProviderType get (Type type, *hash< auto > options, *hash< auto > tags, auto default_value, *hash< NameDescInfo > attr)
 Returns an appropriate object for the given type.
 

Public Attributes

const DefaultDesc = "no description available"
 Default description.
 

Protected Member Functions

 setOptionIntern (string opt, auto value)
 sets the given option without any validation of the option
 

Protected Attributes

hash< auto > options
 type options
 
*string path
 The type path, if any.
 
*hash< auto > tags
 type tags
 

Detailed Description

describes a data type

Member Function Documentation

◆ acceptsValue()

abstract auto DataProvider::AbstractDataProviderType::acceptsValue ( auto value)

Returns the value if the value can be assigned to the type.

Parameters
valuethe value to assign to the type
Returns
the value to be assigned; can be converted by the type

◆ clearPath()

DataProvider::AbstractDataProviderType::clearPath ( )

Clears the type path for the type.

Since
DataProvider 3.0

◆ constructor() [1/2]

DataProvider::AbstractDataProviderType::constructor ( *hash< auto > options,
hash< auto > tags,
*string path )

creates the type and sets options

Parameters
optionsa hash of options, if any options match supported options for this type, they are set
tagsany user-defined tags to set on the type
paththe registered type path, if any
Exceptions
TYPE-OPTION-ERRORoption value has an invalid type

◆ constructor() [2/2]

DataProvider::AbstractDataProviderType::constructor ( hash< auto > options,
*hash< auto > tags,
*string path )

creates the type and sets options

Parameters
optionsa hash of options, if any options match supported options for this type, they are set
tagsany user-defined tags to set on the type
paththe registered type path, if any
Exceptions
TYPE-OPTION-ERRORoption value has an invalid type

◆ get() [1/2]

static AbstractDataProviderType DataProvider::AbstractDataProviderType::get ( hash< DataTypeInfo > info)
static

Returns an appropriate object for the given type description.

Parameters
infothe description of the type

◆ get() [2/2]

static AbstractDataProviderType DataProvider::AbstractDataProviderType::get ( string typename,
*hash< auto > options )
static

Returns an appropriate object for the given type.

Parameters
typenamethe name of the type; should be a valid Qore type string
optionstype options for the data type object

◆ getDefaultValue()

auto DataProvider::AbstractDataProviderType::getDefaultValue ( )
Example:
auto v = t.getDefaultValue();
Returns
the default value for the type or nothing if the type has no default value
Note
The base class method always returns NOTHING
Since
DataProvider 3.0

◆ getDisplayName()

string DataProvider::AbstractDataProviderType::getDisplayName ( )

Returns the type's display name.

Returns
the type's display name
Since
DataProvider 3.0

◆ getExampleValue()

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

Returns any example value for type, if any.

Parameters
emapa hash to ensure that examples are only produced once
fnameany field context for the value
Since
DataProvider 3.0

◆ getInputInfo()

hash< DataTypeInfo > DataProvider::AbstractDataProviderType::getInputInfo ( *bool simple)

Returns a description of the type as an input type.

Returns
a description of the type as an input type; only the following keys are returned
  • name
  • types_returned
  • fields
  • base_type

◆ getMandatoryType()

AbstractDataProviderType DataProvider::AbstractDataProviderType::getMandatoryType ( )

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

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

Returns
a mandatory (i.e. not "or nothing") type equivalent to the current type
Since
DataProvider 3.0

◆ getOrNothingType()

AbstractDataProviderType DataProvider::AbstractDataProviderType::getOrNothingType ( )

Returns an "or nothing" type equivalent to the current type.

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

Returns
an "or nothing" type equivalent to the current type
Note
recursively updates fields to "or nothing" types as well

◆ getPath()

*string DataProvider::AbstractDataProviderType::getPath ( )

Returns the type path in the type cache, if any.

Since
DataProvider 3.0

◆ getPublicOptions()

*hash< auto > DataProvider::AbstractDataProviderType::getPublicOptions ( )

Returns options with the publish flag set on the type.

Since
DataProvider 3.0

◆ getShortDescription()

string DataProvider::AbstractDataProviderType::getShortDescription ( )

Returns the type's short description.

Returns
the plain-text short description for the type
Since
DataProvider 3.0

◆ getSoftType()

AbstractDataProviderType DataProvider::AbstractDataProviderType::getSoftType ( )

Returns a "soft" type equivalent to the current type.

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

Returns
a "soft" type equivalent to the current type

◆ hasDefaultValue()

bool DataProvider::AbstractDataProviderType::hasDefaultValue ( )

! Returns True if this type has a default value

Example:
bool b = t.hasDefaultValue();
Returns
True if this type has a default value
Note
The base class method always returns False
Since
DataProvider 3.0

◆ setOption()

DataProvider::AbstractDataProviderType::setOption ( string opt,
auto value )

sets the given option on the type

Parameters
optthe option to set
valuethe value to set
Exceptions
TYPE-OPTION-ERRORinvalid option or invalid option type

◆ setOptions()

DataProvider::AbstractDataProviderType::setOptions ( hash< auto > options)

sets options on the type

Parameters
optionsthe options to set; unsupported options are ignored
Exceptions
TYPE-OPTION-ERRORinvalid option type

◆ setPath()

DataProvider::AbstractDataProviderType::setPath ( string path)

Sets the type path for the type.

Since
DataProvider 3.0