open_iA 2025.6
Loading...
Searching...
No Matches
iAAttributes.h File Reference
#include "iabase_export.h"
#include "iAAttributeDescriptor.h"
#include <QVector>
#include <memory>

Typedefs

using iAAttributes = QVector<std::shared_ptr<iAAttributeDescriptor>>
 List of descriptors for e.g. parameter values.
 

Functions

iAbase_API void addAttr (iAAttributes &attributes, QString const &name, iAValueType valueType, QVariant defaultValue=0.0, double min=std::numeric_limits< double >::lowest(), double max=std::numeric_limits< double >::max())
 Add a new attribute specified by the parameters to the given attributes list.
 
iAbase_API bool attributeCheck (iAAttributeDescriptor const &param, QVariant const &paramValue)
 the default check for a single parameter descriptor & value combination
 
iAbase_API bool checkAttributes (iAAttributes const &attributes, QVariantMap const &values, QStringList *invalidValues=nullptr)
 Check whether the given parameters values are valid; for example, for numeric parameters it checks whether they are within the given limits, for categorical whether the value is one of the given list of possible values etc.
 
iAbase_API iAAttributes cloneAttributes (iAAttributes const &attributes)
 Clone the given list of attributes and return the copy.
 
iAbase_API iAAttributes combineAttributesWithValues (iAAttributes const &attributes, QVariantMap const &values)
 Merge the given values into the descriptors (returns new descriptors with the given values as default values)
 
iAbase_API int countAttributes (iAAttributes const &attributes, iAAttributeDescriptor::iAAttributeType type=iAAttributeDescriptor::None)
 Count the attribute descriptors of the given type in the given collection.
 
iAbase_API std::shared_ptr< iAAttributescreateAttributes (QTextStream &in)
 Create a descriptor from a given text stream.
 
iAbase_API QVariantMap extractValues (iAAttributes const &attributes)
 Extract just the (default) values from the given descriptors into a map.
 
iAbase_API int findAttribute (iAAttributes const &attributes, QString const &name)
 Find a descriptor with the given name and return its index.
 
iAbase_API QVariant getValue (iAAttributes const &attributes, QString const &name)
 Get the default value of the descriptor with the given name.
 
iAbase_API bool isAttributeEnabled (iAAttributeDescriptor const &param, QVariantMap const &values)
 check whether an attribute is enabled, given its dependency specifications and collection of parameter values
 
iAbase_API QVariantMap joinValues (QVariantMap const &baseValues, QVariantMap const &newValues)
 Merge the values from newValues and baseValues into a new map.
 
iAbase_API void loadAttributeValues (QDomNamedNodeMap const &xml, iAAttributes &attributes)
 load attributes from XML
 
iAbase_API void removeAttribute (iAAttributes &attributes, QString const &name)
 Removes the attribute with the given name.
 
iAbase_API void setApplyingValues (QVariantMap &outMap, iAAttributes const &attributes, QVariantMap const &inMap)
 In a given key/value map outMap, set values from another map inMap, for all keys that exist in the given attributes and the inMap.
 
iAbase_API void setDefaultValues (iAAttributes &attributes, QVariantMap const &values)
 Merge the given values into the descriptors (modifying the given ones in place, in contrast to combineAttributesWithValues, which creates a new list)
 
