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

Controller for adding, updating and removing field definitions. More...

#include <fielddefinitionscontroller.h>

Inheritance diagram for Tome::FieldDefinitionsController:

Signals

void fieldDefinitionAdded (const Tome::FieldDefinition &fieldDefinition)
 A new field definition has been added to the project. More...
 
void fieldDefinitionRemoved (const Tome::FieldDefinition &fieldDefinition)
 A field definition has been removed from the project. More...
 
void fieldDefinitionUpdated (const Tome::FieldDefinition &oldFieldDefinition, const Tome::FieldDefinition &newFieldDefinition)
 The properties of a field definition have been updated. More...
 

Public Member Functions

 FieldDefinitionsController (const ComponentsController &componentsController, const TypesController &typesController)
 Constructs a new controller for adding, updating and removing field definitions. More...
 
void addFieldDefinition (const QString &id, const QString &displayName, const QString &fieldType, const QVariant &defaultValue, const QString &component, const QString &description, const QString &fieldDefinitionSetName)
 Adds a new field definition to the specified set. More...
 
void addFieldDefinitionSet (const FieldDefinitionSet &fieldDefinitionSet)
 Adds the passed field definition set to the project. More...
 
const FieldDefinitiongetFieldDefinition (const QString &id) const
 Gets the field definition with the specified id. More...
 
const FieldDefinitionList getFieldDefinitions () const
 Gets a list of all field definitions in the project. More...
 
const FieldDefinitionList getFieldDefinitionsOfComponent (const QString &component) const
 Gets a list of all field definitions belonging to the specified component. More...
 
const FieldDefinitionSetList & getFieldDefinitionSets () const
 Gets a list of all field definition sets in the project. More...
 
const QStringList getFieldDefinitionSetNames () const
 Gets a list of the names of all field definition sets in the project. More...
 
bool hasFieldDefinition (const QString &id) const
 Checks whether the project has a field definition with the specified id. More...
 
void removeFieldDefinition (const QString &fieldId)
 Removes the field definition with the specified id from the project. More...
 
void removeFieldDefinitionSet (const QString &name)
 Removes the field definition set with the specified name from the project, including all fields. More...
 
void setFieldDefinitionSets (FieldDefinitionSetList &model)
 Uses the specified list of field definition sets as model for this controller. More...
 
void updateFieldDefinition (const QString oldId, const QString newId, const QString &displayName, const QString &fieldType, const QVariant &defaultValue, const QString &component, const QString &description, const QString &fieldDefinitionSetName)
 Updates the properties of the specified field definition. More...
 

Detailed Description

Controller for adding, updating and removing field definitions.

Constructor & Destructor Documentation

◆ FieldDefinitionsController()

FieldDefinitionsController::FieldDefinitionsController ( const ComponentsController componentsController,
const TypesController typesController 
)

Constructs a new controller for adding, updating and removing field definitions.

Parameters
componentsControllerController for adding and removing components.
typesControllerController for adding, updating and removing custom types.

Member Function Documentation

◆ addFieldDefinition()

void FieldDefinitionsController::addFieldDefinition ( const QString &  id,
const QString &  displayName,
const QString &  fieldType,
const QVariant &  defaultValue,
const QString &  component,
const QString &  description,
const QString &  fieldDefinitionSetName 
)

Adds a new field definition to the specified set.

Exceptions
std::out_of_rangeif a field with the specified id already exists.
std::out_of_rangeif the field definition set could not be found.
See also
hasFieldDefinition for checking whether a field definition with the specified id already exists.
Parameters
idId of the field to add.
displayNameDisplay name of the field to add.
fieldTypeType of the field to add.
defaultValueDefault value of the field to add.
componentComponent to add the field to.
descriptionTextual description of the field to add.
fieldDefinitionSetNameName of the field definition set to add the field to.

◆ addFieldDefinitionSet()

void FieldDefinitionsController::addFieldDefinitionSet ( const FieldDefinitionSet fieldDefinitionSet)

Adds the passed field definition set to the project.

Parameters
fieldDefinitionSetField definition set to add.

◆ fieldDefinitionAdded

