Tome
A generic data editor for games supporting arbitrary input and output formats.
Public Member Functions | List of all members
Tome::Facet Class Referenceabstract

Restricts the domain of a custom type. More...

#include <facet.h>

Inheritance diagram for Tome::Facet:
Tome::LocalizedStringFacet Tome::MaximumIntegerValueFacet Tome::MaximumRealValueFacet Tome::MaximumStringLengthFacet Tome::MinimumIntegerValueFacet Tome::MinimumRealValueFacet Tome::RemovedFilePrefixFacet Tome::RemovedFileSuffixFacet Tome::RequiredReferenceAncestorFacet

Public Member Functions

 Facet ()
 Constructs a new facet for restricting the domain of a custom type.
 
virtual QWidget * createWidget (const FacetContext &context) const =0
 Creates a widget for specifying the restriction of the domain of the custom type (e.g. QSpinBox). More...
 
virtual const QVariant getDefaultValue () const =0
 Gets the default restriction of the domain of the custom type (e.g. default minimum value). More...
 
virtual const QString getDescriptionForValue (const QVariant facetValue) const =0
 Gets the text to add to the description of a field, explaining the restriction of the domain of the custom type (e.g. "Minimum value is 0."). More...
 
virtual const QString getDisplayName () const =0
 Gets the name of the restriction of the domain of the custom type (e.g. "Minimum Value"). More...
 
virtual const QString getKey () const =0
 Gets the key of the restriction of the domain of the custom type used for serialization. More...
 
virtual const QString getTargetType () const =0
 Gets the custom type whose domain can be restricted by this facet. More...
 
virtual const QVariant getWidgetValue (QWidget *widget) const =0
 Gets the current value of the widget for specifying the restriction of the domain of the custom type (e.g. value of a QSpinBox). More...
 
virtual void setWidgetValue (QWidget *widget, const QVariant value) const =0
 Sets the current value of the widget for specifying the restriction of the domain of the custom type (e.g. value of a QSpinBox). More...
 
virtual QString validateValue (const FacetContext &context, const QVariant value, const QVariant facetValue) const =0
 Validates the specified field value against the domain restrictions imposed by this facet. More...
 

Detailed Description

Restricts the domain of a custom type.

Member Function Documentation

◆ createWidget()

virtual QWidget* Tome::Facet::createWidget ( const FacetContext context) const
pure virtual

Creates a widget for specifying the restriction of the domain of the custom type (e.g. QSpinBox).

Parameters
contextAdditional information for creating the widget.
Returns
Widget for specifying the restriction of the domain of the custom type.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ getDefaultValue()

virtual const QVariant Tome::Facet::getDefaultValue ( ) const
pure virtual

Gets the default restriction of the domain of the custom type (e.g. default minimum value).

Returns
Default restriction of the domain of the custom type (e.g. default minimum value).

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ getDescriptionForValue()

virtual const QString Tome::Facet::getDescriptionForValue ( const QVariant  facetValue) const
pure virtual

Gets the text to add to the description of a field, explaining the restriction of the domain of the custom type (e.g. "Minimum value is 0.").

Parameters
facetValueRestriction of the domain of the custom type.
Returns
Text to add to the description of a field, explaining the restriction of the domain of the custom type.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ getDisplayName()

virtual const QString Tome::Facet::getDisplayName ( ) const
pure virtual

Gets the name of the restriction of the domain of the custom type (e.g. "Minimum Value").

Returns
Name of the restriction of the domain of the custom type.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ getKey()

virtual const QString Tome::Facet::getKey ( ) const
pure virtual

Gets the key of the restriction of the domain of the custom type used for serialization.

Returns
Key of the restriction of the domain of the custom type used for serialization.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ getTargetType()

virtual const QString Tome::Facet::getTargetType ( ) const
pure virtual

◆ getWidgetValue()

virtual const QVariant Tome::Facet::getWidgetValue ( QWidget *  widget) const
pure virtual

Gets the current value of the widget for specifying the restriction of the domain of the custom type (e.g. value of a QSpinBox).

Parameters
widgetWidget to get the current value of.
Returns
Current value of the widget for specifying the restriction of the domain of the custom type.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ setWidgetValue()

virtual void Tome::Facet::setWidgetValue ( QWidget *  widget,
const QVariant  value 
) const
pure virtual

Sets the current value of the widget for specifying the restriction of the domain of the custom type (e.g. value of a QSpinBox).

Parameters
widgetWidget to set the current value of.
valueValue to set.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.

◆ validateValue()

virtual QString Tome::Facet::validateValue ( const FacetContext context,
const QVariant  value,
const QVariant  facetValue 
) const
pure virtual

Validates the specified field value against the domain restrictions imposed by this facet.

Parameters
contextContext to validate the field value in.
valueField value to validate.
facetValueRestriction of the domain of the custom type (e.g. minimum value).
Returns
Translated error message, if any validation errors occur, and an empty string otherwise.

Implemented in Tome::MaximumIntegerValueFacet, Tome::LocalizedStringFacet, Tome::MaximumRealValueFacet, Tome::MaximumStringLengthFacet, Tome::MinimumIntegerValueFacet, Tome::MinimumRealValueFacet, Tome::RemovedFilePrefixFacet, Tome::RemovedFileSuffixFacet, and Tome::RequiredReferenceAncestorFacet.


The documentation for this class was generated from the following files: