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

Controller for validating type facets. More...

#include <facetscontroller.h>

Public Member Functions

 FacetsController (const RecordsController &recordsController, const TypesController &typesController)
 Constructs a new controller for validating type facets. More...
 
QList< Facet * > getFacets (const QString &targetType) const
 Gets a list of all facets that may apply to the specified type. More...
 
QVariant getFacetValue (const QString &fieldType, const QString &facetKey) const
 Gets the restriction of the specified domain of the specified type (e.g. minimum value of an integer). More...
 
void registerFacet (Facet *facet)
 Adds a new facet to be applied to custom types. More...
 
QString validateFieldValue (const QString &fieldType, const QVariant &fieldValue) const
 Validates the specified field value against the domain restrictions imposed by the facets of its type. More...
 

Detailed Description

Controller for validating type facets.

Constructor & Destructor Documentation

◆ FacetsController()

FacetsController::FacetsController ( const RecordsController recordsController,
const TypesController typesController 
)

Constructs a new controller for validating type facets.

Parameters
recordsControllerController for adding, updating and removing records.
typesControllerController for adding, updating and removing custom types.

Member Function Documentation

◆ getFacets()

QList< Facet * > FacetsController::getFacets ( const QString &  targetType) const

Gets a list of all facets that may apply to the specified type.

Parameters
targetTypeType to get all facets for.
Returns
List of all facets that may apply to the specified type.

◆ getFacetValue()

QVariant FacetsController::getFacetValue ( const QString &  fieldType,
const QString &  facetKey 
) const

Gets the restriction of the specified domain of the specified type (e.g. minimum value of an integer).

Parameters
fieldTypeType to get the restriction of.
facetKeyRestriction to get.
Returns
Restriction of the specified domain of the specified type.

◆ registerFacet()

void FacetsController::registerFacet ( Tome::Facet facet)

Adds a new facet to be applied to custom types.

Parameters
facetFacet to add.

◆ validateFieldValue()

QString FacetsController::validateFieldValue ( const QString &  fieldType,
const QVariant &  fieldValue 
) const

Validates the specified field value against the domain restrictions imposed by the facets of its type.

Parameters
fieldTypeType of the field value to validate.
fieldValueField value to validate.
Returns
Translated error message, if any validation errors occur, and an empty string otherwise.

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