iAbase_API void setDependencies (iAAttributes &attributes, QString const &name, QStringList const &dependencies)
 set attribute with name to depend on the list of attributes in dependencies (i.e.
 
iAbase_API void setDependency (iAAttributes &attributes, QString const &name, QString const &dependency)
 set attribute with name to depend on a single other attribute;
 
iAbase_API void storeAttributes (QTextStream &out, iAAttributes const &attributes)
 Store the given descriptors in the given text stream.
 
iAbase_API void storeAttributeValues (QDomElement &xml, iAAttributes const &attributes)
 store attributes to XML
 

Typedef Documentation

◆ iAAttributes

using iAAttributes = QVector<std::shared_ptr<iAAttributeDescriptor>>

List of descriptors for e.g. parameter values.

Function Documentation

◆ addAttr()

iAbase_API void addAttr ( iAAttributes & attributes,
QString const & name,
iAValueType valueType,
QVariant defaultValue = 0.0,
double min = std::numeric_limits< double >::lowest(),
double max = std::numeric_limits< double >::max() )

Add a new attribute specified by the parameters to the given attributes list.

◆ attributeCheck()

iAbase_API bool attributeCheck ( iAAttributeDescriptor const & param,
QVariant const & paramValue )

the default check for a single parameter descriptor & value combination

◆ checkAttributes()

iAbase_API bool checkAttributes ( iAAttributes const & attributes,
QVariantMap const & values,
QStringList * invalidValues = nullptr )

Check whether the given parameters values are valid; for example, for numeric parameters it checks whether they are within the given limits, for categorical whether the value is one of the given list of possible values etc.

Parameters
attributesa list of attribute specifications
valuesvalues for the attributes, to be checked whether they are valid
invalidValuesif given (!= nullptr), after the call it contains a list of the names of all parameters with invalid values
Returns
true if the given values are valid given the attribute specifications, false otherwise

◆ cloneAttributes()

iAbase_API iAAttributes cloneAttributes ( iAAttributes const & attributes)

Clone the given list of attributes and return the copy.

◆ combineAttributesWithValues()

iAbase_API iAAttributes combineAttributesWithValues ( iAAttributes const & attributes,
QVariantMap const & values )

Merge the given values into the descriptors (returns new descriptors with the given values as default values)

◆ countAttributes()

iAbase_API int countAttributes ( iAAttributes const & attributes,
iAAttributeDescriptor::iAAttributeType type = iAAttributeDescriptor::None )

Count the attribute descriptors of the given type in the given collection.

◆ createAttributes()

iAbase_API std::shared_ptr< iAAttributes > createAttributes ( QTextStream & in)

Create a descriptor from a given text stream.

◆ extractValues()

iAbase_API QVariantMap extractValues ( iAAttributes const & attributes)

Extract just the (default) values from the given descriptors into a map.

◆ findAttribute()

iAbase_API int findAttribute ( iAAttributes const & attributes,
QString const & name )

Find a descriptor with the given name and return its index.

◆ getValue()

iAbase_API QVariant getValue ( iAAttributes const & attributes,
QString const & name )

Get the default value of the descriptor with the given name.

◆ isAttributeEnabled()

iAbase_API bool isAttributeEnabled ( iAAttributeDescriptor const & param,
QVariantMap const & values )

check whether an attribute is enabled, given its dependency specifications and collection of parameter values

◆ joinValues()

iAbase_API QVariantMap joinValues ( QVariantMap const & baseValues,
QVariantMap const & newValues )

Merge the values from newValues and baseValues into a new map.

Creates and returns a map that contains key/value pairs from both given maps; values that exist in both get assigned the value from newValues

Parameters
[in]baseValuesused to initialize the resulting map
[in]newValuesall key/value pairs in this map are added to the result, overwriting ones that might already be present from baseValues

◆ loadAttributeValues()

iAbase_API void loadAttributeValues ( QDomNamedNodeMap const & xml,
iAAttributes & attributes )

load attributes from XML

◆ removeAttribute()

iAbase_API void removeAttribute ( iAAttributes & attributes,
QString const & name )

Removes the attribute with the given name.

◆ setApplyingValues()

iAbase_API void setApplyingValues ( QVariantMap & outMap,
iAAttributes const & attributes,
QVariantMap const & inMap )

In a given key/value map outMap, set values from another map inMap, for all keys that exist in the given attributes and the inMap.

Parameters
[out]outMapthe key/value map that is modified (note that this map isn't emptied before; so all key/value pairs that were already contained in there, and are not in both attributes and inMap, will remain unchanged.
[in]attributeslist of possible attributes - only keys of outMap which have a corresponding entry in here will be set
[in]inMapthe map of key/values used as input; any values existing in this map AND in attributes, will be set in outMap

◆ setDefaultValues()

iAbase_API void setDefaultValues ( iAAttributes & attributes,
QVariantMap const & values )

Merge the given values into the descriptors (modifying the given ones in place, in contrast to combineAttributesWithValues, which creates a new list)

◆ setDependencies()

iAbase_API void setDependencies ( iAAttributes & attributes,
QString const & name,
QStringList const & dependencies )

set attribute with name to depend on the list of attributes in dependencies (i.e.

attribute name is only effective if dependencies are set - currently only boolean dependencies are supported!)

◆ setDependency()

iAbase_API void setDependency ( iAAttributes & attributes,
QString const & name,
QString const & dependency )

set attribute with name to depend on a single other attribute;

See also
setDependencies for more details

◆ storeAttributes()

iAbase_API void storeAttributes ( QTextStream & out,
iAAttributes const & attributes )

Store the given descriptors in the given text stream.

◆ storeAttributeValues()

iAbase_API void storeAttributeValues ( QDomElement & xml,
iAAttributes const & attributes )

store attributes to XML