void Tome::FieldDefinitionsController::fieldDefinitionAdded ( const Tome::FieldDefinition fieldDefinition)
signal

A new field definition has been added to the project.

Parameters
fieldDefinitionNew field defintion that has been added to the project.

◆ fieldDefinitionRemoved

void Tome::FieldDefinitionsController::fieldDefinitionRemoved ( const Tome::FieldDefinition fieldDefinition)
signal

A field definition has been removed from the project.

Parameters
fieldDefinitionField definition that has been removed from the project.

◆ fieldDefinitionUpdated

void Tome::FieldDefinitionsController::fieldDefinitionUpdated ( const Tome::FieldDefinition oldFieldDefinition,
const Tome::FieldDefinition newFieldDefinition 
)
signal

The properties of a field definition have been updated.

Parameters
oldFieldDefinitionOld properties of the field definition.
newFieldDefinitionNew properties of the field definition.

◆ getFieldDefinition()

const FieldDefinition & FieldDefinitionsController::getFieldDefinition ( const QString &  id) const

Gets the field definition with the specified id.

Exceptions
std::out_of_rangeif the field definition with the specified id could not be found.
See also
hasFieldDefinition for checking whether a field definition with the specified id exists.
Parameters
idId of the field definition to get.
Returns
Field definition with the specified id.

◆ getFieldDefinitions()

const FieldDefinitionList FieldDefinitionsController::getFieldDefinitions ( ) const

Gets a list of all field definitions in the project.

Returns
List of all field definitions in the project.

◆ getFieldDefinitionSetNames()

const QStringList FieldDefinitionsController::getFieldDefinitionSetNames ( ) const

Gets a list of the names of all field definition sets in the project.

Returns
List of the names of all field definition sets in the project.

◆ getFieldDefinitionSets()

const FieldDefinitionSetList & FieldDefinitionsController::getFieldDefinitionSets ( ) const

Gets a list of all field definition sets in the project.

Returns
List of all field definition sets in the project.

◆ getFieldDefinitionsOfComponent()

const FieldDefinitionList FieldDefinitionsController::getFieldDefinitionsOfComponent ( const QString &  component) const

Gets a list of all field definitions belonging to the specified component.

Parameters
componentComponent to get all fields of.
Returns
List of all field definitions belonging to the specified component.

◆ hasFieldDefinition()

bool FieldDefinitionsController::hasFieldDefinition ( const QString &  id) const

Checks whether the project has a field definition with the specified id.

Parameters
idId of the field definition to look for.
Returns
true, if a field definition with the specified id exists, and false otherwise.

◆ removeFieldDefinition()

void FieldDefinitionsController::removeFieldDefinition ( const QString &  fieldId)

Removes the field definition with the specified id from the project.

Parameters
fieldIdId of the field to remove.

◆ removeFieldDefinitionSet()

void FieldDefinitionsController::removeFieldDefinitionSet ( const QString &  name)

Removes the field definition set with the specified name from the project, including all fields.

Parameters
nameName of the field definition set to remove.

◆ setFieldDefinitionSets()

void FieldDefinitionsController::setFieldDefinitionSets ( FieldDefinitionSetList &  model)

Uses the specified list of field definition sets as model for this controller.

Parameters
modelNew list of field definition sets to use as model for this controller.

◆ updateFieldDefinition()

void FieldDefinitionsController::updateFieldDefinition ( const QString  oldId,
const QString  newId,
const QString &  displayName,
const QString &  fieldType,
const QVariant &  defaultValue,
const QString &  component,
const QString &  description,
const QString &  fieldDefinitionSetName 
)

Updates the properties of the specified field definition.

Exceptions
std::out_of_rangeif the field definition with the specified id could not be found.
std::out_of_rangeif a field with the new id already exists.
See also
hasFieldDefinition for checking whether a field definition with the specified id exists.
Parameters
oldIdCurrent id of the field to update.
newIdNew id of the field to update.
displayNameNew display name of the field.
fieldTypeNew type of the field.
defaultValueNew default value of the field.
componentNew component the field should belong to.
descriptionNew textual description of the field.
fieldDefinitionSetNameName of the new field definition set the field should belong to.

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