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

Controller for adding and removing components. More...

#include <componentscontroller.h>

Inheritance diagram for Tome::ComponentsController:

Signals

void componentAdded (const Tome::Component &component)
 A new component has been added to the project. More...
 
void componentRemoved (const Tome::Component &component)
 A component has been removed from the project. More...
 

Public Member Functions

 ComponentsController ()
 Constructs a new controller for adding and removing components.
 
const Component addComponent (const QString &componentName, const QString &componentSetName)
 Adds a new component to the specified component set. More...
 
void addComponentSet (const ComponentSet &componentSet)
 Adds a new component set to the project. More...
 
const ComponentList getComponents () const
 Gets a list of all components in the project. More...
 
const ComponentSetList & getComponentSets () const
 Gets a list of all component sets in the project. More...
 
const QStringList getComponentSetNames () const
 Gets a list of the names of all component sets in the project. More...
 
const QString getSetNameOfComponent (const Component component) const
 Gets the name of the component set containing the specified component. More...
 
int indexOf (const Component &component) const
 Gets the index of the specified component within its set. More...
 
bool removeComponent (const Component component)
 Removes the specified component from the project. More...
 
bool removeComponentSet (const QString &name)
 Removes the component set with the specified name from the project, including all components. More...
 
void setComponents (ComponentSetList &model)
 Uses the specified list of component sets as model for this controller. More...
 

Detailed Description

Controller for adding and removing components.

Member Function Documentation

◆ addComponent()

const Component ComponentsController::addComponent ( const QString &  componentName,
const QString &  componentSetName 
)

Adds a new component to the specified component set.

Exceptions
std::out_of_rangeif the component set could not be found.
Parameters
componentNameName of the component to add.
componentSetNameName of the component set to add the component to.
Returns

◆ addComponentSet()

void ComponentsController::addComponentSet ( const ComponentSet componentSet)

Adds a new component set to the project.

Parameters
componentSetName of the component set to add.

◆ componentAdded

void Tome::ComponentsController::componentAdded ( const Tome::Component &  component)
signal

A new component has been added to the project.

Parameters
componentComponent that has been added to the project.

◆ componentRemoved

void Tome::ComponentsController::componentRemoved ( const Tome::Component &  component)
signal

A component has been removed from the project.

Parameters
componentComponent that has been removed from the project.

◆ getComponents()

const ComponentList ComponentsController::getComponents ( ) const

Gets a list of all components in the project.

Returns
List of all components in the project.

◆ getComponentSetNames()

const QStringList ComponentsController::getComponentSetNames ( ) const

Gets a list of the names of all component sets in the project.

Returns
List of the names of all component sets in the project.

◆ getComponentSets()

const ComponentSetList & ComponentsController::getComponentSets ( ) const

Gets a list of all component sets in the project.

Returns
List of all component sets in the project.

◆ getSetNameOfComponent()

const QString ComponentsController::getSetNameOfComponent ( const Component  component) const

Gets the name of the component set containing the specified component.

Exceptions
std::out_of_rangeif the component could not be found.
Parameters
componentComponent to get the name of the containing set of.
Returns
Name of the set containing the specified component.

◆ indexOf()

int ComponentsController::indexOf ( const Component &  component) const

Gets the index of the specified component within its set.

Returns -1 if the component could not be found.

Parameters
componentComponent to get the index of.
Returns
Index of the specified component within its set, or -1 if that component could not be found.

◆ removeComponent()

bool ComponentsController::removeComponent ( const Component  component)

Removes the specified component from the project.

Parameters
componentComponent to remove.
Returns
true, if the component was removed, and false if the component could not be found.

◆ removeComponentSet()

bool ComponentsController::removeComponentSet ( const QString &  name)

Removes the component set with the specified name from the project, including all components.

Parameters
nameName of the component set to remove.
Returns
true, if the component set was removed, and false if the component set could not be found.

◆ setComponents()

void ComponentsController::setComponents ( ComponentSetList &  model)

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

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

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