A class to represent the state of a Task. More...
#include <taskstates.h>
Public Types | |
enum | SettableState { Failed, Unfinished, Successful } |
Public Member Functions | |
virtual QString | name () const =0 |
Static Public Member Functions | |
static QList < TaskState::SettableState > | allStates () |
static TaskState * | stateForEnum (TaskState::SettableState state) |
static QString | nameForEnum (TaskState::SettableState state) |
Protected Member Functions | |
TaskState (const TaskState &other) | |
TaskState & | operator= (const TaskState &other) |
Static Protected Member Functions | |
static void | setTaskState (Task *task, TaskState *state) |
static void | setTaskField (Task *task, const QString &id, const QVariant &value) |
static void | addTaskReservation (Task *task, Reservation *reservation) |
static void | setTaskProject (Task *task, Project *project) |
static void | addTaskSubTask (Task *task, Task *subTask) |
Private Member Functions | |
virtual SettableState | settableState () const =0 |
virtual void | updateTask (Task *task) |
virtual void | setField (Task *task, const QString &id, const QVariant &value) |
virtual void | addReservation (Task *task, Reservation *reservation) |
virtual void | setProject (Task *task, Project *project) |
virtual void | addSubTask (Task *task, Task *subTask) |
Friends | |
class | Task |
A class to represent the state of a Task.
This class is the general superclass to represent the state a Task has. Because the state of a task determines its behavior, this class has the responsibility to correctly implement that behavior for a certain state.
Definition at line 28 of file taskstates.h.
void TaskState::addReservation | ( | Task * | task, | |
Reservation * | reservation | |||
) | [private, virtual] |
Adds a given reservation to a given task.
task | The task to change | |
reservation | The reservation to add |
StringException |
Reimplemented in domain::TaskSuccessful, domain::TaskFailed, domain::TaskUnfinished, and domain::TaskDeleting.
Definition at line 98 of file taskstates.cpp.
Adds a given subtask to a given task.
task | The task to change | |
subTask | The task to add as subtask |
StringException |
Reimplemented in domain::TaskUnfinished, and domain::TaskDeleting.
Definition at line 110 of file taskstates.cpp.
void TaskState::addTaskReservation | ( | Task * | task, | |
Reservation * | reservation | |||
) | [static, protected] |
Adds a given reservation to a given task.
task | The task to change | |
reservation | The reservation to add |
Definition at line 72 of file taskstates.cpp.
Adds a given subtask to a given task.
task | The task to change | |
subTask | The task to add as subtask |
Definition at line 82 of file taskstates.cpp.
QList< TaskState::SettableState > TaskState::allStates | ( | ) | [static] |
Returns all the possible states that can be used to set the state of a Task.
Definition at line 23 of file taskstates.cpp.
QString TaskState::nameForEnum | ( | TaskState::SettableState | state | ) | [static] |
Returns the name for a given setttable state.
state | The state to give the name for |
Definition at line 53 of file taskstates.cpp.
void TaskState::setField | ( | Task * | task, | |
const QString & | id, | |||
const QVariant & | value | |||
) | [private, virtual] |
Sets a field of a given task.
task | The task to change | |
id | The id of the field to set | |
value | The value to set the field to |
StringException |
Reimplemented in domain::TaskSuccessful, domain::TaskFailed, domain::TaskUnfinished, and domain::TaskDeleting.
Definition at line 92 of file taskstates.cpp.
Sets the project of a given task to the given project.
task | The task to change | |
project | The project to set |
StringException |
Reimplemented in domain::TaskSuccessful, domain::TaskFailed, domain::TaskUnfinished, and domain::TaskDeleting.
Definition at line 104 of file taskstates.cpp.
virtual SettableState domain::TaskState::settableState | ( | ) | const [private, pure virtual] |
Returns the settable state for this task state.
Implemented in domain::TaskSuccessful, domain::TaskFailed, domain::TaskUnfinished, and domain::TaskDeleting.
void TaskState::setTaskField | ( | Task * | task, | |
const QString & | id, | |||
const QVariant & | value | |||
) | [static, protected] |
Sets a field of a given task.
task | The task to change | |
id | The id of the field to set | |
value | The value to set the field to |
Definition at line 67 of file taskstates.cpp.
Sets the project of a given task to the given project.
task | The task to change | |
project | The project to set |
Definition at line 77 of file taskstates.cpp.
Sets the state of a given task to the given state.
task | The Task to change | |
state | The state to set |
Definition at line 62 of file taskstates.cpp.
TaskState * TaskState::stateForEnum | ( | TaskState::SettableState | state | ) | [static] |
Returns the TaskState for a given settable state.
state | The state to give the TaskState representation for |
Definition at line 37 of file taskstates.cpp.
void TaskState::updateTask | ( | Task * | task | ) | [private, virtual] |
Updates the state of the given task to the correct state.
task | The task to update the state of |
Reimplemented in domain::TaskSuccessful, and domain::TaskUnfinished.
Definition at line 87 of file taskstates.cpp.