CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
ctkAttributeDefinition Struct Referenceabstract

#include <Libs/PluginFramework/service/metatype/ctkAttributeDefinition.h>

Classes

struct  Password
 

Public Types

typedef QVariant::Type Type
 

Public Member Functions

virtual int getCardinality () const =0
 
virtual QStringList getDefaultValue () const =0
 
virtual QString getDescription () const =0
 
virtual QString getID () const =0
 
virtual QString getName () const =0
 
virtual QStringList getOptionLabels () const =0
 
virtual QStringList getOptionValues () const =0
 
virtual int getType () const =0
 
virtual QString validate (const QString &value) const =0
 
virtual ~ctkAttributeDefinition ()
 

Static Public Attributes

static const int PASSWORD
 

Detailed Description

An interface to describe an attribute.

An ctkAttributeDefinition object defines a description of the data type of a property/attribute.

Definition at line 42 of file ctkAttributeDefinition.h.

Member Typedef Documentation

◆ Type

typedef QVariant::Type ctkAttributeDefinition::Type

Definition at line 44 of file ctkAttributeDefinition.h.

Constructor & Destructor Documentation

◆ ~ctkAttributeDefinition()

virtual ctkAttributeDefinition::~ctkAttributeDefinition ( )
inlinevirtual

Definition at line 63 of file ctkAttributeDefinition.h.

Member Function Documentation

◆ getCardinality()

virtual int ctkAttributeDefinition::getCardinality ( ) const
pure virtual

Return the cardinality of this attribute.

The CTK Plugin environment handles multi valued attributes in QList objects. The return value is defined as follows:


   x = -1     no limit, store in QList
   x > 0   x = max occurrences, store in QList
   x = 0      1 occurrence required

Returns
The cardinality of this attribute.

◆ getDefaultValue()

virtual QStringList ctkAttributeDefinition::getDefaultValue ( ) const
pure virtual

Return a default for this attribute.

The object must be of the appropriate type as defined by the cardinality and getType(). The return type is a QStringList object whose entries can be converted to the appropriate type. The cardinality of the return list must follow the absolute cardinality of this type. E.g. if the cardinality = 0, the list must contain 1 element. If the cardinality is 1, it must contain 0 or 1 elements. Note that the special case of a 0 cardinality, meaning a single value, does not allow lists of 0 elements, except for signalling that no default exists.

Returns
Return a default value or an empty list if no default exists.

◆ getDescription()

virtual QString ctkAttributeDefinition::getDescription ( ) const
pure virtual

Return a description of this attribute.

The description may be localized and must describe the semantics of this type and any constraints.

Returns
The localized description of the definition.

◆ getID()

virtual QString ctkAttributeDefinition::getID ( ) const
pure virtual

Unique identity for this attribute.

Attributes share a global namespace in the registry. E.g. an attribute cn or commonName must always be a QString and the semantics are always a name of some object. They share this aspect with LDAP/X.500 attributes. In these standards the OSI Object Identifier (OID) is used to uniquely identify an attribute. If such an OID exists, (which can be requested at several standard organisations and many companies already have a node in the tree) it can be returned here. Otherwise, a unique id should be returned which can be a class name combined witha a reverse domain name or generated with a GUID algorithm. Note that all LDAP defined attributes already have an OID. It is strongly advised to define the attributes from existing LDAP schemes which will give the OID. Many such schemes exist ranging from postal addresses to DHCP parameters.

Returns
The id or oid

◆ getName()

virtual QString ctkAttributeDefinition::getName ( ) const
pure virtual

Get the name of the attribute. This name may be localized.

Returns
The localized name of the definition.

◆ getOptionLabels()

virtual QStringList ctkAttributeDefinition::getOptionLabels ( ) const
pure virtual

Return a list of labels of option values.

The purpose of this method is to allow menus with localized labels. It is associated with getOptionValues. The labels returned here are ordered in the same way as the values in that method.

If the function returns an empty list, there are no option labels available.

This list must be in the same sequence as the getOptionValues() method. I.e. for each index i in getOptionLabels, i in getOptionValues() should be the associated value.

Returns
A list values

◆ getOptionValues()

virtual QStringList ctkAttributeDefinition::getOptionValues ( ) const
pure virtual

Return a list of option values that this attribute can take.

If the function returns an empty QList, there are no option values available.

Each value must be acceptable to validate() (return "") and must be a QString object that can be converted to the data type defined by getType() for this attribute.

This list must be in the same sequence as getOptionLabels(). I.e. for each index i in getOptionValues, i in getOptionLabels() should be the label.

Returns
A list values

◆ getType()

virtual int ctkAttributeDefinition::getType ( ) const
pure virtual

Return the type for this attribute.

The following types from QVariant::Type are supported: QVariant::String, QVariant::LongLong, QVariant::Int, QVariant::Char, QVariant::Double, QVariant::Bool, QVariant::UserType.

QVariant::UserType maps to ctkAttributeDefinition::Password only.

Returns
The type for this attribute.

◆ validate()

virtual QString ctkAttributeDefinition::validate ( const QString &  value) const
pure virtual

Validate an attribute in QString form.

An attribute might be further constrained in value. This method will attempt to validate the attribute according to these constraints. It can return three different values:

 a null QString     No validation present
 an empty QString   No problems detected
 "..."              A localized description of why the value is wrong
Parameters
valueThe value before turning it into the basic data type
Returns
a null QString, an empty QString, or another QString

Member Data Documentation

◆ PASSWORD

const int ctkAttributeDefinition::PASSWORD
static

Definition at line 46 of file ctkAttributeDefinition.h.


The documentation for this struct was generated from the following file: